diff --git a/AdvancedBilling.Standard/AdvancedBilling.Standard.csproj b/AdvancedBilling.Standard/AdvancedBilling.Standard.csproj index e34484b7..96507285 100644 --- a/AdvancedBilling.Standard/AdvancedBilling.Standard.csproj +++ b/AdvancedBilling.Standard/AdvancedBilling.Standard.csproj @@ -9,13 +9,13 @@ netstandard2.0 Maxio.AdvancedBillingSdk - 7.0.1.0 + 8.0.0.0 MaxioSdk AdvancedBilling.Standard Copyright © 2019 - 7.0.1.0 - 7.0.1.0 + 8.0.0.0 + 8.0.0.0 Ultimate billing and pricing flexibility for B2B SaaS. Maxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments. 7.3 @@ -29,12 +29,14 @@ Maxio integrates directly into your product, so you can seamlessly manage your p LICENSE true + $(NoWarn);1591 - + + diff --git a/AdvancedBilling.Standard/AdvancedBillingClient.cs b/AdvancedBilling.Standard/AdvancedBillingClient.cs index 4940b59b..13201c00 100644 --- a/AdvancedBilling.Standard/AdvancedBillingClient.cs +++ b/AdvancedBilling.Standard/AdvancedBillingClient.cs @@ -12,6 +12,7 @@ using AdvancedBilling.Standard.Controllers; using AdvancedBilling.Standard.Http.Client; using AdvancedBilling.Standard.Utilities; +using Microsoft.Extensions.Configuration; namespace AdvancedBilling.Standard { @@ -42,7 +43,7 @@ public sealed class AdvancedBillingClient : IConfiguration }; private readonly GlobalConfiguration globalConfiguration; - private const string userAgent = "AB SDK DotNet:7.0.1 on OS {os-info}"; + private const string userAgent = "AB SDK DotNet:8.0.0 on OS {os-info}"; private readonly HttpCallback httpCallback; private readonly Lazy aPIExports; private readonly Lazy advanceInvoice; @@ -435,6 +436,13 @@ internal static AdvancedBillingClient CreateFromEnvironment() return builder.Build(); } + /// + /// Creates the client from configuration. + /// + /// AdvancedBillingClient. + public static AdvancedBillingClient FromConfiguration(IConfigurationSection configuration) => + Builder.FromConfiguration(configuration).Build(); + /// /// Builder class. /// @@ -500,6 +508,15 @@ public Builder HttpClientConfig(Action action) return this; } + private Builder HttpClientConfig(HttpClientConfiguration.Builder httpClientConfigurationBuilder) + { + if (httpClientConfigurationBuilder != null) + { + this.httpClientConfig = httpClientConfigurationBuilder; + } + + return this; + } /// @@ -530,6 +547,34 @@ public AdvancedBillingClient Build() httpCallback, httpClientConfig.Build()); } + + /// + /// Creates the client builder from configuration. + /// + /// Builder. + public static Builder FromConfiguration(IConfigurationSection config) + { + var builder = new Builder(); + var options = config.Get(); + if (options == null) return builder; + if (options.Environment != null) + builder.Environment(options.Environment.Value); + if (options.Site != null) + builder.Site(options.Site); + if (options.BasicAuthCredentials != null) + builder.BasicAuthCredentials(BasicAuthModel.FromOptions(options.BasicAuthCredentials)); + if (options.HttpClientConfig != null) + builder.HttpClientConfig(Http.Client.HttpClientConfiguration.FromOptions(options.HttpClientConfig)); + return builder; + } + } + + public class AdvancedBillingClientOptions + { + public Environment? Environment { get; set; } + public string Site { get; set; } + public BasicAuthModelOptions BasicAuthCredentials { get; set; } + public HttpClientConfigurationOptions HttpClientConfig { get; set; } } } } diff --git a/AdvancedBilling.Standard/Authentication/BasicAuthManager.cs b/AdvancedBilling.Standard/Authentication/BasicAuthManager.cs index 1e45edce..522ea33b 100644 --- a/AdvancedBilling.Standard/Authentication/BasicAuthManager.cs +++ b/AdvancedBilling.Standard/Authentication/BasicAuthManager.cs @@ -130,5 +130,17 @@ public BasicAuthModel Build() }; } } + + internal static BasicAuthModel FromOptions(BasicAuthModelOptions options) + { + var builder = new Builder(options.Username, options.Password); + return builder.Build(); + } + } + + public class BasicAuthModelOptions + { + public string Username { get; set; } + public string Password { get; set; } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs b/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs index f1f8bd43..72c2f475 100644 --- a/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs +++ b/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs @@ -36,7 +36,7 @@ public class AdvanceInvoiceController : BaseController internal AdvanceInvoiceController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. + /// Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. /// A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error. /// That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated. /// We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it. @@ -50,7 +50,7 @@ public Models.Invoice IssueAdvanceInvoice( => CoreHelper.RunTask(IssueAdvanceInvoiceAsync(subscriptionId, body)); /// - /// Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. + /// Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. /// A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error. /// That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated. /// We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it. @@ -106,7 +106,7 @@ public Models.Invoice ReadAdvanceInvoice( /// /// Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. - /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs]($m/Invoice). + /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice). /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . @@ -118,7 +118,7 @@ public Models.Invoice VoidAdvanceInvoice( /// /// Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. - /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs]($m/Invoice). + /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice). /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . diff --git a/AdvancedBilling.Standard/Controllers/BillingPortalController.cs b/AdvancedBilling.Standard/Controllers/BillingPortalController.cs index 17fa53a2..65867d7b 100644 --- a/AdvancedBilling.Standard/Controllers/BillingPortalController.cs +++ b/AdvancedBilling.Standard/Controllers/BillingPortalController.cs @@ -44,7 +44,7 @@ internal BillingPortalController(GlobalConfiguration globalConfiguration) : base /// ## Billing Portal Security. /// If your customer has been invited to the Billing Portal, then they will receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.**. /// If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing. - /// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), please **do not** make an API request to Advanced Billing every time. + /// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time. /// ]]> /// /// Required parameter: The Chargify id of the customer. @@ -64,7 +64,7 @@ public Models.CustomerResponse EnableBillingPortalForCustomer( /// ## Billing Portal Security. /// If your customer has been invited to the Billing Portal, then they will receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.**. /// If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing. - /// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), please **do not** make an API request to Advanced Billing every time. + /// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time. /// ]]> /// /// Required parameter: The Chargify id of the customer. diff --git a/AdvancedBilling.Standard/Controllers/ComponentPricePointsController.cs b/AdvancedBilling.Standard/Controllers/ComponentPricePointsController.cs index fab80825..6694f123 100644 --- a/AdvancedBilling.Standard/Controllers/ComponentPricePointsController.cs +++ b/AdvancedBilling.Standard/Controllers/ComponentPricePointsController.cs @@ -176,7 +176,7 @@ public Models.ComponentPricePointsResponse BulkCreateComponentPricePoints( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones. + /// When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. /// Passing in a price bracket without an `id` will attempt to create a new price. /// Including an `id` will update the corresponding price, and including the `_destroy` flag set to true along with the `id` will remove that price. /// Note: Custom price points cannot be updated directly. They must be edited through the Subscription. @@ -192,7 +192,7 @@ public Models.ComponentPricePointResponse UpdateComponentPricePoint( => CoreHelper.RunTask(UpdateComponentPricePointAsync(componentId, pricePointId, body)); /// - /// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones. + /// When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. /// Passing in a price bracket without an `id` will attempt to create a new price. /// Including an `id` will update the corresponding price, and including the `_destroy` flag set to true along with the `id` will remove that price. /// Note: Custom price points cannot be updated directly. They must be edited through the Subscription. diff --git a/AdvancedBilling.Standard/Controllers/ComponentsController.cs b/AdvancedBilling.Standard/Controllers/ComponentsController.cs index b27bfe3a..b00799e1 100644 --- a/AdvancedBilling.Standard/Controllers/ComponentsController.cs +++ b/AdvancedBilling.Standard/Controllers/ComponentsController.cs @@ -39,7 +39,7 @@ internal ComponentsController(GlobalConfiguration globalConfiguration) : base(gl /// This request will create a component definition of kind **metered_component** under the specified product family. Metered component can then be added and “allocated” for a subscription. /// Metered components are used to bill for any type of unit that resets to 0 at the end of the billing period (think daily Google Adwords clicks or monthly cell phone minutes). This is most commonly associated with usage-based billing and many other pricing schemes. /// Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -53,7 +53,7 @@ public Models.ComponentResponse CreateMeteredComponent( /// This request will create a component definition of kind **metered_component** under the specified product family. Metered component can then be added and “allocated” for a subscription. /// Metered components are used to bill for any type of unit that resets to 0 at the end of the billing period (think daily Google Adwords clicks or monthly cell phone minutes). This is most commonly associated with usage-based billing and many other pricing schemes. /// Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -84,7 +84,7 @@ public Models.ComponentResponse CreateMeteredComponent( /// #### One-time. /// One-time quantity-based components are used to create ad hoc usage charges that do not recur. For example, at the time of signup, you might want to charge your customer a one-time fee for onboarding or other services. /// The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -102,7 +102,7 @@ public Models.ComponentResponse CreateQuantityBasedComponent( /// #### One-time. /// One-time quantity-based components are used to create ad hoc usage charges that do not recur. For example, at the time of signup, you might want to charge your customer a one-time fee for onboarding or other services. /// The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -128,7 +128,7 @@ public Models.ComponentResponse CreateQuantityBasedComponent( /// /// This request will create a component definition of kind **on_off_component** under the specified product family. On/Off component can then be added and “allocated” for a subscription. /// On/off components are used for any flat fee, recurring add on (think $99/month for tech support or a flat add on shipping fee). - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -141,7 +141,7 @@ public Models.ComponentResponse CreateOnOffComponent( /// /// This request will create a component definition of kind **on_off_component** under the specified product family. On/Off component can then be added and “allocated” for a subscription. /// On/off components are used for any flat fee, recurring add on (think $99/month for tech support or a flat add on shipping fee). - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -167,7 +167,7 @@ public Models.ComponentResponse CreateOnOffComponent( /// /// This request will create a component definition of kind **prepaid_usage_component** under the specified product family. Prepaid component can then be added and “allocated” for a subscription. /// Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -180,7 +180,7 @@ public Models.ComponentResponse CreatePrepaidUsageComponent( /// /// This request will create a component definition of kind **prepaid_usage_component** under the specified product family. Prepaid component can then be added and “allocated” for a subscription. /// Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -207,7 +207,7 @@ public Models.ComponentResponse CreatePrepaidUsageComponent( /// This request will create a component definition of kind **event_based_component** under the specified product family. Event-based component can then be added and “allocated” for a subscription. /// Event-based components are similar to other component types, in that you define the component parameters (such as name and taxability) and the pricing. A key difference for the event-based component is that it must be attached to a metric. This is because the metric provides the component with the actual quantity used in computing what and how much will be billed each period for each subscription. /// So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . @@ -221,7 +221,7 @@ public Models.ComponentResponse CreateEventBasedComponent( /// This request will create a component definition of kind **event_based_component** under the specified product family. Event-based component can then be added and “allocated” for a subscription. /// Event-based components are similar to other component types, in that you define the component parameters (such as name and taxability) and the pricing. A key difference for the event-based component is that it must be attached to a metric. This is because the metric provides the component with the actual quantity used in computing what and how much will be billed each period for each subscription. /// So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. - /// For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + /// For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). /// /// Required parameter: Either the product family's id or its handle prefixed with `handle:`. /// Optional parameter: . diff --git a/AdvancedBilling.Standard/Controllers/CouponsController.cs b/AdvancedBilling.Standard/Controllers/CouponsController.cs index 92e3549d..1909b9bf 100644 --- a/AdvancedBilling.Standard/Controllers/CouponsController.cs +++ b/AdvancedBilling.Standard/Controllers/CouponsController.cs @@ -38,8 +38,8 @@ internal CouponsController(GlobalConfiguration globalConfiguration) : base(globa /// /// /// /// List coupons for a specific Product Family in a Site. - /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. /// /// Object containing request parameters. /// Returns the List of Models.CouponResponse response from the API call. @@ -99,7 +98,6 @@ public Models.CouponResponse CreateCoupon( /// /// List coupons for a specific Product Family in a Site. - /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. /// /// Object containing request parameters. /// cancellationToken. @@ -285,7 +283,6 @@ public Models.CouponResponse ArchiveCoupon( /// /// You can retrieve a list of coupons. - /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. /// /// Object containing request parameters. /// Returns the List of Models.CouponResponse response from the API call. @@ -295,7 +292,6 @@ public Models.CouponResponse ArchiveCoupon( /// /// You can retrieve a list of coupons. - /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. /// /// Object containing request parameters. /// cancellationToken. @@ -317,8 +313,8 @@ public Models.CouponResponse ArchiveCoupon( /// /// This request will provide details about the coupon usage as an array of data hashes, one per product. /// - /// Required parameter: The Advanced Billing id of the product family to which the coupon belongs. - /// Required parameter: The Advanced Billing id of the coupon. + /// Required parameter: The Advanced Billing id of the product family to which the coupon belongs.. + /// Required parameter: The Advanced Billing id of the coupon.. /// Returns the List of Models.CouponUsage response from the API call. public List ReadCouponUsage( int productFamilyId, @@ -328,8 +324,8 @@ public Models.CouponResponse ArchiveCoupon( /// /// This request will provide details about the coupon usage as an array of data hashes, one per product. /// - /// Required parameter: The Advanced Billing id of the product family to which the coupon belongs. - /// Required parameter: The Advanced Billing id of the coupon. + /// Required parameter: The Advanced Billing id of the product family to which the coupon belongs.. + /// Required parameter: The Advanced Billing id of the coupon.. /// cancellationToken. /// Returns the List of Models.CouponUsage response from the API call. public async Task> ReadCouponUsageAsync( @@ -459,7 +455,7 @@ public Models.CouponCurrencyResponse CreateOrUpdateCouponCurrencyPrices( /// When creating a coupon subcode, you must specify a coupon to attach it to using the coupon_id. Valid coupon subcodes are all capital letters, contain only letters and numbers, and do not have any spaces. Lowercase letters will be capitalized before the subcode is created. /// ## Coupon Subcodes Documentation. /// Full documentation on how to create coupon subcodes in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes). - /// Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). + /// Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). /// ## Create Coupon Subcode. /// This request allows you to create specific subcodes underneath an existing coupon code. /// *Note*: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), you must encode them for use in the URL. @@ -495,7 +491,7 @@ public Models.CouponSubcodesResponse CreateCouponSubcodes( /// When creating a coupon subcode, you must specify a coupon to attach it to using the coupon_id. Valid coupon subcodes are all capital letters, contain only letters and numbers, and do not have any spaces. Lowercase letters will be capitalized before the subcode is created. /// ## Coupon Subcodes Documentation. /// Full documentation on how to create coupon subcodes in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes). - /// Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). + /// Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). /// ## Create Coupon Subcode. /// This request allows you to create specific subcodes underneath an existing coupon code. /// *Note*: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), you must encode them for use in the URL. diff --git a/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs b/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs index f01d04bc..09b25dba 100644 --- a/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs +++ b/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs @@ -37,21 +37,16 @@ public class CustomFieldsController : BaseController internal CustomFieldsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// ## Custom Fields: Metafield Intro. - /// **Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. - /// + **Metafield is the custom field**. - /// + **Metadata is the data populating the custom field.**. - /// Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/sections/24266118312589-Custom-Fields). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab). - /// Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record. - /// ## Create Metafields. - /// Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact. - /// Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer. - /// ### Metafields "On-the-Fly". - /// It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existent name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”. - /// ### Metafield Scope Warning. - /// If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**. + /// Creates metafields on a Site for either the Subscriptions or Customers resource. . + /// Metafields and their metadata are created in the Custom Fields configuration page on your Site. Metafields can be populated with metadata when you create them or later with the [Update Metafield]($e/Custom%20Fields/updateMetafield), [Create Metadata]($e/Custom%20Fields/createMetadata), or [Update Metadata]($e/Custom%20Fields/updateMetadata) endpoints. The Create Metadata and Update Metadata endpoints allow you to add metafields and metadata values to a specific subscription or customer. + /// Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. + /// > Note: After creating a metafield, the resource type cannot be modified. + /// In the UI and product documentation, metafields and metadata are called Custom Fields. . + /// - Metafield is the custom field. + /// - Metadata is the data populating the custom field. + /// See [Custom Fields Reference](https://docs.maxio.com/hc/en-us/articles/24266140850573-Custom-Fields-Reference) and [Custom Fields Tab](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab) for information on using Custom Fields in the Advanced Billing UI. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Optional parameter: . /// Returns the List of Models.Metafield response from the API call. public List CreateMetafields( @@ -60,21 +55,16 @@ internal CustomFieldsController(GlobalConfiguration globalConfiguration) : base( => CoreHelper.RunTask(CreateMetafieldsAsync(resourceType, body)); /// - /// ## Custom Fields: Metafield Intro. - /// **Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. - /// + **Metafield is the custom field**. - /// + **Metadata is the data populating the custom field.**. - /// Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/sections/24266118312589-Custom-Fields). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab). - /// Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record. - /// ## Create Metafields. - /// Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact. - /// Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer. - /// ### Metafields "On-the-Fly". - /// It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existent name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”. - /// ### Metafield Scope Warning. - /// If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**. + /// Creates metafields on a Site for either the Subscriptions or Customers resource. . + /// Metafields and their metadata are created in the Custom Fields configuration page on your Site. Metafields can be populated with metadata when you create them or later with the [Update Metafield]($e/Custom%20Fields/updateMetafield), [Create Metadata]($e/Custom%20Fields/createMetadata), or [Update Metadata]($e/Custom%20Fields/updateMetadata) endpoints. The Create Metadata and Update Metadata endpoints allow you to add metafields and metadata values to a specific subscription or customer. + /// Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. + /// > Note: After creating a metafield, the resource type cannot be modified. + /// In the UI and product documentation, metafields and metadata are called Custom Fields. . + /// - Metafield is the custom field. + /// - Metadata is the data populating the custom field. + /// See [Custom Fields Reference](https://docs.maxio.com/hc/en-us/articles/24266140850573-Custom-Fields-Reference) and [Custom Fields Tab](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab) for information on using Custom Fields in the Advanced Billing UI. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Optional parameter: . /// cancellationToken. /// Returns the List of Models.Metafield response from the API call. @@ -95,7 +85,7 @@ internal CustomFieldsController(GlobalConfiguration globalConfiguration) : base( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This endpoint lists metafields associated with a site. The metafield description and usage is contained in the response. + /// Lists the metafields and their associated details for a Site and resource type. You can filter the request to a specific metafield. /// /// Object containing request parameters. /// Returns the Models.ListMetafieldsResponse response from the API call. @@ -104,7 +94,7 @@ public Models.ListMetafieldsResponse ListMetafields( => CoreHelper.RunTask(ListMetafieldsAsync(input)); /// - /// This endpoint lists metafields associated with a site. The metafield description and usage is contained in the response. + /// Lists the metafields and their associated details for a Site and resource type. You can filter the request to a specific metafield. /// /// Object containing request parameters. /// cancellationToken. @@ -125,9 +115,22 @@ public Models.ListMetafieldsResponse ListMetafields( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact. + /// Updates metafields on your Site for a resource type. Depending on the request structure, you can update or add metafields and metadata to the Subscriptions or Customers resource. + /// With this endpoint, you can: . + /// - Add metafields. If the metafield specified in current_name does not exist, a new metafield is added. . + /// >Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. + /// - Change the name of a metafield. . + /// >Note: To keep the metafield name the same and only update the metadata for the metafield, you must use the current metafield name in both the `current_name` and `name` parameters. + /// - Change the input type for the metafield. For example, you can change a metafield input type from text to a dropdown. If you change the input type from text to a dropdown or radio, you must update the specific subscriptions or customers where the metafield was used to reflect the updated metafield and metadata. . + /// - Add metadata values to the existing metadata for a dropdown or radio metafield. . + /// >Note: Updates to metadata overwrite. To add one or more values, you must specify all metadata values including the new value you want to add. + /// - Add new metadata to a dropdown or radio for a metafield that was created without metadata. + /// - Remove metadata for a dropdown or radio for a metafield. . + /// >Note: Updates to metadata overwrite existing values. To remove one or more values, specify all metadata values except those you want to remove. + /// - Add or update scope settings for a metafield. + /// >Note: Scope changes overwrite existing settings. You must specify the complete scope, including the changes you want to make. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Optional parameter: . /// Returns the List of Models.Metafield response from the API call. public List UpdateMetafield( @@ -136,9 +139,22 @@ public Models.ListMetafieldsResponse ListMetafields( => CoreHelper.RunTask(UpdateMetafieldAsync(resourceType, body)); /// - /// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact. + /// Updates metafields on your Site for a resource type. Depending on the request structure, you can update or add metafields and metadata to the Subscriptions or Customers resource. + /// With this endpoint, you can: . + /// - Add metafields. If the metafield specified in current_name does not exist, a new metafield is added. . + /// >Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. + /// - Change the name of a metafield. . + /// >Note: To keep the metafield name the same and only update the metadata for the metafield, you must use the current metafield name in both the `current_name` and `name` parameters. + /// - Change the input type for the metafield. For example, you can change a metafield input type from text to a dropdown. If you change the input type from text to a dropdown or radio, you must update the specific subscriptions or customers where the metafield was used to reflect the updated metafield and metadata. . + /// - Add metadata values to the existing metadata for a dropdown or radio metafield. . + /// >Note: Updates to metadata overwrite. To add one or more values, you must specify all metadata values including the new value you want to add. + /// - Add new metadata to a dropdown or radio for a metafield that was created without metadata. + /// - Remove metadata for a dropdown or radio for a metafield. . + /// >Note: Updates to metadata overwrite existing values. To remove one or more values, specify all metadata values except those you want to remove. + /// - Add or update scope settings for a metafield. + /// >Note: Scope changes overwrite existing settings. You must specify the complete scope, including the changes you want to make. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Optional parameter: . /// cancellationToken. /// Returns the List of Models.Metafield response from the API call. @@ -159,10 +175,9 @@ public Models.ListMetafieldsResponse ListMetafields( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use the following method to delete a metafield. This will remove the metafield from the Site. - /// Additionally, this will remove the metafield and associated metadata with all Subscriptions on the Site. + /// Deletes a metafield from your Site. Removes the metafield and associated metadata from all Subscriptions or Customers resources on the Site. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Optional parameter: The name of the metafield to be deleted. public void DeleteMetafield( Models.ResourceType resourceType, @@ -170,10 +185,9 @@ public void DeleteMetafield( => CoreHelper.RunVoidTask(DeleteMetafieldAsync(resourceType, name)); /// - /// Use the following method to delete a metafield. This will remove the metafield from the Site. - /// Additionally, this will remove the metafield and associated metadata with all Subscriptions on the Site. + /// Deletes a metafield from your Site. Removes the metafield and associated metadata from all Subscriptions or Customers resources on the Site. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Optional parameter: The name of the metafield to be deleted. /// cancellationToken. /// Returns the void response from the API call. @@ -193,20 +207,11 @@ public async Task DeleteMetafieldAsync( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// ## Custom Fields: Metadata Intro. - /// **Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. - /// + **Metafield is the custom field**. - /// + **Metadata is the data populating the custom field.**. - /// Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24266164865677-Custom-Fields-Overview). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab). - /// Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**. - /// ## Metadata limits. - /// Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource. - /// ## Create Metadata. - /// This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value. - /// ### Subscription or Customer Resource. - /// Please pay special attention to the resource you use when creating metadata. + /// Creates metadata and metafields for a specific subscription or customer, or updates metadata values of existing metafields for a subscription or customer. Metadata values are limited to 2 KB in size. + /// If you create metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field. You can update the input_type for the metafield with the [Update Metafield]($e/Custom%20Fields/updateMetafield) endpoint. . + /// >Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Required parameter: The Advanced Billing id of the customer or the subscription for which the metadata applies. /// Optional parameter: . /// Returns the List of Models.Metadata response from the API call. @@ -217,20 +222,11 @@ public async Task DeleteMetafieldAsync( => CoreHelper.RunTask(CreateMetadataAsync(resourceType, resourceId, body)); /// - /// ## Custom Fields: Metadata Intro. - /// **Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. - /// + **Metafield is the custom field**. - /// + **Metadata is the data populating the custom field.**. - /// Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24266164865677-Custom-Fields-Overview). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab). - /// Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**. - /// ## Metadata limits. - /// Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource. - /// ## Create Metadata. - /// This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value. - /// ### Subscription or Customer Resource. - /// Please pay special attention to the resource you use when creating metadata. + /// Creates metadata and metafields for a specific subscription or customer, or updates metadata values of existing metafields for a subscription or customer. Metadata values are limited to 2 KB in size. + /// If you create metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field. You can update the input_type for the metafield with the [Update Metafield]($e/Custom%20Fields/updateMetafield) endpoint. . + /// >Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Required parameter: The Advanced Billing id of the customer or the subscription for which the metadata applies. /// Optional parameter: . /// cancellationToken. @@ -254,9 +250,7 @@ public async Task DeleteMetafieldAsync( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This request will list all of the metadata belonging to a particular resource (ie. subscription, customer) that is specified. - /// ## Metadata Data. - /// This endpoint will also display the current stats of your metadata to use as a tool for pagination. + /// Lists metadata and metafields for a specific customer or subscription. /// /// Object containing request parameters. /// Returns the Models.PaginatedMetadata response from the API call. @@ -265,9 +259,7 @@ public Models.PaginatedMetadata ListMetadata( => CoreHelper.RunTask(ListMetadataAsync(input)); /// - /// This request will list all of the metadata belonging to a particular resource (ie. subscription, customer) that is specified. - /// ## Metadata Data. - /// This endpoint will also display the current stats of your metadata to use as a tool for pagination. + /// Lists metadata and metafields for a specific customer or subscription. /// /// Object containing request parameters. /// cancellationToken. @@ -287,9 +279,11 @@ public Models.PaginatedMetadata ListMetadata( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This method allows you to update the existing metadata associated with a subscription or customer. + /// Updates metadata and metafields on the Site and the customer or subscription specified, and updates the metadata value on a subscription or customer. + /// If you update metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field to the Site and to the subscription or customer you specify. You can update the input_type for the metafield with the Update Metafield endpoint. . + /// Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscription and another 100 for Customer. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Required parameter: The Advanced Billing id of the customer or the subscription for which the metadata applies. /// Optional parameter: . /// Returns the List of Models.Metadata response from the API call. @@ -300,9 +294,11 @@ public Models.PaginatedMetadata ListMetadata( => CoreHelper.RunTask(UpdateMetadataAsync(resourceType, resourceId, body)); /// - /// This method allows you to update the existing metadata associated with a subscription or customer. + /// Updates metadata and metafields on the Site and the customer or subscription specified, and updates the metadata value on a subscription or customer. + /// If you update metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field to the Site and to the subscription or customer you specify. You can update the input_type for the metafield with the Update Metafield endpoint. . + /// Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscription and another 100 for Customer. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Required parameter: The Advanced Billing id of the customer or the subscription for which the metadata applies. /// Optional parameter: . /// cancellationToken. @@ -326,24 +322,9 @@ public Models.PaginatedMetadata ListMetadata( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// + /// Deletes one or more metafields (and associated metadata) from the specified subscription or customer. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Required parameter: The Advanced Billing id of the customer or the subscription for which the metadata applies. /// Optional parameter: Name of field to be removed.. /// @@ -355,24 +336,9 @@ public void DeleteMetadata( => CoreHelper.RunVoidTask(DeleteMetadataAsync(resourceType, resourceId, name, names)); /// - /// + /// Deletes one or more metafields (and associated metadata) from the specified subscription or customer. /// - /// Required parameter: the resource type to which the metafields belong. + /// Required parameter: The resource type to which the metafields belong.. /// Required parameter: The Advanced Billing id of the customer or the subscription for which the metadata applies. /// Optional parameter: Name of field to be removed.. /// @@ -398,15 +364,7 @@ public async Task DeleteMetadataAsync( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// + /// Lists metadata for a specified array of subscriptions or customers. /// /// Object containing request parameters. /// Returns the Models.PaginatedMetadata response from the API call. @@ -415,15 +373,7 @@ public Models.PaginatedMetadata ListMetadataForResourceType( => CoreHelper.RunTask(ListMetadataForResourceTypeAsync(input)); /// - /// + /// Lists metadata for a specified array of subscriptions or customers. /// /// Object containing request parameters. /// cancellationToken. diff --git a/AdvancedBilling.Standard/Controllers/CustomersController.cs b/AdvancedBilling.Standard/Controllers/CustomersController.cs index 64bd725d..11da4f44 100644 --- a/AdvancedBilling.Standard/Controllers/CustomersController.cs +++ b/AdvancedBilling.Standard/Controllers/CustomersController.cs @@ -41,11 +41,11 @@ internal CustomersController(GlobalConfiguration globalConfiguration) : base(glo /// Full documentation on how to locate, create and edit Customers in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24252190590093-Customer-Details). /// ## Required Country Format. /// Advanced Billing requires that you use the ISO Standard Country codes when formatting country attribute of the customer. - /// Countries should be formatted as 2 characters. For more information, please see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes). + /// Countries should be formatted as 2 characters. For more information, see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes). /// ## Required State Format. /// Advanced Billing requires that you use the ISO Standard State codes when formatting state attribute of the customer. /// + US States (2 characters): [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US). - /// + States Outside the US (2-3 characters): To find the correct state codes outside of the US, please go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. + /// + States Outside the US (2-3 characters): To find the correct state codes outside of the US, go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. /// ## Locale. /// Advanced Billing allows you to attribute a language/region to your customer to deliver invoices in any required language. /// For more: [Customer Locale](https://maxio.zendesk.com/hc/en-us/articles/24286672013709-Customer-Locale). @@ -62,11 +62,11 @@ public Models.CustomerResponse CreateCustomer( /// Full documentation on how to locate, create and edit Customers in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24252190590093-Customer-Details). /// ## Required Country Format. /// Advanced Billing requires that you use the ISO Standard Country codes when formatting country attribute of the customer. - /// Countries should be formatted as 2 characters. For more information, please see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes). + /// Countries should be formatted as 2 characters. For more information, see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes). /// ## Required State Format. /// Advanced Billing requires that you use the ISO Standard State codes when formatting state attribute of the customer. /// + US States (2 characters): [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US). - /// + States Outside the US (2-3 characters): To find the correct state codes outside of the US, please go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. + /// + States Outside the US (2-3 characters): To find the correct state codes outside of the US, go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. /// ## Locale. /// Advanced Billing allows you to attribute a language/region to your customer to deliver invoices in any required language. /// For more: [Customer Locale](https://maxio.zendesk.com/hc/en-us/articles/24286672013709-Customer-Locale). @@ -98,7 +98,7 @@ public Models.CustomerResponse CreateCustomer( /// + Search by an organization. /// + Search by a reference value from your application. /// + Search by a first or last name. - /// To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). + /// To retrieve a single, exact match by reference, use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). /// /// Object containing request parameters. /// Returns the List of Models.CustomerResponse response from the API call. @@ -116,7 +116,7 @@ public Models.CustomerResponse CreateCustomer( /// + Search by an organization. /// + Search by a reference value from your application. /// + Search by a first or last name. - /// To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). + /// To retrieve a single, exact match by reference, use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). /// /// Object containing request parameters. /// cancellationToken. diff --git a/AdvancedBilling.Standard/Controllers/InvoicesController.cs b/AdvancedBilling.Standard/Controllers/InvoicesController.cs index 76f24dc2..8d6fb3aa 100644 --- a/AdvancedBilling.Standard/Controllers/InvoicesController.cs +++ b/AdvancedBilling.Standard/Controllers/InvoicesController.cs @@ -625,11 +625,42 @@ public Models.ConsolidatedInvoice ListConsolidatedInvoiceSegments( /// ]. /// . /// ```. + /// #### Using Coupon Subcodes. + /// You can also use coupon subcodes to apply existing coupons with specific subcodes:. + /// ```json. + /// . + /// "coupons": [. + /// {. + /// "subcode": "SUB1",. + /// "product_family_id": 1. + /// }. + /// ]. + /// . + /// ```. + /// **Important:** You cannot specify both `code` and `subcode` for the same coupon. Use either:. + /// - `code` to apply a main coupon. + /// - `subcode` to apply a specific coupon subcode. + /// The API response will include both the main coupon code and the subcode used:. + /// ```json. + /// . + /// "coupons": [. + /// {. + /// "code": "MAIN123",. + /// "subcode": "SUB1",. + /// "product_family_id": 1,. + /// "percentage": 10,. + /// "description": "Special discount". + /// }. + /// ]. + /// . + /// ```. /// ### Coupon options. /// #### Code. /// Coupon `code` will be displayed on invoice discount section. /// Coupon code can only contain uppercase letters, numbers, and allowed special characters. /// Lowercase letters will be converted to uppercase. It can be used to select an existing coupon from the catalog, or as an ad hoc coupon when passed with `percentage` or `amount`. + /// #### Subcode. + /// Coupon `subcode` allows you to apply existing coupons using their subcodes. When a subcode is used, the API response will include both the main coupon code and the specific subcode that was applied. Subcodes are case-insensitive and will be converted to uppercase automatically. /// #### Percentage. /// Coupon `percentage` can take values from 0 to 100 and up to 4 decimal places. It cannot be used with `amount`. Only for ad hoc coupons, will be ignored if `code` is used to select an existing coupon from the catalog. /// #### Amount. @@ -661,7 +692,7 @@ public Models.ConsolidatedInvoice ListConsolidatedInvoiceSegments( /// #### Net Terms. /// By default, invoices will be created with a due date matching the date of invoice creation. If a different due date is desired, the `net_terms` parameter can be sent indicating the number of days in advance the due date should be. /// #### Addresses. - /// The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. Please see below for the details on which parameters can be sent for each address object. + /// The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. See below for the details on which parameters can be sent for each address object. /// #### Memo and Payment Instructions. /// A custom memo can be sent with the `memo` parameter to override the site's default. Likewise, custom payment instructions can be sent with the `payment_instrucions` parameter. /// #### Status. @@ -746,11 +777,42 @@ public Models.InvoiceResponse CreateInvoice( /// ]. /// . /// ```. + /// #### Using Coupon Subcodes. + /// You can also use coupon subcodes to apply existing coupons with specific subcodes:. + /// ```json. + /// . + /// "coupons": [. + /// {. + /// "subcode": "SUB1",. + /// "product_family_id": 1. + /// }. + /// ]. + /// . + /// ```. + /// **Important:** You cannot specify both `code` and `subcode` for the same coupon. Use either:. + /// - `code` to apply a main coupon. + /// - `subcode` to apply a specific coupon subcode. + /// The API response will include both the main coupon code and the subcode used:. + /// ```json. + /// . + /// "coupons": [. + /// {. + /// "code": "MAIN123",. + /// "subcode": "SUB1",. + /// "product_family_id": 1,. + /// "percentage": 10,. + /// "description": "Special discount". + /// }. + /// ]. + /// . + /// ```. /// ### Coupon options. /// #### Code. /// Coupon `code` will be displayed on invoice discount section. /// Coupon code can only contain uppercase letters, numbers, and allowed special characters. /// Lowercase letters will be converted to uppercase. It can be used to select an existing coupon from the catalog, or as an ad hoc coupon when passed with `percentage` or `amount`. + /// #### Subcode. + /// Coupon `subcode` allows you to apply existing coupons using their subcodes. When a subcode is used, the API response will include both the main coupon code and the specific subcode that was applied. Subcodes are case-insensitive and will be converted to uppercase automatically. /// #### Percentage. /// Coupon `percentage` can take values from 0 to 100 and up to 4 decimal places. It cannot be used with `amount`. Only for ad hoc coupons, will be ignored if `code` is used to select an existing coupon from the catalog. /// #### Amount. @@ -782,7 +844,7 @@ public Models.InvoiceResponse CreateInvoice( /// #### Net Terms. /// By default, invoices will be created with a due date matching the date of invoice creation. If a different due date is desired, the `net_terms` parameter can be sent indicating the number of days in advance the due date should be. /// #### Addresses. - /// The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. Please see below for the details on which parameters can be sent for each address object. + /// The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. See below for the details on which parameters can be sent for each address object. /// #### Memo and Payment Instructions. /// A custom memo can be sent with the `memo` parameter to override the site's default. Likewise, custom payment instructions can be sent with the `payment_instrucions` parameter. /// #### Status. @@ -810,8 +872,8 @@ public Models.InvoiceResponse CreateInvoice( /// /// This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. - /// Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. - /// On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. + /// If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. + /// On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. /// /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number.. /// Optional parameter: . @@ -822,8 +884,8 @@ public void SendInvoice( /// /// This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. - /// Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. - /// On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. + /// If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. + /// On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. /// /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number.. /// Optional parameter: . diff --git a/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs b/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs index 6d082dfc..cb3893ec 100644 --- a/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs +++ b/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs @@ -37,179 +37,29 @@ internal PaymentProfilesController(GlobalConfiguration globalConfiguration) : ba /// /// /// /// Optional parameter: When following the IBAN or the Local Bank details examples, a customer, bank account and mandate will be created in your current vault. If the customer, bank account, and mandate already exist in your vault, follow the Import example to link the payment profile into Advanced Billing.. @@ -253,179 +105,29 @@ public Models.PaymentProfileResponse CreatePaymentProfile( /// /// /// /// Optional parameter: When following the IBAN or the Local Bank details examples, a customer, bank account and mandate will be created in your current vault. If the customer, bank account, and mandate already exist in your vault, follow the Import example to link the payment profile into Advanced Billing.. @@ -509,7 +213,7 @@ public Models.PaymentProfileResponse CreatePaymentProfile( /// /// Using the GET method you can retrieve a Payment Profile identified by its unique ID. - /// Please note that a different JSON object will be returned if the card method on file is a bank account. + /// Note that a different JSON object will be returned if the card method on file is a bank account. /// ### Response for Bank Account. /// Example response for Bank Account:. /// ```. @@ -550,7 +254,7 @@ public Models.PaymentProfileResponse ReadPaymentProfile( /// /// Using the GET method you can retrieve a Payment Profile identified by its unique ID. - /// Please note that a different JSON object will be returned if the card method on file is a bank account. + /// Note that a different JSON object will be returned if the card method on file is a bank account. /// ### Response for Bank Account. /// Example response for Bank Account:. /// ```. diff --git a/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs b/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs index 7704012c..813382f0 100644 --- a/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs +++ b/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs @@ -36,7 +36,7 @@ public class ProductFamiliesController : BaseController internal ProductFamiliesController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// This method allows to retrieve a list of Products belonging to a Product Family. + /// Retrieves a list of Products belonging to a Product Family. /// /// Object containing request parameters. /// Returns the List of Models.ProductResponse response from the API call. @@ -45,7 +45,7 @@ internal ProductFamiliesController(GlobalConfiguration globalConfiguration) : ba => CoreHelper.RunTask(ListProductsForProductFamilyAsync(input)); /// - /// This method allows to retrieve a list of Products belonging to a Product Family. + /// Retrieves a list of Products belonging to a Product Family. /// /// Object containing request parameters. /// cancellationToken. @@ -74,7 +74,7 @@ internal ProductFamiliesController(GlobalConfiguration globalConfiguration) : ba .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This method will create a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. + /// Creates a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. /// Full documentation on how Product Families operate within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product-Families). /// /// Optional parameter: . @@ -84,7 +84,7 @@ public Models.ProductFamilyResponse CreateProductFamily( => CoreHelper.RunTask(CreateProductFamilyAsync(body)); /// - /// This method will create a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. + /// Creates a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. /// Full documentation on how Product Families operate within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product-Families). /// /// Optional parameter: . @@ -105,7 +105,7 @@ public Models.ProductFamilyResponse CreateProductFamily( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This method allows to retrieve a list of Product Families for a site. + /// Retrieve a list of Product Families for a site. /// /// Object containing request parameters. /// Returns the List of Models.ProductFamilyResponse response from the API call. @@ -114,7 +114,7 @@ public Models.ProductFamilyResponse CreateProductFamily( => CoreHelper.RunTask(ListProductFamiliesAsync(input)); /// - /// This method allows to retrieve a list of Product Families for a site. + /// Retrieve a list of Product Families for a site. /// /// Object containing request parameters. /// cancellationToken. @@ -135,7 +135,7 @@ public Models.ProductFamilyResponse CreateProductFamily( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This method allows to retrieve a Product Family via the `product_family_id`. The response will contain a Product Family object. + /// Retrieves a Product Family via the `product_family_id`. The response will contain a Product Family object. /// The product family can be specified either with the id number, or with the `handle:my-family` format. /// /// Required parameter: The Advanced Billing id of the product family. @@ -145,7 +145,7 @@ public Models.ProductFamilyResponse ReadProductFamily( => CoreHelper.RunTask(ReadProductFamilyAsync(id)); /// - /// This method allows to retrieve a Product Family via the `product_family_id`. The response will contain a Product Family object. + /// Retrieves a Product Family via the `product_family_id`. The response will contain a Product Family object. /// The product family can be specified either with the id number, or with the `handle:my-family` format. /// /// Required parameter: The Advanced Billing id of the product family. diff --git a/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs b/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs index 771dd316..b1e18c6e 100644 --- a/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs +++ b/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs @@ -37,7 +37,7 @@ public class ProductPricePointsController : BaseController internal ProductPricePointsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// [Product Price Point Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points). + /// Creates a Product Price Point. See the [Product Price Point](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points) documentation for details. /// /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`. /// Optional parameter: . @@ -48,7 +48,7 @@ public Models.ProductPricePointResponse CreateProductPricePoint( => CoreHelper.RunTask(CreateProductPricePointAsync(productId, body)); /// - /// [Product Price Point Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points). + /// Creates a Product Price Point. See the [Product Price Point](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points) documentation for details. /// /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`. /// Optional parameter: . @@ -71,7 +71,7 @@ public Models.ProductPricePointResponse CreateProductPricePoint( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use this endpoint to retrieve a list of product price points. + /// Retrieves a list of product price points. /// /// Object containing request parameters. /// Returns the Models.ListProductPricePointsResponse response from the API call. @@ -80,7 +80,7 @@ public Models.ListProductPricePointsResponse ListProductPricePoints( => CoreHelper.RunTask(ListProductPricePointsAsync(input)); /// - /// Use this endpoint to retrieve a list of product price points. + /// Retrieves a list of product price points. /// /// Object containing request parameters. /// cancellationToken. @@ -102,8 +102,8 @@ public Models.ListProductPricePointsResponse ListProductPricePoints( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use this endpoint to update a product price point. - /// Note: Custom product price points are not able to be updated. + /// Updates a product price point. + /// Note: Custom product price points cannot be updated. /// /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle.. /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle.. @@ -116,8 +116,8 @@ public Models.ProductPricePointResponse UpdateProductPricePoint( => CoreHelper.RunTask(UpdateProductPricePointAsync(productId, pricePointId, body)); /// - /// Use this endpoint to update a product price point. - /// Note: Custom product price points are not able to be updated. + /// Updates a product price point. + /// Note: Custom product price points cannot be updated. /// /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle.. /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle.. @@ -177,7 +177,7 @@ public Models.ProductPricePointResponse ReadProductPricePoint( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use this endpoint to archive a product price point. + /// Archives a product price point. /// /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle.. /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle.. @@ -188,7 +188,7 @@ public Models.ProductPricePointResponse ArchiveProductPricePoint( => CoreHelper.RunTask(ArchiveProductPricePointAsync(productId, pricePointId)); /// - /// Use this endpoint to archive a product price point. + /// Archives a product price point. /// /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle.. /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle.. @@ -241,8 +241,8 @@ public Models.ProductPricePointResponse UnarchiveProductPricePoint( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use this endpoint to make a product price point the default for the product. - /// Note: Custom product price points are not able to be set as the default for a product. + /// Sets a product price point as the default for the product. + /// Note: Custom product price points cannot be set as the default for a product. /// /// Required parameter: The Advanced Billing id of the product to which the price point belongs. /// Required parameter: The Advanced Billing id of the product price point. @@ -253,8 +253,8 @@ public Models.ProductResponse PromoteProductPricePointToDefault( => CoreHelper.RunTask(PromoteProductPricePointToDefaultAsync(productId, pricePointId)); /// - /// Use this endpoint to make a product price point the default for the product. - /// Note: Custom product price points are not able to be set as the default for a product. + /// Sets a product price point as the default for the product. + /// Note: Custom product price points cannot be set as the default for a product. /// /// Required parameter: The Advanced Billing id of the product to which the price point belongs. /// Required parameter: The Advanced Billing id of the product price point. @@ -274,7 +274,7 @@ public Models.ProductResponse PromoteProductPricePointToDefault( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use this endpoint to create multiple product price points in one request. + /// Creates multiple product price points in one request. /// /// Required parameter: The Advanced Billing id of the product to which the price points belong. /// Optional parameter: . @@ -285,7 +285,7 @@ public Models.BulkCreateProductPricePointsResponse BulkCreateProductPricePoints( => CoreHelper.RunTask(BulkCreateProductPricePointsAsync(productId, body)); /// - /// Use this endpoint to create multiple product price points in one request. + /// Creates multiple product price points in one request. /// /// Required parameter: The Advanced Billing id of the product to which the price points belong. /// Optional parameter: . @@ -308,7 +308,7 @@ public Models.BulkCreateProductPricePointsResponse BulkCreateProductPricePoints( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings. + /// Creates currency prices for a given currency that has been defined on the site level in your settings. /// When creating currency prices, they need to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. /// Note: Currency Prices are not able to be created for custom product price points. /// @@ -321,7 +321,7 @@ public Models.CurrencyPricesResponse CreateProductCurrencyPrices( => CoreHelper.RunTask(CreateProductCurrencyPricesAsync(productPricePointId, body)); /// - /// This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings. + /// Creates currency prices for a given currency that has been defined on the site level in your settings. /// When creating currency prices, they need to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. /// Note: Currency Prices are not able to be created for custom product price points. /// @@ -346,9 +346,9 @@ public Models.CurrencyPricesResponse CreateProductCurrencyPrices( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point. + /// Updates the `price`s of currency prices for a given currency that exists on the product price point. /// When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. - /// Note: Currency Prices are not able to be updated for custom product price points. + /// Note: Currency Prices cannot be updated for custom product price points. /// /// Required parameter: The Advanced Billing id of the product price point. /// Optional parameter: . @@ -359,9 +359,9 @@ public Models.CurrencyPricesResponse UpdateProductCurrencyPrices( => CoreHelper.RunTask(UpdateProductCurrencyPricesAsync(productPricePointId, body)); /// - /// This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point. + /// Updates the `price`s of currency prices for a given currency that exists on the product price point. /// When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. - /// Note: Currency Prices are not able to be updated for custom product price points. + /// Note: Currency Prices cannot be updated for custom product price points. /// /// Required parameter: The Advanced Billing id of the product price point. /// Optional parameter: . diff --git a/AdvancedBilling.Standard/Controllers/ProductsController.cs b/AdvancedBilling.Standard/Controllers/ProductsController.cs index db50f474..a8f9c6e2 100644 --- a/AdvancedBilling.Standard/Controllers/ProductsController.cs +++ b/AdvancedBilling.Standard/Controllers/ProductsController.cs @@ -36,7 +36,8 @@ public class ProductsController : BaseController internal ProductsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// Use this method to create a product within your Advanced Billing site. + /// Creates a product in your Advanced Billing site. + /// See the following product docuemation for more information:. /// + [Products Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview). /// + [Changing a Subscription's Product](https://maxio.zendesk.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations). /// @@ -49,7 +50,8 @@ public Models.ProductResponse CreateProduct( => CoreHelper.RunTask(CreateProductAsync(productFamilyId, body)); /// - /// Use this method to create a product within your Advanced Billing site. + /// Creates a product in your Advanced Billing site. + /// See the following product docuemation for more information:. /// + [Products Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview). /// + [Changing a Subscription's Product](https://maxio.zendesk.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations). /// @@ -74,7 +76,7 @@ public Models.ProductResponse CreateProduct( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This endpoint allows you to read the current details of a product that you've created in Advanced Billing. + /// Reads the current details of a product. /// /// Required parameter: The Advanced Billing id of the product. /// Returns the Models.ProductResponse response from the API call. @@ -83,7 +85,7 @@ public Models.ProductResponse ReadProduct( => CoreHelper.RunTask(ReadProductAsync(productId)); /// - /// This endpoint allows you to read the current details of a product that you've created in Advanced Billing. + /// Reads the current details of a product. /// /// Required parameter: The Advanced Billing id of the product. /// cancellationToken. @@ -100,7 +102,7 @@ public Models.ProductResponse ReadProduct( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Use this method to change aspects of an existing product. + /// Updates aspects of an existing product. /// ### Input Attributes Update Notes. /// + `update_return_params` The parameters we will append to your `update_return_url`. See Return URLs and Parameters. /// ### Product Price Point. @@ -115,7 +117,7 @@ public Models.ProductResponse UpdateProduct( => CoreHelper.RunTask(UpdateProductAsync(productId, body)); /// - /// Use this method to change aspects of an existing product. + /// Updates aspects of an existing product. /// ### Input Attributes Update Notes. /// + `update_return_params` The parameters we will append to your `update_return_url`. See Return URLs and Parameters. /// ### Product Price Point. @@ -142,7 +144,7 @@ public Models.ProductResponse UpdateProduct( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. + /// Archives the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. /// This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product. /// /// Required parameter: The Advanced Billing id of the product. @@ -152,7 +154,7 @@ public Models.ProductResponse ArchiveProduct( => CoreHelper.RunTask(ArchiveProductAsync(productId)); /// - /// Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. + /// Archives the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. /// This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product. /// /// Required parameter: The Advanced Billing id of the product. @@ -172,7 +174,7 @@ public Models.ProductResponse ArchiveProduct( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This method allows to retrieve a Product object by its `api_handle`. + /// Retrieves a Product object by its `api_handle`. /// /// Required parameter: The handle of the product. /// Returns the Models.ProductResponse response from the API call. @@ -181,7 +183,7 @@ public Models.ProductResponse ReadProductByHandle( => CoreHelper.RunTask(ReadProductByHandleAsync(apiHandle)); /// - /// This method allows to retrieve a Product object by its `api_handle`. + /// Retrieves a Product object by its `api_handle`. /// /// Required parameter: The handle of the product. /// cancellationToken. diff --git a/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs b/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs index 5c22a567..54bc2248 100644 --- a/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs +++ b/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs @@ -138,7 +138,7 @@ public Models.ProformaInvoice ReadProformaInvoice( /// /// This endpoint will create a proforma invoice and return it as a response. If the information becomes outdated, simply void the old proforma invoice and generate a new one. - /// If you would like to preview the next billing amounts without generating a full proforma invoice, please use the renewal preview endpoint. + /// If you would like to preview the next billing amounts without generating a full proforma invoice, use the renewal preview endpoint. /// ## Restrictions. /// Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, the subscription must not be in a group, must not be prepaid, and must be in a live state. /// @@ -150,7 +150,7 @@ public Models.ProformaInvoice CreateProformaInvoice( /// /// This endpoint will create a proforma invoice and return it as a response. If the information becomes outdated, simply void the old proforma invoice and generate a new one. - /// If you would like to preview the next billing amounts without generating a full proforma invoice, please use the renewal preview endpoint. + /// If you would like to preview the next billing amounts without generating a full proforma invoice, use the renewal preview endpoint. /// ## Restrictions. /// Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, the subscription must not be in a group, must not be prepaid, and must be in a live state. /// diff --git a/AdvancedBilling.Standard/Controllers/SalesCommissionsController.cs b/AdvancedBilling.Standard/Controllers/SalesCommissionsController.cs index 7d8ba291..947ac1de 100644 --- a/AdvancedBilling.Standard/Controllers/SalesCommissionsController.cs +++ b/AdvancedBilling.Standard/Controllers/SalesCommissionsController.cs @@ -39,7 +39,7 @@ internal SalesCommissionsController(GlobalConfiguration globalConfiguration) : b /// Endpoint returns subscriptions with associated sales reps. /// ## Modified Authentication Process. /// The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). - /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. + /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. /// > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. /// ]]> /// @@ -54,7 +54,7 @@ internal SalesCommissionsController(GlobalConfiguration globalConfiguration) : b /// Endpoint returns subscriptions with associated sales reps. /// ## Modified Authentication Process. /// The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). - /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. + /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. /// > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. /// ]]> /// @@ -81,7 +81,7 @@ internal SalesCommissionsController(GlobalConfiguration globalConfiguration) : b /// Endpoint returns sales rep list with details. /// ## Modified Authentication Process. /// The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). - /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. + /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. /// > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. /// ]]> /// @@ -96,7 +96,7 @@ internal SalesCommissionsController(GlobalConfiguration globalConfiguration) : b /// Endpoint returns sales rep list with details. /// ## Modified Authentication Process. /// The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). - /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. + /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. /// > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. /// ]]> /// @@ -123,7 +123,7 @@ internal SalesCommissionsController(GlobalConfiguration globalConfiguration) : b /// Endpoint returns sales rep and attached subscriptions details. /// ## Modified Authentication Process. /// The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). - /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. + /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. /// > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. /// ]]> /// @@ -148,7 +148,7 @@ public Models.SaleRep ReadSalesRep( /// Endpoint returns sales rep and attached subscriptions details. /// ## Modified Authentication Process. /// The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). - /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. + /// Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. /// > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. /// ]]> /// diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionComponentsController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionComponentsController.cs index 8bf19579..f35f38ac 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionComponentsController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionComponentsController.cs @@ -539,21 +539,22 @@ public async Task DeletePrepaidUsageAllocationAsync( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// ## Documentation. - /// Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, please see the following resources:. - /// + [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage). - /// + [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status). - /// You may choose to report metered or prepaid usage to Advanced Billing as often as you wish. You may report usage as it happens. You may also report usage periodically, such as each night or once per billing period. If usage events occur in your system very frequently (on the order of thousands of times an hour), it is best to accumulate usage into batches on your side, and then report those batches less frequently, such as daily. This will ensure you remain below any API throttling limits. If your use case requires higher rates of usage reporting, we recommend utilizing Events Based Components. - /// ## Create Usage for Subscription. - /// This endpoint allows you to record an instance of metered or prepaid usage for a subscription. The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](./b3A6MTQxMDgzNzQ-read-subscription-component) for the subscription. + /// Records an instance of metered or prepaid usage for a subscription. + /// You can report metered or prepaid usage to Advanced Billing as often as you wish. You can report usage as it happens or periodically, such as each night or once per billing period. . + /// Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, see the following resources:. + /// It is not possible to record metered usage for more than one component at a time Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. . + /// See the following product documention articles for more information:. + /// - [Create and Manage Components](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). A. + /// - [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage). + /// - [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status). + /// The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item]($e/Subscription%20Components/readSubscriptionComponent) for the subscription. /// ## Price Point ID usage. - /// If you are using price points, for metered and prepaid usage components, Advanced Billing gives you the option to specify a price point in your request. + /// If you are using price points, for metered and prepaid usage components Advanced Billing gives you the option to specify a price point in your request. /// You do not need to specify a price point ID. If a price point is not included, the default price point for the component will be used when the usage is recorded. - /// If an invalid `price_point_id` is submitted, the endpoint will return an error. /// ## Deducting Usage. - /// In the event that you need to reverse a previous usage report or otherwise deduct from the current usage balance, you may provide a negative quantity. + /// If you need to reverse a previous usage report or otherwise deduct from the current usage balance, you can provide a negative quantity. /// Example:. - /// Previously recorded:. + /// Previously recorded quantity was 5000:. /// ```json. /// {. /// "usage": {. @@ -562,7 +563,7 @@ public async Task DeletePrepaidUsageAllocationAsync( /// }. /// }. /// ```. - /// At this point, `unit_balance` would be `5000`. To reduce the balance to `0`, POST the following payload:. + /// To reduce the quantity to `0`, POST the following payload:. /// ```json. /// {. /// "usage": {. @@ -572,9 +573,6 @@ public async Task DeletePrepaidUsageAllocationAsync( /// }. /// ```. /// The `unit_balance` has a floor of `0`; negative unit balances are never allowed. For example, if the usage balance is 100 and you deduct 200 units, the unit balance would then be `0`, not `-100`. - /// ## FAQ. - /// Q. Is it possible to record metered usage for more than one component at a time?. - /// A. No. Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. /// /// Required parameter: Either the Advanced Billing subscription ID (integer) or the subscription reference (string). Important: In cases where a numeric string value matches both an existing subscription ID and an existing subscription reference, the system will prioritize the subscription ID lookup. For example, if both subscription ID 123 and subscription reference "123" exist, passing "123" will return the subscription with ID 123.. /// Required parameter: Either the Advanced Billing id for the component or the component's handle prefixed by `handle:`. @@ -587,21 +585,22 @@ public Models.UsageResponse CreateUsage( => CoreHelper.RunTask(CreateUsageAsync(subscriptionIdOrReference, componentId, body)); /// - /// ## Documentation. - /// Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, please see the following resources:. - /// + [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage). - /// + [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status). - /// You may choose to report metered or prepaid usage to Advanced Billing as often as you wish. You may report usage as it happens. You may also report usage periodically, such as each night or once per billing period. If usage events occur in your system very frequently (on the order of thousands of times an hour), it is best to accumulate usage into batches on your side, and then report those batches less frequently, such as daily. This will ensure you remain below any API throttling limits. If your use case requires higher rates of usage reporting, we recommend utilizing Events Based Components. - /// ## Create Usage for Subscription. - /// This endpoint allows you to record an instance of metered or prepaid usage for a subscription. The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](./b3A6MTQxMDgzNzQ-read-subscription-component) for the subscription. + /// Records an instance of metered or prepaid usage for a subscription. + /// You can report metered or prepaid usage to Advanced Billing as often as you wish. You can report usage as it happens or periodically, such as each night or once per billing period. . + /// Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, see the following resources:. + /// It is not possible to record metered usage for more than one component at a time Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. . + /// See the following product documention articles for more information:. + /// - [Create and Manage Components](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). A. + /// - [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage). + /// - [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status). + /// The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item]($e/Subscription%20Components/readSubscriptionComponent) for the subscription. /// ## Price Point ID usage. - /// If you are using price points, for metered and prepaid usage components, Advanced Billing gives you the option to specify a price point in your request. + /// If you are using price points, for metered and prepaid usage components Advanced Billing gives you the option to specify a price point in your request. /// You do not need to specify a price point ID. If a price point is not included, the default price point for the component will be used when the usage is recorded. - /// If an invalid `price_point_id` is submitted, the endpoint will return an error. /// ## Deducting Usage. - /// In the event that you need to reverse a previous usage report or otherwise deduct from the current usage balance, you may provide a negative quantity. + /// If you need to reverse a previous usage report or otherwise deduct from the current usage balance, you can provide a negative quantity. /// Example:. - /// Previously recorded:. + /// Previously recorded quantity was 5000:. /// ```json. /// {. /// "usage": {. @@ -610,7 +609,7 @@ public Models.UsageResponse CreateUsage( /// }. /// }. /// ```. - /// At this point, `unit_balance` would be `5000`. To reduce the balance to `0`, POST the following payload:. + /// To reduce the quantity to `0`, POST the following payload:. /// ```json. /// {. /// "usage": {. @@ -620,9 +619,6 @@ public Models.UsageResponse CreateUsage( /// }. /// ```. /// The `unit_balance` has a floor of `0`; negative unit balances are never allowed. For example, if the usage balance is 100 and you deduct 200 units, the unit balance would then be `0`, not `-100`. - /// ## FAQ. - /// Q. Is it possible to record metered usage for more than one component at a time?. - /// A. No. Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. /// /// Required parameter: Either the Advanced Billing subscription ID (integer) or the subscription reference (string). Important: In cases where a numeric string value matches both an existing subscription ID and an existing subscription reference, the system will prioritize the subscription ID lookup. For example, if both subscription ID 123 and subscription reference "123" exist, passing "123" will return the subscription with ID 123.. /// Required parameter: Either the Advanced Billing id for the component or the component's handle prefixed by `handle:`. diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionGroupStatusController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionGroupStatusController.cs index f80ae0cf..fdab6f55 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionGroupStatusController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionGroupStatusController.cs @@ -36,8 +36,8 @@ public class SubscriptionGroupStatusController : BaseController internal SubscriptionGroupStatusController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// This endpoint will immediately cancel all subscriptions within the specified group. The group is identified by it's `uid` passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members as well must be on automatic billing or they must be prepaid. - /// In order to cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. + /// Cancels all subscriptions within the specified group immediately. The group is identified by the `uid` that is passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members must be on automatic billing or prepaid. + /// To cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. /// /// Required parameter: The uid of the subscription group. /// Optional parameter: . @@ -47,8 +47,8 @@ public void CancelSubscriptionsInGroup( => CoreHelper.RunVoidTask(CancelSubscriptionsInGroupAsync(uid, body)); /// - /// This endpoint will immediately cancel all subscriptions within the specified group. The group is identified by it's `uid` passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members as well must be on automatic billing or they must be prepaid. - /// In order to cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. + /// Cancels all subscriptions within the specified group immediately. The group is identified by the `uid` that is passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members must be on automatic billing or prepaid. + /// To cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. /// /// Required parameter: The uid of the subscription group. /// Optional parameter: . @@ -71,7 +71,7 @@ public async Task CancelSubscriptionsInGroupAsync( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by it's uid passed in the URL. + /// This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by its uid passed in the URL. /// All subscriptions in the group must be on automatic billing in order to successfully cancel them, and the group must not be in a "past_due" state. /// /// Required parameter: The uid of the subscription group. @@ -80,7 +80,7 @@ public void InitiateDelayedCancellationForGroup( => CoreHelper.RunVoidTask(InitiateDelayedCancellationForGroupAsync(uid)); /// - /// This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by it's uid passed in the URL. + /// This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by its uid passed in the URL. /// All subscriptions in the group must be on automatic billing in order to successfully cancel them, and the group must not be in a "past_due" state. /// /// Required parameter: The uid of the subscription group. diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionGroupsController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionGroupsController.cs index f8626081..ed666cce 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionGroupsController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionGroupsController.cs @@ -42,6 +42,8 @@ internal SubscriptionGroupsController(GlobalConfiguration globalConfiguration) : /// You must provide one and only one of the `payment_profile_id`/`credit_card_attributes`/`bank_account_attributes` for the payment profile attached to the group. /// Only one of the `subscriptions` can have `"primary": true` attribute set. /// When passing product to a subscription you can use either `product_id` or `product_handle` or `offer_id`. You can also use `custom_price` instead. + /// The subscription request examples below will be split into two sections. + /// The first section, "Subscription Customization", will focus on passing different information with a subscription, such as components, calendar billing, and custom fields. These examples will presume you are using a secure chargify_token generated by Chargify.js. /// /// Optional parameter: . /// Returns the Models.SubscriptionGroupSignupResponse response from the API call. @@ -55,6 +57,8 @@ public Models.SubscriptionGroupSignupResponse SignupWithSubscriptionGroup( /// You must provide one and only one of the `payment_profile_id`/`credit_card_attributes`/`bank_account_attributes` for the payment profile attached to the group. /// Only one of the `subscriptions` can have `"primary": true` attribute set. /// When passing product to a subscription you can use either `product_id` or `product_handle` or `offer_id`. You can also use `custom_price` instead. + /// The subscription request examples below will be split into two sections. + /// The first section, "Subscription Customization", will focus on passing different information with a subscription, such as components, calendar billing, and custom fields. These examples will presume you are using a secure chargify_token generated by Chargify.js. /// /// Optional parameter: . /// cancellationToken. @@ -268,12 +272,12 @@ public Models.FullSubscriptionGroupResponse FindSubscriptionGroup( /// /// For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to add existing subscriptions to subscription groups. /// Passing `group` parameters with a `target` containing a `type` and optional `id` is all that's needed. When the `target` parameter specifies a `"customer"` or `"subscription"` that is already part of a hierarchy, the subscription will become a member of the customer's subscription group. If the target customer or subscription is not part of a subscription group, a new group will be created and the subscription will become part of the group with the specified target customer set as the responsible payer for the group's subscriptions. - /// **Please Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. + /// **Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. /// Rather than specifying a customer, the `target` parameter could instead simply have a value of. /// * `"self"` which indicates the subscription will be paid for not by some other customer, but by the subscribing customer,. /// * `"parent"` which indicates the subscription will be paid for by the subscribing customer's parent within a customer hierarchy, or. /// * `"eldest"` which indicates the subscription will be paid for by the root-level customer in the subscribing customer's hierarchy. - /// To create a new subscription into a subscription group, please reference the following:. + /// To create a new subscription into a subscription group, reference the following:. /// [Create Subscription in a Subscription Group](https://developers.chargify.com/docs/api-docs/d571659cf0f24-create-subscription#subscription-in-a-subscription-group). /// /// Required parameter: The Chargify id of the subscription. @@ -287,12 +291,12 @@ public Models.SubscriptionGroupResponse AddSubscriptionToGroup( /// /// For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to add existing subscriptions to subscription groups. /// Passing `group` parameters with a `target` containing a `type` and optional `id` is all that's needed. When the `target` parameter specifies a `"customer"` or `"subscription"` that is already part of a hierarchy, the subscription will become a member of the customer's subscription group. If the target customer or subscription is not part of a subscription group, a new group will be created and the subscription will become part of the group with the specified target customer set as the responsible payer for the group's subscriptions. - /// **Please Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. + /// **Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. /// Rather than specifying a customer, the `target` parameter could instead simply have a value of. /// * `"self"` which indicates the subscription will be paid for not by some other customer, but by the subscribing customer,. /// * `"parent"` which indicates the subscription will be paid for by the subscribing customer's parent within a customer hierarchy, or. /// * `"eldest"` which indicates the subscription will be paid for by the root-level customer in the subscribing customer's hierarchy. - /// To create a new subscription into a subscription group, please reference the following:. + /// To create a new subscription into a subscription group, reference the following:. /// [Create Subscription in a Subscription Group](https://developers.chargify.com/docs/api-docs/d571659cf0f24-create-subscription#subscription-in-a-subscription-group). /// /// Required parameter: The Chargify id of the subscription. diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionInvoiceAccountController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionInvoiceAccountController.cs index 129a105a..be1edf50 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionInvoiceAccountController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionInvoiceAccountController.cs @@ -65,7 +65,7 @@ public Models.AccountBalances ReadAccountBalances( /// ## Create Prepayment. /// In order to specify a prepayment made against a subscription, specify the `amount, memo, details, method`. /// When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. - /// Please note that you **can't** pass `amount_in_cents`. + /// Note that passing `amount_in_cents` is now allowed. /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . @@ -79,7 +79,7 @@ public Models.CreatePrepaymentResponse CreatePrepayment( /// ## Create Prepayment. /// In order to specify a prepayment made against a subscription, specify the `amount, memo, details, method`. /// When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. - /// Please note that you **can't** pass `amount_in_cents`. + /// Note that passing `amount_in_cents` is now allowed. /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionProductsController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionProductsController.cs index 5c1eb548..cd26b4d8 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionProductsController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionProductsController.cs @@ -44,9 +44,9 @@ internal SubscriptionProductsController(GlobalConfiguration globalConfiguration) /// ## Migrations Documentation. /// Full documentation on how to record Migrations in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24181589372429-Data-Migration-to-Advanced-Billing). /// ## Failed Migrations. - /// One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to it's current product. Please be aware of this issue!. + /// Importaint note: One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to its current product. /// ## Migration 3D Secure - Stripe. - /// It may happen that a payment needs 3D Secure Authentication when the subscription is migrated to a new product; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. + /// When a payment requires 3D Secure Authentication to adhear to Strong Customer Authentication (SCA) when the subscription is migrated to a new product, the request enters a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. /// ```json. /// {. /// "errors": [. @@ -66,7 +66,7 @@ internal SubscriptionProductsController(GlobalConfiguration globalConfiguration) /// It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. /// The final URL that you send a customer to to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com`. /// ### Example Redirect Flow. - /// You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference:. + /// You may wish to redirect customers to different pages depending on whether SCA was performed successfully. Here's an example flow to use as a reference:. /// 1. Create a migration via API; it requires 3DS. /// 2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. /// 3. Use this `gateway_payment_id` to, for example, connect with your internal resources or generate a session_id. @@ -94,9 +94,9 @@ public Models.SubscriptionResponse MigrateSubscriptionProduct( /// ## Migrations Documentation. /// Full documentation on how to record Migrations in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24181589372429-Data-Migration-to-Advanced-Billing). /// ## Failed Migrations. - /// One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to it's current product. Please be aware of this issue!. + /// Importaint note: One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to its current product. /// ## Migration 3D Secure - Stripe. - /// It may happen that a payment needs 3D Secure Authentication when the subscription is migrated to a new product; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. + /// When a payment requires 3D Secure Authentication to adhear to Strong Customer Authentication (SCA) when the subscription is migrated to a new product, the request enters a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. /// ```json. /// {. /// "errors": [. @@ -116,7 +116,7 @@ public Models.SubscriptionResponse MigrateSubscriptionProduct( /// It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. /// The final URL that you send a customer to to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com`. /// ### Example Redirect Flow. - /// You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference:. + /// You may wish to redirect customers to different pages depending on whether SCA was performed successfully. Here's an example flow to use as a reference:. /// 1. Create a migration via API; it requires 3DS. /// 2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. /// 3. Use this `gateway_payment_id` to, for example, connect with your internal resources or generate a session_id. diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionStatusController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionStatusController.cs index bd959ceb..bd6afda8 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionStatusController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionStatusController.cs @@ -142,7 +142,7 @@ public Models.SubscriptionResponse ResumeSubscription( /// /// This will place the subscription in the on_hold state and it will not renew. /// ## Limitations. - /// You may not place a subscription on hold if the `next_billing` date is within 24 hours. + /// You may not place a subscription on hold if the `next_billing_at` date is within 24 hours. /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . @@ -155,7 +155,7 @@ public Models.SubscriptionResponse PauseSubscription( /// /// This will place the subscription in the on_hold state and it will not renew. /// ## Limitations. - /// You may not place a subscription on hold if the `next_billing` date is within 24 hours. + /// You may not place a subscription on hold if the `next_billing_at` date is within 24 hours. /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . @@ -219,8 +219,7 @@ public Models.SubscriptionResponse UpdateAutomaticSubscriptionResumption( /// /// Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). - /// **Please note: The term. - /// "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.**. + /// **Note: The term "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.**. /// + The response returns the subscription object in the `active` or `trialing` state. /// + The `canceled_at` and `cancellation_message` fields do not have values. /// + The method works for "Canceled" or "Trial Ended" subscriptions. @@ -327,8 +326,7 @@ public Models.SubscriptionResponse ReactivateSubscription( /// /// Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). - /// **Please note: The term. - /// "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.**. + /// **Note: The term "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.**. /// + The response returns the subscription object in the `active` or `trialing` state. /// + The `canceled_at` and `cancellation_message` fields do not have values. /// + The method works for "Canceled" or "Trial Ended" subscriptions. @@ -544,7 +542,7 @@ public Models.SubscriptionResponse CancelDunning( /// /// The Chargify API allows you to preview a renewal by posting to the renewals endpoint. Renewal Preview is an object representing a subscription’s next assessment. You can retrieve it to see a snapshot of how much your customer will be charged on their next renewal. - /// The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). + /// The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). /// ## Optional Component Fields. /// This endpoint is particularly useful due to the fact that it will return the computed billing amount for the base product and the components which are in use by a subscriber. /// By default, the preview will include billing details for all components _at their **current** quantities_. This means:. @@ -567,7 +565,7 @@ public Models.RenewalPreviewResponse PreviewRenewal( /// /// The Chargify API allows you to preview a renewal by posting to the renewals endpoint. Renewal Preview is an object representing a subscription’s next assessment. You can retrieve it to see a snapshot of how much your customer will be charged on their next renewal. - /// The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). + /// The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). /// ## Optional Component Fields. /// This endpoint is particularly useful due to the fact that it will return the computed billing amount for the base product and the components which are in use by a subscriber. /// By default, the preview will include billing details for all components _at their **current** quantities_. This means:. diff --git a/AdvancedBilling.Standard/Controllers/SubscriptionsController.cs b/AdvancedBilling.Standard/Controllers/SubscriptionsController.cs index b41fbb3a..59a65212 100644 --- a/AdvancedBilling.Standard/Controllers/SubscriptionsController.cs +++ b/AdvancedBilling.Standard/Controllers/SubscriptionsController.cs @@ -37,466 +37,14 @@ public class SubscriptionsController : BaseController internal SubscriptionsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { } /// - /// collecting and sending Advanced Billing raw card details requires PCI compliance on your end; these examples are provided as guidance. If your business is not PCI compliant, we recommend using Chargify.js to collect credit cards or bank accounts. - /// # Subscription Customization. - /// ## With Components. - /// Different components require slightly different data. For example, quantity-based and on/off components accept `allocated_quantity`, while metered components accept `unit_balance`. - /// When creating a subscription with a component, a `price_point_id` can be passed in along with the `component_id` to specify which price point to use. If not passed in, the default price point will be used. - /// Note: if an invalid `price_point_id` is used, the subscription will still proceed but will use the component's default price point. - /// Components and their price points may be added by ID or by handle. See the example request body labeled "Components By Handle (Quantity-Based)"; the format will be the same for other component types. - /// ## With Coupon(s). - /// Pass an array of `coupon_codes`. See the example request body "With Coupon". - /// ## With Manual Invoice Collection. - /// The `invoice` collection method works only on legacy Statement Architecture. - /// On Relationship Invoicing Architecture use the `remittance` collection method. - /// ## Prepaid Subscription. - /// A prepaid subscription can be created with the usual subscription creation parameters, specifying `prepaid` as the `payment_collection_method` and including a nested `prepaid_configuration`. - /// After a prepaid subscription has been created, additional funds can be manually added to the prepayment account through the [Create Prepayment Endpoint](https://developers.chargify.com/docs/api-docs/7ec482de77ba7-create-prepayment). - /// Prepaid subscriptions do not work on legacy Statement Architecture. - /// ## With Metafields. - /// Metafields can either attach to subscriptions or customers. Metafields are popuplated with the supplied metadata to the resource specified. - /// If the metafield doesn't exist yet, it will be created on-the-fly. - /// ## With Custom Pricing. - /// Custom pricing is pricing specific to the subscription in question. - /// Create a subscription with custom pricing by passing pricing information instead of a price point. - /// For a custom priced product, pass the custom_price object in place of `product_price_point_id`. For a custom priced component, pass the `custom_price` object within the component object. - /// Custom prices and price points can exist in harmony on a subscription. - /// # Passing Payment Information. - /// ## Subscription with Chargify.js token. - /// The `chargify_token` can be obtained using [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0). The token represents payment profile attributes that were provided by the customer in their browser and stored at the payment gateway. - /// The `payment_type` attribute may either be `credit_card` or `bank_account`, depending on the type of payment method being added. If a bank account is being passed, the payment attributes should be changed to `bank_account_attributes`. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "pro-plan",. - /// "customer_attributes": {. - /// "first_name": "Joe",. - /// "last_name": "Smith",. - /// "email": "j.smith@example.com". - /// },. - /// "credit_card_attributes": {. - /// "chargify_token": "tok_cwhvpfcnbtgkd8nfkzf9dnjn",. - /// "payment_type": "credit_card". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription with vault token. - /// If you already have a customer and card stored in your payment gateway, you may create a subscription with a `vault_token`. Providing the last_four, card type and expiration date will allow the card to be displayed properly in the Advanced Billing UI. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "pro-plan",. - /// "customer_attributes": {. - /// "first_name": "Joe",. - /// "last_name": "Smith",. - /// "email": "j.smith@example.com". - /// },. - /// "credit_card_attributes": {. - /// first_name: "Joe,. - /// last_name: "Smith",. - /// card_type: "visa",. - /// expiration_month: "05",. - /// expiration_year: "2025",. - /// last_four: "1234",. - /// vault_token: "12345abc",. - /// current_vault: "braintree_blue". - /// }. - /// }. - /// ```. - /// ## Subscription with ACH as Payment Profile. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Joe",. - /// "last_name": "Blow",. - /// "email": "joe@example.com",. - /// "zip": "02120",. - /// "state": "MA",. - /// "reference": "XYZ",. - /// "phone": "(617) 111 - 0000",. - /// "organization": "Acme",. - /// "country": "US",. - /// "city": "Boston",. - /// "address_2": null,. - /// "address": "123 Mass Ave.". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Best Bank",. - /// "bank_routing_number": "021000089",. - /// "bank_account_number": "111111111111",. - /// "bank_account_type": "checking",. - /// "bank_account_holder_type": "business",. - /// "payment_type": "bank_account". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription with PayPal payment profile. - /// ### With the nonce from Braintree JS. - /// ```json. - /// { "subscription": {. - /// "product_handle":"test-product-b",. - /// "customer_attributes": {. - /// "first_name":"Amelia",. - /// "last_name":"Johnson",. - /// "email":"amelia@example.com",. - /// "organization":"My Awesome Company". - /// },. - /// "payment_profile_attributes":{. - /// "paypal_email": "amelia@example.com",. - /// "current_vault": "braintree_blue",. - /// "payment_method_nonce":"abc123",. - /// "payment_type":"paypal_account". - /// }. - /// }. - /// ```. - /// ### With the Braintree Customer ID as the vault token:. - /// ```json. - /// { "subscription": {. - /// "product_handle":"test-product-b",. - /// "customer_attributes": {. - /// "first_name":"Amelia",. - /// "last_name":"Johnson",. - /// "email":"amelia@example.com",. - /// "organization":"My Awesome Company". - /// },. - /// "payment_profile_attributes":{. - /// "paypal_email": "amelia@example.com",. - /// "current_vault": "braintree_blue",. - /// "vault_token":"58271347",. - /// "payment_type":"paypal_account". - /// }. - /// }. - /// ```. - /// ## Subscription using GoCardless Bank Number. - /// These examples creates a customer, bank account and mandate in GoCardless. - /// For more information on GoCardless, please view the following two resources:. - /// + [Payment Profiles via API for GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#gocardless). - /// + [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless). - /// + [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ). - /// + [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Royal Bank of France",. - /// "bank_account_number": "0000000",. - /// "bank_routing_number": "0003",. - /// "bank_branch_code": "00006",. - /// "payment_type": "bank_account",. - /// "billing_address": "20 Place de la Gare",. - /// "billing_city": "Colombes",. - /// "billing_state": "Île-de-France",. - /// "billing_zip": "92700",. - /// "billing_country": "FR". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using GoCardless IBAN Number. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "French Bank",. - /// "bank_iban": "FR1420041010050500013M02606",. - /// "payment_type": "bank_account",. - /// "billing_address": "20 Place de la Gare",. - /// "billing_city": "Colombes",. - /// "billing_state": "Île-de-France",. - /// "billing_zip": "92700",. - /// "billing_country": "FR". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using Stripe SEPA Direct Debit. - /// For more information on Stripe Direct Debit, please view the following two resources:. - /// + [Payment Profiles via API for Stripe SEPA Direct Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#sepa-direct-debit). - /// + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit). - /// + [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5). - /// + [Using Chargify.js with Stripe SEPA Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_iban": "DE89370400440532013000",. - /// "payment_type": "bank_account". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using Stripe BECS Direct Debit. - /// For more information on Stripe Direct Debit, please view the following two resources:. - /// + [Payment Profiles via API for Stripe BECS Direct Debit]($e/Payment%20Profiles/createPaymentProfile). - /// + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit). - /// + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5). - /// + [Using Chargify.js with Stripe BECS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRX4B1TYZKZD8ZND6D). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_branch_code": "000000",. - /// "bank_account_number": "000123456",. - /// "payment_type": "bank_account". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using Stripe BACS Direct Debit. - /// For more information on Stripe Direct Debit, please view the following two resources:. - /// + [Payment Profiles via API for Stripe BACS Direct Debit]($e/Payment%20Profiles/createPaymentProfile). - /// + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit). - /// + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5). - /// + [Using Chargify.js with Stripe BACS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR7PA1DJ3XE9MD05FM). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_branch_code": "108800",. - /// "bank_account_number": "00012345",. - /// "payment_type": "bank_account",. - /// "billing_address": "123 Main St.",. - /// "billing_city": "London",. - /// "billing_state": "LND",. - /// "billing_zip": "W1A 1AA",. - /// "billing_country": "GB". - /// }. - /// }. - /// }. - /// ```. - /// ## 3D Secure - Stripe. - /// It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. - /// ```json. - /// {. - /// "errors": [. - /// "Your card was declined. This transaction requires 3D secure authentication.". - /// ],. - /// "gateway_payment_id": "pi_1F0aGoJ2UDb3Q4av7zU3sHPh",. - /// "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.",. - /// "action_link": "http://acme.chargify.com/3d-secure/pi_1F0aGoJ2UDb3Q4av7zU3sHPh?one_time_token_id=242". - /// }. - /// ```. - /// To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. - /// Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information:. - /// - whether the authentication was successful (`success`). - /// - the gateway ID for the payment (`gateway_payment_id`). - /// - the subscription ID (`subscription_id`). - /// Lastly, you can also specify a `redirect_url` within the `action_link` URL if you’d like to redirect a customer back to your site. - /// It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - /// The final URL that you send a customer to to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com`. - /// ## 3D Secure - Checkout. - /// It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. - /// ```json. - /// {. - /// "errors": [. - /// "Your card was declined. This transaction requires 3D secure authentication.". - /// ],. - /// "gateway_payment_id": "pay_6gjofv7dlyrkpizlolsuspvtiu",. - /// "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.",. - /// "action_link": "http://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123". - /// }. - /// ```. - /// To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. - /// Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information:. - /// - whether the authentication was successful (`success`). - /// - the gateway ID for the payment (`gateway_payment_id`). - /// - the subscription ID (`subscription_id`). - /// Lastly, you can also specify a `redirect_url` parameter within the `action_link` URL if you’d like to redirect a customer back to your site. - /// It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - /// The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com`. - /// ### Example Redirect Flow. - /// You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference:. - /// 1. Create a subscription via API; it requires 3DS. - /// 2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. - /// 3. Use this `gateway_payment_id` to, for example, connect with your internal resources or generate a session_id. - /// 4. Include 1 of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to. - /// 5. Redirect the customer to the `action_link` with `callback_url` and `redirect_url` applied. - /// 6. After the customer finishes 3DS authentication, we let you know the result by making a request to applied `callback_url`. - /// 7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known. - /// 8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not. - /// ## Subscriptions Import. - /// Subscriptions can be “imported” via the API to handle the following scenarios:. - /// + You already have existing subscriptions with specific start and renewal dates that you would like to import to Advanced Billing. - /// + You already have credit cards stored in your provider’s vault and you would like to create subscriptions using those tokens. - /// Before importing, you should have already set up your products to match your offerings. Then, you can create Subscriptions via the API just like you normally would, but using a few special attributes. - /// Full documentation on how import Subscriptions using the **import tool** in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports). - /// ### Important Notices and Disclaimers regarding Imports. - /// Before performing a bulk import of subscriptions via the API, we suggest reading the [Subscriptions Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) instructions to understand the repurcussions of a large import. - /// ### Subscription Input Attributes. - /// The following _additional_ attributes to the subscription input attributes make imports possible: `next_billing_at`, `previous_billing_at`, and `import_mrr`. - /// ### Current Vault. - /// If you are using a Legacy gateway such as "eWAY Rapid (Legacy)" or "Stripe (Legacy)" then please contact Support for further instructions on subscription imports. - /// ### Braintree Blue (Braintree v2) Imports. - /// Braintree Blue is Braintree’s newer (version 2) API. For this gateway, please provide the `vault_token` parameter with the value from Braintree’s “Customer ID” rather than the “Payment Profile Token”. At this time we do not use `current_vault_token` with the Braintree Blue gateway, and we only support a single payment profile per Braintree Customer. - /// When importing PayPal type payment profiles, please set `payment_type` to `paypal_account`. - /// ### Stripe ACH Imports. - /// If the bank account has already been verified, currently you will need to create the customer, create the payment profile in Advanced Billing - setting verified=true, then create a subscription using the customer_id and payment_profile_id. - /// ### Webhooks During Import. - /// If no `next_billing_at` is provided, webhooks will be fired as normal. If you do set a future `next_billing_at`, only a subset of the webhooks are fired when the subscription is created. Keep reading for more information as to what webhooks will be fired under which scenarios. - /// #### Successful creation with Billing Date. - /// Scenario: If `next_billing_at` provided. - /// + `signup_success`. - /// + `billing_date_change`. - /// #### Successful creation without Billing Date. - /// Scenario: If no `next_billing_at` provided. - /// + `signup_success`. - /// + `payment_success`. - /// #### Unsuccessful creation. - /// Scenario: If card can’t be charged, and no `next_billing_at` provided. - /// + signup_failure. - /// #### Webhooks fired when next_billing_at is reached:. - /// + `renewal_success or renewal_failure`. - /// + `payment_success or payment_failure`. - /// ### Date and Time Formats. - /// We will attempt to parse any string you send as the value of next_billing_at in to a date or time. For best results, use a known format like described in “Date and Time Specification” of RFC 2822 or ISO 8601 . - /// The following are all equivalent and will work as input to `next_billing_at`:. - /// ```. - /// Aug 06 2030 11:34:00 -0400. - /// Aug 06 2030 11:34 -0400. - /// 2030-08-06T11:34:00-04:00. - /// 8/6/2030 11:34:00 EDT. - /// 8/6/2030 8:34:00 PDT. - /// 2030-08-06T15:34:00Z. - /// ```. - /// You may also pass just a date, in which case we will assume the time to be noon. - /// ```. - /// 2010-08-06. - /// ```. - /// ## Subscription Hierarchies & WhoPays. - /// When subscription groups were first added to our Relationship Invoicing architecture, to group together invoices for related subscriptions and allow for complex customer hierarchies and WhoPays scenarios, they were designed to consist of a primary and a collection of group members. The primary would control many aspects of the group, such as when the consolidated invoice is generated. As of today, groups still function this way. - /// In the future, the concept of a "primary" will be removed in order to offer more flexibility into group management and reduce confusion concerning what actions must be done on a primary level, rather than a member level. - /// We have introduced a two scheme system as a bridge between these two group organizations. Scheme 1, which is relevant to all subscription groups today, marks the group as being "ruled" by a primary. - /// When reading a subscription via API, they will return a top-level attribute called `group`, which will denote which scheme is being used. At this time, the `scheme` attribute will always be 1. - /// ### Subscription in a Customer Hierarchy. - /// For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays) features, it is possible to create subscriptions within a customer hierarchy. This can be achieved through the API by passing group parameters in the **Create Subscription** request. - /// + The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - /// When the `target` parameter specifies a customer that is already part of a hierarchy, the new subscription will become a member of the customer hierarchy as well. If the target customer is not part of a hierarchy, a new customer hierarchy will be created and both the target customer and the new subscription will become part of the hierarchy with the specified target customer set as the responsible payer for the hierarchy's subscriptions. - /// Rather than specifying a customer, the `target` parameter could instead simply have a value of `self` which indicates the subscription will be paid for not by some other customer, but by the subscribing customer. This will be true whether the customer is being created new, is already part of a hierarchy, or already exists outside a hierarchy. A valid payment method must also be specified in the subscription parameters. - /// Note that when creating subscriptions in a customer hierarchy, if the customer hierarchy does not already have a payment method, passing valid credit card attributes in the subscription parameters will also result in the payment method being established as the default payment method for the customer hierarchy irrespective of the responsible payer. - /// The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the default subscription group in the customer hierarchy. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the default subscription group in the customer hierarchy also. - /// ### Subscription in a Subscription Group. - /// For sites making use of [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) it may be desireable to create a subscription as part of a [subscription group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscription-Groups-Overview) in order to rely on [invoice consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). This can be achieved through the API by passing group parameters in the Create Subscription request. The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - /// The `target` parameters specify an existing subscription with which the newly created subscription should be grouped. If the target subscription is already part of a group, the new subscription will become a member of the group as well. If the target subscription is not part of a group, a new group will be created and both the target and the new subscription will become part of the group with the target as the group's primary subscription. - /// The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the target subscription. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the target subscription also. - /// ## Providing Agreement Acceptance Params. - /// It is possible to provide a proof of customer's acceptance of terms and policies. - /// We will be storing this proof in case it might be required (i.e. chargeback). - /// Currently, we already keep it for subscriptions created via Public Signup Pages. - /// In order to create a subscription with the proof of agreement acceptance, you must provide additional parameters `agreement acceptance` with `ip_address` and at least one url to the policy that was accepted: `terms_url` or `privacy_policy_url`. Additional urls that can be provided: `return_refund_policy_url`, `delivery_policy_url` and. - /// `secure_checkout_policy_url`. - /// ```json. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "agreement_acceptance": {. - /// "ip_address": "1.2.3.4",. - /// "terms_url": "https://terms.url",. - /// "privacy_policy_url": "https://privacy_policy.url",. - /// "return_refund_policy_url": "https://return_refund_policy.url",. - /// "delivery_policy_url": "https://delivery_policy.url",. - /// "secure_checkout_policy_url": "https://secure_checkout_policy.url". - /// }. - /// }. - /// }. - /// ```. - /// **For Maxio Payments subscriptions, the agreement acceptance params are required, with at least terms_url provided.**. - /// ## Providing ACH Agreement params. - /// It is also possible to provide a proof that a customer authorized ACH agreement terms. - /// The proof will be stored and the email will be sent to the customer with a copy of the terms (if enabled). - /// In order to create a subscription with the proof of authorized ACH agreement terms, you must provide the additional parameter `ach_agreement` with the following nested parameters: `agreement_terms`, `authorizer_first_name`, `authorizer_last_name` and `ip_address`. - /// Each of them is required. - /// ```json. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_routing_number": "021000089",. - /// "bank_account_number": "111111111111",. - /// "bank_account_type": "checking",. - /// "bank_account_holder_type": "business",. - /// "payment_type": "bank_account". - /// },. - /// "ach_agreement": {. - /// "agreement_terms": "ACH agreement terms",. - /// "authorizer_first_name": "Jane",. - /// "authorizer_last_name": "Doe",. - /// "ip_address": "1.2.3.4". - /// }. - /// }. - /// ```. - /// ]]> + /// Creates a Subscription for a customer and product. + /// Specify the product with `product_id` or `product_handle`. To set a specific product pricepPoint, use `product_price_point_handle` or `product_price_point_id`. + /// Identify an existing customer with `customer_id` or `customer_reference`. Optionally, include an existing payment profile using `payment_profile_id`. To create a new customer, pass customer_attributes. . + /// Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating subscriptions. . + /// Payment information may be required to create a subscription, depending on the options for the Product being subscribed. See [product options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Products) for more information. See the [Payments Profile]($e/Payment%20Profiles/createPaymentProfile) endpoint for details on payment parameters. + /// Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. + /// Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. + /// See the [Subscription Signups](page:introduction/basic-concepts/subscription-signup) article for more information on working with subscriptions in Advanced Billing. /// /// Optional parameter: . /// Returns the Models.SubscriptionResponse response from the API call. @@ -505,466 +53,14 @@ public Models.SubscriptionResponse CreateSubscription( => CoreHelper.RunTask(CreateSubscriptionAsync(body)); /// - /// collecting and sending Advanced Billing raw card details requires PCI compliance on your end; these examples are provided as guidance. If your business is not PCI compliant, we recommend using Chargify.js to collect credit cards or bank accounts. - /// # Subscription Customization. - /// ## With Components. - /// Different components require slightly different data. For example, quantity-based and on/off components accept `allocated_quantity`, while metered components accept `unit_balance`. - /// When creating a subscription with a component, a `price_point_id` can be passed in along with the `component_id` to specify which price point to use. If not passed in, the default price point will be used. - /// Note: if an invalid `price_point_id` is used, the subscription will still proceed but will use the component's default price point. - /// Components and their price points may be added by ID or by handle. See the example request body labeled "Components By Handle (Quantity-Based)"; the format will be the same for other component types. - /// ## With Coupon(s). - /// Pass an array of `coupon_codes`. See the example request body "With Coupon". - /// ## With Manual Invoice Collection. - /// The `invoice` collection method works only on legacy Statement Architecture. - /// On Relationship Invoicing Architecture use the `remittance` collection method. - /// ## Prepaid Subscription. - /// A prepaid subscription can be created with the usual subscription creation parameters, specifying `prepaid` as the `payment_collection_method` and including a nested `prepaid_configuration`. - /// After a prepaid subscription has been created, additional funds can be manually added to the prepayment account through the [Create Prepayment Endpoint](https://developers.chargify.com/docs/api-docs/7ec482de77ba7-create-prepayment). - /// Prepaid subscriptions do not work on legacy Statement Architecture. - /// ## With Metafields. - /// Metafields can either attach to subscriptions or customers. Metafields are popuplated with the supplied metadata to the resource specified. - /// If the metafield doesn't exist yet, it will be created on-the-fly. - /// ## With Custom Pricing. - /// Custom pricing is pricing specific to the subscription in question. - /// Create a subscription with custom pricing by passing pricing information instead of a price point. - /// For a custom priced product, pass the custom_price object in place of `product_price_point_id`. For a custom priced component, pass the `custom_price` object within the component object. - /// Custom prices and price points can exist in harmony on a subscription. - /// # Passing Payment Information. - /// ## Subscription with Chargify.js token. - /// The `chargify_token` can be obtained using [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0). The token represents payment profile attributes that were provided by the customer in their browser and stored at the payment gateway. - /// The `payment_type` attribute may either be `credit_card` or `bank_account`, depending on the type of payment method being added. If a bank account is being passed, the payment attributes should be changed to `bank_account_attributes`. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "pro-plan",. - /// "customer_attributes": {. - /// "first_name": "Joe",. - /// "last_name": "Smith",. - /// "email": "j.smith@example.com". - /// },. - /// "credit_card_attributes": {. - /// "chargify_token": "tok_cwhvpfcnbtgkd8nfkzf9dnjn",. - /// "payment_type": "credit_card". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription with vault token. - /// If you already have a customer and card stored in your payment gateway, you may create a subscription with a `vault_token`. Providing the last_four, card type and expiration date will allow the card to be displayed properly in the Advanced Billing UI. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "pro-plan",. - /// "customer_attributes": {. - /// "first_name": "Joe",. - /// "last_name": "Smith",. - /// "email": "j.smith@example.com". - /// },. - /// "credit_card_attributes": {. - /// first_name: "Joe,. - /// last_name: "Smith",. - /// card_type: "visa",. - /// expiration_month: "05",. - /// expiration_year: "2025",. - /// last_four: "1234",. - /// vault_token: "12345abc",. - /// current_vault: "braintree_blue". - /// }. - /// }. - /// ```. - /// ## Subscription with ACH as Payment Profile. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Joe",. - /// "last_name": "Blow",. - /// "email": "joe@example.com",. - /// "zip": "02120",. - /// "state": "MA",. - /// "reference": "XYZ",. - /// "phone": "(617) 111 - 0000",. - /// "organization": "Acme",. - /// "country": "US",. - /// "city": "Boston",. - /// "address_2": null,. - /// "address": "123 Mass Ave.". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Best Bank",. - /// "bank_routing_number": "021000089",. - /// "bank_account_number": "111111111111",. - /// "bank_account_type": "checking",. - /// "bank_account_holder_type": "business",. - /// "payment_type": "bank_account". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription with PayPal payment profile. - /// ### With the nonce from Braintree JS. - /// ```json. - /// { "subscription": {. - /// "product_handle":"test-product-b",. - /// "customer_attributes": {. - /// "first_name":"Amelia",. - /// "last_name":"Johnson",. - /// "email":"amelia@example.com",. - /// "organization":"My Awesome Company". - /// },. - /// "payment_profile_attributes":{. - /// "paypal_email": "amelia@example.com",. - /// "current_vault": "braintree_blue",. - /// "payment_method_nonce":"abc123",. - /// "payment_type":"paypal_account". - /// }. - /// }. - /// ```. - /// ### With the Braintree Customer ID as the vault token:. - /// ```json. - /// { "subscription": {. - /// "product_handle":"test-product-b",. - /// "customer_attributes": {. - /// "first_name":"Amelia",. - /// "last_name":"Johnson",. - /// "email":"amelia@example.com",. - /// "organization":"My Awesome Company". - /// },. - /// "payment_profile_attributes":{. - /// "paypal_email": "amelia@example.com",. - /// "current_vault": "braintree_blue",. - /// "vault_token":"58271347",. - /// "payment_type":"paypal_account". - /// }. - /// }. - /// ```. - /// ## Subscription using GoCardless Bank Number. - /// These examples creates a customer, bank account and mandate in GoCardless. - /// For more information on GoCardless, please view the following two resources:. - /// + [Payment Profiles via API for GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#gocardless). - /// + [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless). - /// + [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ). - /// + [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Royal Bank of France",. - /// "bank_account_number": "0000000",. - /// "bank_routing_number": "0003",. - /// "bank_branch_code": "00006",. - /// "payment_type": "bank_account",. - /// "billing_address": "20 Place de la Gare",. - /// "billing_city": "Colombes",. - /// "billing_state": "Île-de-France",. - /// "billing_zip": "92700",. - /// "billing_country": "FR". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using GoCardless IBAN Number. - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "French Bank",. - /// "bank_iban": "FR1420041010050500013M02606",. - /// "payment_type": "bank_account",. - /// "billing_address": "20 Place de la Gare",. - /// "billing_city": "Colombes",. - /// "billing_state": "Île-de-France",. - /// "billing_zip": "92700",. - /// "billing_country": "FR". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using Stripe SEPA Direct Debit. - /// For more information on Stripe Direct Debit, please view the following two resources:. - /// + [Payment Profiles via API for Stripe SEPA Direct Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#sepa-direct-debit). - /// + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit). - /// + [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5). - /// + [Using Chargify.js with Stripe SEPA Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_iban": "DE89370400440532013000",. - /// "payment_type": "bank_account". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using Stripe BECS Direct Debit. - /// For more information on Stripe Direct Debit, please view the following two resources:. - /// + [Payment Profiles via API for Stripe BECS Direct Debit]($e/Payment%20Profiles/createPaymentProfile). - /// + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit). - /// + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5). - /// + [Using Chargify.js with Stripe BECS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRX4B1TYZKZD8ZND6D). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_branch_code": "000000",. - /// "bank_account_number": "000123456",. - /// "payment_type": "bank_account". - /// }. - /// }. - /// }. - /// ```. - /// ## Subscription using Stripe BACS Direct Debit. - /// For more information on Stripe Direct Debit, please view the following two resources:. - /// + [Payment Profiles via API for Stripe BACS Direct Debit]($e/Payment%20Profiles/createPaymentProfile). - /// + [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit). - /// + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5). - /// + [Using Chargify.js with Stripe BACS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR7PA1DJ3XE9MD05FM). - /// ```json. - /// {. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_branch_code": "108800",. - /// "bank_account_number": "00012345",. - /// "payment_type": "bank_account",. - /// "billing_address": "123 Main St.",. - /// "billing_city": "London",. - /// "billing_state": "LND",. - /// "billing_zip": "W1A 1AA",. - /// "billing_country": "GB". - /// }. - /// }. - /// }. - /// ```. - /// ## 3D Secure - Stripe. - /// It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. - /// ```json. - /// {. - /// "errors": [. - /// "Your card was declined. This transaction requires 3D secure authentication.". - /// ],. - /// "gateway_payment_id": "pi_1F0aGoJ2UDb3Q4av7zU3sHPh",. - /// "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.",. - /// "action_link": "http://acme.chargify.com/3d-secure/pi_1F0aGoJ2UDb3Q4av7zU3sHPh?one_time_token_id=242". - /// }. - /// ```. - /// To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. - /// Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information:. - /// - whether the authentication was successful (`success`). - /// - the gateway ID for the payment (`gateway_payment_id`). - /// - the subscription ID (`subscription_id`). - /// Lastly, you can also specify a `redirect_url` within the `action_link` URL if you’d like to redirect a customer back to your site. - /// It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - /// The final URL that you send a customer to to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com`. - /// ## 3D Secure - Checkout. - /// It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:. - /// ```json. - /// {. - /// "errors": [. - /// "Your card was declined. This transaction requires 3D secure authentication.". - /// ],. - /// "gateway_payment_id": "pay_6gjofv7dlyrkpizlolsuspvtiu",. - /// "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.",. - /// "action_link": "http://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123". - /// }. - /// ```. - /// To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. - /// Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information:. - /// - whether the authentication was successful (`success`). - /// - the gateway ID for the payment (`gateway_payment_id`). - /// - the subscription ID (`subscription_id`). - /// Lastly, you can also specify a `redirect_url` parameter within the `action_link` URL if you’d like to redirect a customer back to your site. - /// It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - /// The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com`. - /// ### Example Redirect Flow. - /// You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference:. - /// 1. Create a subscription via API; it requires 3DS. - /// 2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. - /// 3. Use this `gateway_payment_id` to, for example, connect with your internal resources or generate a session_id. - /// 4. Include 1 of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to. - /// 5. Redirect the customer to the `action_link` with `callback_url` and `redirect_url` applied. - /// 6. After the customer finishes 3DS authentication, we let you know the result by making a request to applied `callback_url`. - /// 7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known. - /// 8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not. - /// ## Subscriptions Import. - /// Subscriptions can be “imported” via the API to handle the following scenarios:. - /// + You already have existing subscriptions with specific start and renewal dates that you would like to import to Advanced Billing. - /// + You already have credit cards stored in your provider’s vault and you would like to create subscriptions using those tokens. - /// Before importing, you should have already set up your products to match your offerings. Then, you can create Subscriptions via the API just like you normally would, but using a few special attributes. - /// Full documentation on how import Subscriptions using the **import tool** in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports). - /// ### Important Notices and Disclaimers regarding Imports. - /// Before performing a bulk import of subscriptions via the API, we suggest reading the [Subscriptions Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) instructions to understand the repurcussions of a large import. - /// ### Subscription Input Attributes. - /// The following _additional_ attributes to the subscription input attributes make imports possible: `next_billing_at`, `previous_billing_at`, and `import_mrr`. - /// ### Current Vault. - /// If you are using a Legacy gateway such as "eWAY Rapid (Legacy)" or "Stripe (Legacy)" then please contact Support for further instructions on subscription imports. - /// ### Braintree Blue (Braintree v2) Imports. - /// Braintree Blue is Braintree’s newer (version 2) API. For this gateway, please provide the `vault_token` parameter with the value from Braintree’s “Customer ID” rather than the “Payment Profile Token”. At this time we do not use `current_vault_token` with the Braintree Blue gateway, and we only support a single payment profile per Braintree Customer. - /// When importing PayPal type payment profiles, please set `payment_type` to `paypal_account`. - /// ### Stripe ACH Imports. - /// If the bank account has already been verified, currently you will need to create the customer, create the payment profile in Advanced Billing - setting verified=true, then create a subscription using the customer_id and payment_profile_id. - /// ### Webhooks During Import. - /// If no `next_billing_at` is provided, webhooks will be fired as normal. If you do set a future `next_billing_at`, only a subset of the webhooks are fired when the subscription is created. Keep reading for more information as to what webhooks will be fired under which scenarios. - /// #### Successful creation with Billing Date. - /// Scenario: If `next_billing_at` provided. - /// + `signup_success`. - /// + `billing_date_change`. - /// #### Successful creation without Billing Date. - /// Scenario: If no `next_billing_at` provided. - /// + `signup_success`. - /// + `payment_success`. - /// #### Unsuccessful creation. - /// Scenario: If card can’t be charged, and no `next_billing_at` provided. - /// + signup_failure. - /// #### Webhooks fired when next_billing_at is reached:. - /// + `renewal_success or renewal_failure`. - /// + `payment_success or payment_failure`. - /// ### Date and Time Formats. - /// We will attempt to parse any string you send as the value of next_billing_at in to a date or time. For best results, use a known format like described in “Date and Time Specification” of RFC 2822 or ISO 8601 . - /// The following are all equivalent and will work as input to `next_billing_at`:. - /// ```. - /// Aug 06 2030 11:34:00 -0400. - /// Aug 06 2030 11:34 -0400. - /// 2030-08-06T11:34:00-04:00. - /// 8/6/2030 11:34:00 EDT. - /// 8/6/2030 8:34:00 PDT. - /// 2030-08-06T15:34:00Z. - /// ```. - /// You may also pass just a date, in which case we will assume the time to be noon. - /// ```. - /// 2010-08-06. - /// ```. - /// ## Subscription Hierarchies & WhoPays. - /// When subscription groups were first added to our Relationship Invoicing architecture, to group together invoices for related subscriptions and allow for complex customer hierarchies and WhoPays scenarios, they were designed to consist of a primary and a collection of group members. The primary would control many aspects of the group, such as when the consolidated invoice is generated. As of today, groups still function this way. - /// In the future, the concept of a "primary" will be removed in order to offer more flexibility into group management and reduce confusion concerning what actions must be done on a primary level, rather than a member level. - /// We have introduced a two scheme system as a bridge between these two group organizations. Scheme 1, which is relevant to all subscription groups today, marks the group as being "ruled" by a primary. - /// When reading a subscription via API, they will return a top-level attribute called `group`, which will denote which scheme is being used. At this time, the `scheme` attribute will always be 1. - /// ### Subscription in a Customer Hierarchy. - /// For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays) features, it is possible to create subscriptions within a customer hierarchy. This can be achieved through the API by passing group parameters in the **Create Subscription** request. - /// + The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - /// When the `target` parameter specifies a customer that is already part of a hierarchy, the new subscription will become a member of the customer hierarchy as well. If the target customer is not part of a hierarchy, a new customer hierarchy will be created and both the target customer and the new subscription will become part of the hierarchy with the specified target customer set as the responsible payer for the hierarchy's subscriptions. - /// Rather than specifying a customer, the `target` parameter could instead simply have a value of `self` which indicates the subscription will be paid for not by some other customer, but by the subscribing customer. This will be true whether the customer is being created new, is already part of a hierarchy, or already exists outside a hierarchy. A valid payment method must also be specified in the subscription parameters. - /// Note that when creating subscriptions in a customer hierarchy, if the customer hierarchy does not already have a payment method, passing valid credit card attributes in the subscription parameters will also result in the payment method being established as the default payment method for the customer hierarchy irrespective of the responsible payer. - /// The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the default subscription group in the customer hierarchy. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the default subscription group in the customer hierarchy also. - /// ### Subscription in a Subscription Group. - /// For sites making use of [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) it may be desireable to create a subscription as part of a [subscription group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscription-Groups-Overview) in order to rely on [invoice consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). This can be achieved through the API by passing group parameters in the Create Subscription request. The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - /// The `target` parameters specify an existing subscription with which the newly created subscription should be grouped. If the target subscription is already part of a group, the new subscription will become a member of the group as well. If the target subscription is not part of a group, a new group will be created and both the target and the new subscription will become part of the group with the target as the group's primary subscription. - /// The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the target subscription. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the target subscription also. - /// ## Providing Agreement Acceptance Params. - /// It is possible to provide a proof of customer's acceptance of terms and policies. - /// We will be storing this proof in case it might be required (i.e. chargeback). - /// Currently, we already keep it for subscriptions created via Public Signup Pages. - /// In order to create a subscription with the proof of agreement acceptance, you must provide additional parameters `agreement acceptance` with `ip_address` and at least one url to the policy that was accepted: `terms_url` or `privacy_policy_url`. Additional urls that can be provided: `return_refund_policy_url`, `delivery_policy_url` and. - /// `secure_checkout_policy_url`. - /// ```json. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "agreement_acceptance": {. - /// "ip_address": "1.2.3.4",. - /// "terms_url": "https://terms.url",. - /// "privacy_policy_url": "https://privacy_policy.url",. - /// "return_refund_policy_url": "https://return_refund_policy.url",. - /// "delivery_policy_url": "https://delivery_policy.url",. - /// "secure_checkout_policy_url": "https://secure_checkout_policy.url". - /// }. - /// }. - /// }. - /// ```. - /// **For Maxio Payments subscriptions, the agreement acceptance params are required, with at least terms_url provided.**. - /// ## Providing ACH Agreement params. - /// It is also possible to provide a proof that a customer authorized ACH agreement terms. - /// The proof will be stored and the email will be sent to the customer with a copy of the terms (if enabled). - /// In order to create a subscription with the proof of authorized ACH agreement terms, you must provide the additional parameter `ach_agreement` with the following nested parameters: `agreement_terms`, `authorizer_first_name`, `authorizer_last_name` and `ip_address`. - /// Each of them is required. - /// ```json. - /// "subscription": {. - /// "product_handle": "gold-product",. - /// "customer_attributes": {. - /// "first_name": "Jane",. - /// "last_name": "Doe",. - /// "email": "jd@chargify.test". - /// },. - /// "bank_account_attributes": {. - /// "bank_name": "Test Bank",. - /// "bank_routing_number": "021000089",. - /// "bank_account_number": "111111111111",. - /// "bank_account_type": "checking",. - /// "bank_account_holder_type": "business",. - /// "payment_type": "bank_account". - /// },. - /// "ach_agreement": {. - /// "agreement_terms": "ACH agreement terms",. - /// "authorizer_first_name": "Jane",. - /// "authorizer_last_name": "Doe",. - /// "ip_address": "1.2.3.4". - /// }. - /// }. - /// ```. - /// ]]> + /// Creates a Subscription for a customer and product. + /// Specify the product with `product_id` or `product_handle`. To set a specific product pricepPoint, use `product_price_point_handle` or `product_price_point_id`. + /// Identify an existing customer with `customer_id` or `customer_reference`. Optionally, include an existing payment profile using `payment_profile_id`. To create a new customer, pass customer_attributes. . + /// Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating subscriptions. . + /// Payment information may be required to create a subscription, depending on the options for the Product being subscribed. See [product options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Products) for more information. See the [Payments Profile]($e/Payment%20Profiles/createPaymentProfile) endpoint for details on payment parameters. + /// Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. + /// Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. + /// See the [Subscription Signups](page:introduction/basic-concepts/subscription-signup) article for more information on working with subscriptions in Advanced Billing. /// /// Optional parameter: . /// cancellationToken. @@ -1033,27 +129,31 @@ public Models.SubscriptionResponse CreateSubscription( .ExecuteAsync(cancellationToken).ConfigureAwait(false); /// - /// The subscription endpoint allows you to instantly update one or many attributes about a subscription in a single call. + /// Updates one or more attributes of a subscription. /// ## Update Subscription Payment Method. - /// Change the card that your Subscriber uses for their subscription. You can also use this method to simply change the expiration date of the card **if your gateway allows**. - /// Note that partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. + /// Change the card that your subscriber uses for their subscription. You can also use this method to change the expiration date of the card **if your gateway allows**. + /// Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. + /// Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. + /// > Note: Partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. + /// ## Update Product. /// You also use this method to change the subscription to a different product by setting a new value for product_handle. A product change can be done in two different ways, **product change** or **delayed product change**. - /// ## Product Change. - /// This endpoint may be used to change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you desire complex product changes or prorated upgrades and downgrades instead, please see the documentation on Migrating Subscription Products. - /// To perform a product change, simply set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point will be used. + /// ### Product Change. + /// You can change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you require complex product changes or prorated upgrades and downgrades instead, please see the documentation on [Migrating Subscription Products](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations#product-changes-and-migrations-0-0). + /// To perform a product change, set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point is used. /// ### Delayed Product Change. /// This method also changes the product and/or price point, and the new payment amount is calculated and charged at the normal start of the next period. - /// This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a Delayed Product Change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. + /// This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a delayed product change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. /// You can also perform a delayed change to the price point by passing in either `product_price_point_id` or `product_price_point_handle`. - /// **Note: To cancel a delayed product change, set `next_product_id` to an empty string.**. + /// > **Note:** To cancel a delayed product change, set `next_product_id` to an empty string. /// ## Billing Date Changes. + /// You can update dates for a subscrption. . /// ### Regular Billing Date Changes. /// Send the `next_billing_at` to set the next billing date for the subscription. After that date passes and the subscription is processed, the following billing date will be set according to the subscription's product period. - /// Note that if you pass an invalid date, we will automatically interpret and set the correct date. For example, when February 30 is entered, the next billing will be set to March 2nd in a non-leap year. - /// The server response will not return data under the key/value pair of `next_billing`. Please view the key/value pair of `current_period_ends_at` to verify that the `next_billing` date has been changed successfully. - /// ### Snap Day Changes. + /// > Note: If you pass an invalid date, the correct date is automatically set to he correct date. For example, if February 30 is passed, the next billing would be set to March 2nd in a non-leap year. + /// The server response will not return data under the key/value pair of `next_billing_at`. View the key/value pair of `current_period_ends_at` to verify that the `next_billing_at` date has been changed successfully. + /// ### Calendar Billing and Snap Day Changes. /// For a subscription using Calendar Billing, setting the next billing date is a bit different. Send the `snap_day` attribute to change the calendar billing date for **a subscription using a product eligible for calendar billing**. - /// Note: If you change the product associated with a subscription that contains a `snap_date` and immediately `READ/GET` the subscription data, it will still contain evidence of the existing `snap_date`. This is due to the fact that a product change is instantanous and only affects the product associated with a subscription. After the `next_billing` date arrives, the `snap_day` associated with the subscription will return to `null.` Another way of looking at this is that you willl have to wait for the next billing cycle to arrive before the `snap_date` will reset to `null`. + /// > Note: If you change the product associated with a subscription that contains a `snap_day` and immediately `READ/GET` the subscription data, it will still contain original `snap_day`. The `snap_day`will will reset to 'null on the next billing cycle. This is because a product change is instantanous and only affects the product associated with a subscription. /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . @@ -1064,27 +164,31 @@ public Models.SubscriptionResponse UpdateSubscription( => CoreHelper.RunTask(UpdateSubscriptionAsync(subscriptionId, body)); /// - /// The subscription endpoint allows you to instantly update one or many attributes about a subscription in a single call. + /// Updates one or more attributes of a subscription. /// ## Update Subscription Payment Method. - /// Change the card that your Subscriber uses for their subscription. You can also use this method to simply change the expiration date of the card **if your gateway allows**. - /// Note that partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. + /// Change the card that your subscriber uses for their subscription. You can also use this method to change the expiration date of the card **if your gateway allows**. + /// Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. + /// Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. + /// > Note: Partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. + /// ## Update Product. /// You also use this method to change the subscription to a different product by setting a new value for product_handle. A product change can be done in two different ways, **product change** or **delayed product change**. - /// ## Product Change. - /// This endpoint may be used to change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you desire complex product changes or prorated upgrades and downgrades instead, please see the documentation on Migrating Subscription Products. - /// To perform a product change, simply set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point will be used. + /// ### Product Change. + /// You can change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you require complex product changes or prorated upgrades and downgrades instead, please see the documentation on [Migrating Subscription Products](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations#product-changes-and-migrations-0-0). + /// To perform a product change, set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point is used. /// ### Delayed Product Change. /// This method also changes the product and/or price point, and the new payment amount is calculated and charged at the normal start of the next period. - /// This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a Delayed Product Change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. + /// This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a delayed product change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. /// You can also perform a delayed change to the price point by passing in either `product_price_point_id` or `product_price_point_handle`. - /// **Note: To cancel a delayed product change, set `next_product_id` to an empty string.**. + /// > **Note:** To cancel a delayed product change, set `next_product_id` to an empty string. /// ## Billing Date Changes. + /// You can update dates for a subscrption. . /// ### Regular Billing Date Changes. /// Send the `next_billing_at` to set the next billing date for the subscription. After that date passes and the subscription is processed, the following billing date will be set according to the subscription's product period. - /// Note that if you pass an invalid date, we will automatically interpret and set the correct date. For example, when February 30 is entered, the next billing will be set to March 2nd in a non-leap year. - /// The server response will not return data under the key/value pair of `next_billing`. Please view the key/value pair of `current_period_ends_at` to verify that the `next_billing` date has been changed successfully. - /// ### Snap Day Changes. + /// > Note: If you pass an invalid date, the correct date is automatically set to he correct date. For example, if February 30 is passed, the next billing would be set to March 2nd in a non-leap year. + /// The server response will not return data under the key/value pair of `next_billing_at`. View the key/value pair of `current_period_ends_at` to verify that the `next_billing_at` date has been changed successfully. + /// ### Calendar Billing and Snap Day Changes. /// For a subscription using Calendar Billing, setting the next billing date is a bit different. Send the `snap_day` attribute to change the calendar billing date for **a subscription using a product eligible for calendar billing**. - /// Note: If you change the product associated with a subscription that contains a `snap_date` and immediately `READ/GET` the subscription data, it will still contain evidence of the existing `snap_date`. This is due to the fact that a product change is instantanous and only affects the product associated with a subscription. After the `next_billing` date arrives, the `snap_day` associated with the subscription will return to `null.` Another way of looking at this is that you willl have to wait for the next billing cycle to arrive before the `snap_date` will reset to `null`. + /// > Note: If you change the product associated with a subscription that contains a `snap_day` and immediately `READ/GET` the subscription data, it will still contain original `snap_day`. The `snap_day`will will reset to 'null on the next billing cycle. This is because a product change is instantanous and only affects the product associated with a subscription. /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: . @@ -1226,7 +330,7 @@ public Models.SubscriptionResponse FindSubscription( /// @@ -1245,7 +349,7 @@ public Models.SubscriptionResponse PurgeSubscription( /// @@ -1310,17 +414,17 @@ public Models.PrepaidConfigurationResponse UpdatePrepaidSubscriptionConfiguratio /// The Chargify API allows you to preview a subscription by POSTing the same JSON or XML as for a subscription creation. /// The "Next Billing" amount and "Next Billing" date are represented in each Subscriber's Summary. /// A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction. - /// For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). + /// For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). /// ## Taxable Subscriptions. /// This endpoint will preview taxes applicable to a purchase. In order for taxes to be previewed, the following conditions must be met:. /// + Taxes must be configured on the subscription. /// + The preview must be for the purchase of a taxable product or component, or combination of the two. /// + The subscription payload must contain a full billing or shipping address in order to calculate tax. - /// For more information about creating taxable previews, please see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes). - /// You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, please note that when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. + /// For more information about creating taxable previews, see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes). + /// You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. /// You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` attribute. /// ## Non-taxable Subscriptions. - /// If you'd like to calculate subscriptions that do not include tax, please feel free to leave off the billing information. + /// If you'd like to calculate subscriptions that do not include tax you may leave off the billing information. /// /// Optional parameter: . /// Returns the Models.SubscriptionPreviewResponse response from the API call. @@ -1332,17 +436,17 @@ public Models.SubscriptionPreviewResponse PreviewSubscription( /// The Chargify API allows you to preview a subscription by POSTing the same JSON or XML as for a subscription creation. /// The "Next Billing" amount and "Next Billing" date are represented in each Subscriber's Summary. /// A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction. - /// For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). + /// For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). /// ## Taxable Subscriptions. /// This endpoint will preview taxes applicable to a purchase. In order for taxes to be previewed, the following conditions must be met:. /// + Taxes must be configured on the subscription. /// + The preview must be for the purchase of a taxable product or component, or combination of the two. /// + The subscription payload must contain a full billing or shipping address in order to calculate tax. - /// For more information about creating taxable previews, please see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes). - /// You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, please note that when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. + /// For more information about creating taxable previews, see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes). + /// You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. /// You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` attribute. /// ## Non-taxable Subscriptions. - /// If you'd like to calculate subscriptions that do not include tax, please feel free to leave off the billing information. + /// If you'd like to calculate subscriptions that do not include tax you may leave off the billing information. /// /// Optional parameter: . /// cancellationToken. @@ -1406,7 +510,7 @@ public Models.SubscriptionResponse ApplyCouponsToSubscription( /// /// Use this endpoint to remove a coupon from an existing subscription. - /// For more information on the expected behaviour of removing a coupon from a subscription, please see our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon). + /// For more information on the expected behaviour of removing a coupon from a subscription, See our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon). /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: The coupon code. @@ -1418,7 +522,7 @@ public string RemoveCouponFromSubscription( /// /// Use this endpoint to remove a coupon from an existing subscription. - /// For more information on the expected behaviour of removing a coupon from a subscription, please see our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon). + /// For more information on the expected behaviour of removing a coupon from a subscription, See our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon). /// /// Required parameter: The Chargify id of the subscription. /// Optional parameter: The coupon code. diff --git a/AdvancedBilling.Standard/Exceptions/ApiException.cs b/AdvancedBilling.Standard/Exceptions/ApiException.cs index 5813b7e6..70a86bb7 100644 --- a/AdvancedBilling.Standard/Exceptions/ApiException.cs +++ b/AdvancedBilling.Standard/Exceptions/ApiException.cs @@ -29,6 +29,7 @@ public override string ToString() { var toStringOutput = new List(); ToString(toStringOutput); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); return $"ApiException : ({string.Join(", ", toStringOutput)})"; } diff --git a/AdvancedBilling.Standard/Exceptions/ComponentAllocationErrorException.cs b/AdvancedBilling.Standard/Exceptions/ComponentAllocationErrorException.cs index c0707135..f3a3f8f1 100644 --- a/AdvancedBilling.Standard/Exceptions/ComponentAllocationErrorException.cs +++ b/AdvancedBilling.Standard/Exceptions/ComponentAllocationErrorException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : $"[{string.Join(", ", this.Errors)} ]")}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/ComponentPricePointErrorException.cs b/AdvancedBilling.Standard/Exceptions/ComponentPricePointErrorException.cs index 2a54e357..a5dfcbaf 100644 --- a/AdvancedBilling.Standard/Exceptions/ComponentPricePointErrorException.cs +++ b/AdvancedBilling.Standard/Exceptions/ComponentPricePointErrorException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : $"[{string.Join(", ", this.Errors)} ]")}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/CustomerErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/CustomerErrorResponseException.cs index 278dc174..06368e92 100644 --- a/AdvancedBilling.Standard/Exceptions/CustomerErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/CustomerErrorResponseException.cs @@ -58,6 +58,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/ErrorArrayMapResponseException.cs b/AdvancedBilling.Standard/Exceptions/ErrorArrayMapResponseException.cs index 5ea019bc..c96d50ca 100644 --- a/AdvancedBilling.Standard/Exceptions/ErrorArrayMapResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/ErrorArrayMapResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/ErrorListResponseException.cs b/AdvancedBilling.Standard/Exceptions/ErrorListResponseException.cs index 2a9b80ae..72a4872f 100644 --- a/AdvancedBilling.Standard/Exceptions/ErrorListResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/ErrorListResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : $"[{string.Join(", ", this.Errors)} ]")}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/ErrorStringMapResponseException.cs b/AdvancedBilling.Standard/Exceptions/ErrorStringMapResponseException.cs index 67a16cb1..0683b16f 100644 --- a/AdvancedBilling.Standard/Exceptions/ErrorStringMapResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/ErrorStringMapResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/EventBasedBillingListSegmentsErrorsException.cs b/AdvancedBilling.Standard/Exceptions/EventBasedBillingListSegmentsErrorsException.cs index 2ce011b3..cdaf4da8 100644 --- a/AdvancedBilling.Standard/Exceptions/EventBasedBillingListSegmentsErrorsException.cs +++ b/AdvancedBilling.Standard/Exceptions/EventBasedBillingListSegmentsErrorsException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentErrorsException.cs b/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentErrorsException.cs index 8e58bd33..c92ca6aa 100644 --- a/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentErrorsException.cs +++ b/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentErrorsException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentException.cs b/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentException.cs index b04b264e..77db8a5f 100644 --- a/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentException.cs +++ b/AdvancedBilling.Standard/Exceptions/EventBasedBillingSegmentException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/ProductPricePointErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/ProductPricePointErrorResponseException.cs index 56d7c5b3..bd4871ff 100644 --- a/AdvancedBilling.Standard/Exceptions/ProductPricePointErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/ProductPricePointErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/ProformaBadRequestErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/ProformaBadRequestErrorResponseException.cs index 2dce7894..1775222d 100644 --- a/AdvancedBilling.Standard/Exceptions/ProformaBadRequestErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/ProformaBadRequestErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/RefundPrepaymentBaseErrorsResponseException.cs b/AdvancedBilling.Standard/Exceptions/RefundPrepaymentBaseErrorsResponseException.cs index 42750eb1..8a6e973b 100644 --- a/AdvancedBilling.Standard/Exceptions/RefundPrepaymentBaseErrorsResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/RefundPrepaymentBaseErrorsResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SingleErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/SingleErrorResponseException.cs index 7c331f9f..277911e1 100644 --- a/AdvancedBilling.Standard/Exceptions/SingleErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/SingleErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Error = {this.Error ?? "null"}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SingleStringErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/SingleStringErrorResponseException.cs index e5c847ee..dc4d7204 100644 --- a/AdvancedBilling.Standard/Exceptions/SingleStringErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/SingleStringErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {this.Errors ?? "null"}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionAddCouponErrorException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionAddCouponErrorException.cs index 9ba61470..8b1a7e2d 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionAddCouponErrorException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionAddCouponErrorException.cs @@ -78,6 +78,7 @@ public override string ToString() toStringOutput.Add($"CouponCode = {(this.CouponCode == null ? "null" : $"[{string.Join(", ", this.CouponCode)} ]")}"); toStringOutput.Add($"CouponCodes = {(this.CouponCodes == null ? "null" : $"[{string.Join(", ", this.CouponCodes)} ]")}"); toStringOutput.Add($"Subscription = {(this.Subscription == null ? "null" : $"[{string.Join(", ", this.Subscription)} ]")}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionComponentAllocationErrorException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionComponentAllocationErrorException.cs index c1485f75..e54d41ab 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionComponentAllocationErrorException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionComponentAllocationErrorException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : $"[{string.Join(", ", this.Errors)} ]")}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionGroupCreateErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionGroupCreateErrorResponseException.cs index 8cf98989..39a68b59 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionGroupCreateErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionGroupCreateErrorResponseException.cs @@ -58,6 +58,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionGroupSignupErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionGroupSignupErrorResponseException.cs index 20c7168f..a9c1cd09 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionGroupSignupErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionGroupSignupErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionGroupUpdateErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionGroupUpdateErrorResponseException.cs index c687ac2d..edd0adca 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionGroupUpdateErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionGroupUpdateErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionRemoveCouponErrorsException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionRemoveCouponErrorsException.cs index 590c8b36..85ddaa4f 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionRemoveCouponErrorsException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionRemoveCouponErrorsException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Subscription = {(this.Subscription == null ? "null" : $"[{string.Join(", ", this.Subscription)} ]")}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionResponseErrorException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionResponseErrorException.cs index 9fe01922..0cf2057c 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionResponseErrorException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionResponseErrorException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Subscription = {(this.Subscription == null ? "null" : this.Subscription.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/SubscriptionsMrrErrorResponseException.cs b/AdvancedBilling.Standard/Exceptions/SubscriptionsMrrErrorResponseException.cs index 218a5f4b..4938b38f 100644 --- a/AdvancedBilling.Standard/Exceptions/SubscriptionsMrrErrorResponseException.cs +++ b/AdvancedBilling.Standard/Exceptions/SubscriptionsMrrErrorResponseException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Exceptions/TooManyManagementLinkRequestsErrorException.cs b/AdvancedBilling.Standard/Exceptions/TooManyManagementLinkRequestsErrorException.cs index dd9800a9..5fc52b51 100644 --- a/AdvancedBilling.Standard/Exceptions/TooManyManagementLinkRequestsErrorException.cs +++ b/AdvancedBilling.Standard/Exceptions/TooManyManagementLinkRequestsErrorException.cs @@ -57,6 +57,7 @@ public override string ToString() { base.ToString(toStringOutput); toStringOutput.Add($"Errors = {(this.Errors == null ? "null" : this.Errors.ToString())}"); + toStringOutput.Add($"StackTrace = {(StackTrace != null ? $"\n{StackTrace}" : "null")}"); } } } \ No newline at end of file diff --git a/AdvancedBilling.Standard/Http/Client/HttpClientConfiguration.cs b/AdvancedBilling.Standard/Http/Client/HttpClientConfiguration.cs index a27f735f..16c8e87c 100644 --- a/AdvancedBilling.Standard/Http/Client/HttpClientConfiguration.cs +++ b/AdvancedBilling.Standard/Http/Client/HttpClientConfiguration.cs @@ -3,12 +3,12 @@ // // This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). // +using APIMatic.Core.Http.Configuration; +using AdvancedBilling.Standard.Http.Client.Proxy; using System; using System.Collections.Generic; +using System.Linq; using System.Net.Http; -using APIMatic.Core.Http.Configuration; -using APIMatic.Core.Proxy; -using AdvancedBilling.Standard.Http.Client.Proxy; namespace AdvancedBilling.Standard.Http.Client { @@ -18,17 +18,11 @@ namespace AdvancedBilling.Standard.Http.Client public class HttpClientConfiguration : IHttpClientConfiguration { private readonly CoreHttpClientConfiguration coreHttpClientConfiguration; - /// - /// Initializes a new instance of the - /// class. - /// - private readonly CoreProxyConfiguration coreProxyConfiguration; + private HttpClientConfiguration( - CoreHttpClientConfiguration.Builder coreHttpClientConfigurationBuilder, - CoreProxyConfiguration coreProxyConfiguration) + CoreHttpClientConfiguration.Builder coreHttpClientConfigurationBuilder) { coreHttpClientConfiguration = coreHttpClientConfigurationBuilder.Build(); - this.coreProxyConfiguration = coreProxyConfiguration; } /// @@ -98,8 +92,7 @@ public override string ToString() public Builder ToBuilder() => new Builder() { - CoreHttpClientConfigurationBuilder = coreHttpClientConfiguration.ToBuilder(), - CoreProxyConfiguration = this.coreProxyConfiguration + CoreHttpClientConfigurationBuilder = coreHttpClientConfiguration.ToBuilder() }; /// @@ -108,7 +101,6 @@ public Builder ToBuilder() public class Builder { internal CoreHttpClientConfiguration.Builder CoreHttpClientConfigurationBuilder { private get; set; } = new CoreHttpClientConfiguration.Builder(); - internal CoreProxyConfiguration CoreProxyConfiguration { private get; set; } /// /// Sets the Timeout. @@ -199,7 +191,12 @@ public Builder HttpClientInstance(HttpClient httpClientInstance, bool overrideHt return this; } - /// + internal Builder RequestMethodsToRetry(IList requestMethodsToRetry) + { + CoreHttpClientConfigurationBuilder = + CoreHttpClientConfigurationBuilder.RequestMethodsToRetry(requestMethodsToRetry.ToHttpMethods()); + return this; + } /// /// Sets the Proxy. /// /// ProxyConfigurationBuilder. @@ -207,7 +204,6 @@ public Builder HttpClientInstance(HttpClient httpClientInstance, bool overrideHt public Builder Proxy(ProxyConfigurationBuilder proxyConfigurationBuilder) { var proxyConfiguration = proxyConfigurationBuilder?.Build(); - CoreProxyConfiguration = proxyConfiguration; CoreHttpClientConfigurationBuilder.ProxyConfiguration(proxyConfiguration); return this; } @@ -218,8 +214,70 @@ public Builder Proxy(ProxyConfigurationBuilder proxyConfigurationBuilder) /// HttpClientConfiguration. public HttpClientConfiguration Build() { - return new HttpClientConfiguration(CoreHttpClientConfigurationBuilder, CoreProxyConfiguration); + return new HttpClientConfiguration(CoreHttpClientConfigurationBuilder); } } + + internal static Builder FromOptions(HttpClientConfigurationOptions options) + { + var builder = new Builder(); + if (options.Timeout != null) + builder.Timeout(options.Timeout.Value); + if (options.NumberOfRetries != null) + builder.NumberOfRetries(options.NumberOfRetries.Value); + if (options.BackoffFactor != null) + builder.BackoffFactor(options.BackoffFactor.Value); + if (options.RetryInterval != null) + builder.RetryInterval(options.RetryInterval.Value); + if (options.MaximumRetryWaitTime != null) + builder.MaximumRetryWaitTime(options.MaximumRetryWaitTime.Value); + if (options.StatusCodesToRetry != null) + builder.StatusCodesToRetry(options.StatusCodesToRetry); + if (options.RequestMethodsToRetry != null) + builder.RequestMethodsToRetry(options.RequestMethodsToRetry); + if (options.Proxy != null) + builder.Proxy(ProxyConfigurationBuilder.FromOptions(options.Proxy)); + return builder; + } + } + + public class HttpClientConfigurationOptions + { + public TimeSpan? Timeout { get; set; } + public int? NumberOfRetries { get; set; } + public int? BackoffFactor { get; set; } + public double? RetryInterval { get; set; } + public TimeSpan? MaximumRetryWaitTime { get; set; } + public IList StatusCodesToRetry { get; set; } + public IList RequestMethodsToRetry { get; set; } + public ProxyOptions Proxy { get; set; } + } + + internal static class HttpClientConfigurationExtensions + { + public static IList ToHttpMethods(this IList methodStrings) + { + return methodStrings == null + ? new List() + : methodStrings + .Select(m => + { + var method = m.ToUpperInvariant(); + switch (method) + { + case "GET": return HttpMethod.Get; + case "POST": return HttpMethod.Post; + case "PUT": return HttpMethod.Put; + case "DELETE": return HttpMethod.Delete; + case "HEAD": return HttpMethod.Head; + case "OPTIONS": return HttpMethod.Options; + case "TRACE": return HttpMethod.Trace; + case "PATCH": return new HttpMethod("PATCH"); + default: return null; // Return null for unknown methods + } + }) + .Where(m => m != null) // Filter out nulls + .ToList(); + } } } diff --git a/AdvancedBilling.Standard/Http/Client/Proxy/ProxyConfigurationBuilder.cs b/AdvancedBilling.Standard/Http/Client/Proxy/ProxyConfigurationBuilder.cs index 54a9da5f..321dfe94 100644 --- a/AdvancedBilling.Standard/Http/Client/Proxy/ProxyConfigurationBuilder.cs +++ b/AdvancedBilling.Standard/Http/Client/Proxy/ProxyConfigurationBuilder.cs @@ -12,7 +12,7 @@ namespace AdvancedBilling.Standard.Http.Client.Proxy /// public class ProxyConfigurationBuilder { - private string _address; + private readonly string _address; private int _port = 8080; private string _user; private string _pass; @@ -27,6 +27,22 @@ public ProxyConfigurationBuilder(string address) _address = address; } + internal static ProxyConfigurationBuilder FromOptions(ProxyOptions options) + { + if (options == null || string.IsNullOrEmpty(options.Address)) + return null; + + var builder = new ProxyConfigurationBuilder(options.Address); + if (options.Port != null) + builder.Port(options.Port.Value); + if (!string.IsNullOrEmpty(options.User) && !string.IsNullOrEmpty(options.Pass)) + builder.Auth(options.User, options.Pass); + + builder.Tunnel(options.Tunnel); + + return builder; + } + /// /// Sets the Port. /// @@ -67,4 +83,13 @@ internal CoreProxyConfiguration Build() return new CoreProxyConfiguration(_address, _port, _user, _pass, _tunnel); } } -} + + public class ProxyOptions + { + public string Address { get; set; } + public int? Port { get; set; } + public bool Tunnel { get; set; } + public string User { get; set; } + public string Pass { get; set; } + } +} \ No newline at end of file diff --git a/AdvancedBilling.Standard/Models/ActivateEventBasedComponent.cs b/AdvancedBilling.Standard/Models/ActivateEventBasedComponent.cs index d2ddfea1..10a15398 100644 --- a/AdvancedBilling.Standard/Models/ActivateEventBasedComponent.cs +++ b/AdvancedBilling.Standard/Models/ActivateEventBasedComponent.cs @@ -53,7 +53,7 @@ public ActivateEventBasedComponent( public int? PricePointId { get; set; } /// - /// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled + /// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. /// [JsonProperty("billing_schedule", NullValueHandling = NullValueHandling.Ignore)] public Models.BillingSchedule BillingSchedule { get; set; } diff --git a/AdvancedBilling.Standard/Models/CalendarBilling.cs b/AdvancedBilling.Standard/Models/CalendarBilling.cs index d9093f7a..c8cbba8c 100644 --- a/AdvancedBilling.Standard/Models/CalendarBilling.cs +++ b/AdvancedBilling.Standard/Models/CalendarBilling.cs @@ -24,6 +24,12 @@ namespace AdvancedBilling.Standard.Models /// public class CalendarBilling : BaseModel { + private CalendarBillingSnapDay snapDay; + private Dictionary shouldSerialize = new Dictionary + { + { "snap_day", false }, + }; + /// /// Initializes a new instance of the class. /// @@ -40,15 +46,31 @@ public CalendarBilling( CalendarBillingSnapDay snapDay = null, Models.FirstChargeType? calendarBillingFirstCharge = null) { - this.SnapDay = snapDay; + + if (snapDay != null) + { + this.SnapDay = snapDay; + } this.CalendarBillingFirstCharge = calendarBillingFirstCharge; } /// /// A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. /// - [JsonProperty("snap_day", NullValueHandling = NullValueHandling.Ignore)] - public CalendarBillingSnapDay SnapDay { get; set; } + [JsonProperty("snap_day")] + public CalendarBillingSnapDay SnapDay + { + get + { + return this.snapDay; + } + + set + { + this.shouldSerialize["snap_day"] = true; + this.snapDay = value; + } + } /// /// Gets or sets CalendarBillingFirstCharge. @@ -64,6 +86,23 @@ public override string ToString() return $"CalendarBilling : ({string.Join(", ", toStringOutput)})"; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetSnapDay() + { + this.shouldSerialize["snap_day"] = false; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeSnapDay() + { + return this.shouldSerialize["snap_day"]; + } + /// public override bool Equals(object obj) { diff --git a/AdvancedBilling.Standard/Models/ChargifyEBB.cs b/AdvancedBilling.Standard/Models/ChargifyEBB.cs index 1697f3d2..00268eae 100644 --- a/AdvancedBilling.Standard/Models/ChargifyEBB.cs +++ b/AdvancedBilling.Standard/Models/ChargifyEBB.cs @@ -63,13 +63,13 @@ public ChargifyEBB( public DateTimeOffset? Timestamp { get; set; } /// - /// A unique ID set by Chargify. Please note that this field is reserved. If `chargify.id` is present in the request payload, it will be overwritten. + /// A unique ID set by Chargify. This field is reserved. If `chargify.id` is present in the request payload, it will be overwritten. /// [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] public string Id { get; set; } /// - /// An ISO-8601 timestamp, set by Chargify at the time each event is recorded. Please note that this field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten. + /// An ISO-8601 timestamp, set by Chargify at the time each event is recorded. This field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten. /// [JsonConverter(typeof(IsoDateTimeConverter))] [JsonProperty("created_at", NullValueHandling = NullValueHandling.Ignore)] diff --git a/AdvancedBilling.Standard/Models/Component.cs b/AdvancedBilling.Standard/Models/Component.cs index 0e54b813..a87bde3a 100644 --- a/AdvancedBilling.Standard/Models/Component.cs +++ b/AdvancedBilling.Standard/Models/Component.cs @@ -83,7 +83,6 @@ public Component() /// price_per_unit_in_cents. /// kind. /// archived. - /// taxable. /// description. /// default_price_point_id. /// overage_prices. @@ -91,6 +90,7 @@ public Component() /// price_point_count. /// price_points_url. /// default_price_point_name. + /// taxable. /// tax_code. /// recurring. /// upgrade_charge. @@ -119,7 +119,6 @@ public Component( long? pricePerUnitInCents = null, Models.ComponentKind? kind = null, bool? archived = null, - bool? taxable = null, string description = null, int? defaultPricePointId = null, List overagePrices = null, @@ -127,6 +126,7 @@ public Component( int? pricePointCount = null, string pricePointsUrl = null, string defaultPricePointName = null, + bool? taxable = null, string taxCode = null, bool? recurring = null, Models.CreditType? upgradeCharge = null, @@ -171,7 +171,6 @@ public Component( } this.Kind = kind; this.Archived = archived; - this.Taxable = taxable; if (description != null) { @@ -199,6 +198,7 @@ public Component( this.PricePointsUrl = pricePointsUrl; } this.DefaultPricePointName = defaultPricePointName; + this.Taxable = taxable; if (taxCode != null) { @@ -368,12 +368,6 @@ public long? PricePerUnitInCents [JsonProperty("archived", NullValueHandling = NullValueHandling.Ignore)] public bool? Archived { get; set; } - /// - /// Boolean flag describing whether a component is taxable or not. - /// - [JsonProperty("taxable", NullValueHandling = NullValueHandling.Ignore)] - public bool? Taxable { get; set; } - /// /// The description of the component. /// @@ -477,7 +471,13 @@ public string PricePointsUrl public string DefaultPricePointName { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// Boolean flag describing whether a component is taxable or not. + /// + [JsonProperty("taxable", NullValueHandling = NullValueHandling.Ignore)] + public bool? Taxable { get; set; } + + /// + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code")] public string TaxCode @@ -995,8 +995,6 @@ public override bool Equals(object obj) this.Kind?.Equals(other.Kind) == true) && (this.Archived == null && other.Archived == null || this.Archived?.Equals(other.Archived) == true) && - (this.Taxable == null && other.Taxable == null || - this.Taxable?.Equals(other.Taxable) == true) && (this.Description == null && other.Description == null || this.Description?.Equals(other.Description) == true) && (this.DefaultPricePointId == null && other.DefaultPricePointId == null || @@ -1011,6 +1009,8 @@ public override bool Equals(object obj) this.PricePointsUrl?.Equals(other.PricePointsUrl) == true) && (this.DefaultPricePointName == null && other.DefaultPricePointName == null || this.DefaultPricePointName?.Equals(other.DefaultPricePointName) == true) && + (this.Taxable == null && other.Taxable == null || + this.Taxable?.Equals(other.Taxable) == true) && (this.TaxCode == null && other.TaxCode == null || this.TaxCode?.Equals(other.TaxCode) == true) && (this.Recurring == null && other.Recurring == null || @@ -1062,7 +1062,6 @@ public override bool Equals(object obj) toStringOutput.Add($"PricePerUnitInCents = {(this.PricePerUnitInCents == null ? "null" : this.PricePerUnitInCents.ToString())}"); toStringOutput.Add($"Kind = {(this.Kind == null ? "null" : this.Kind.ToString())}"); toStringOutput.Add($"Archived = {(this.Archived == null ? "null" : this.Archived.ToString())}"); - toStringOutput.Add($"Taxable = {(this.Taxable == null ? "null" : this.Taxable.ToString())}"); toStringOutput.Add($"Description = {this.Description ?? "null"}"); toStringOutput.Add($"DefaultPricePointId = {(this.DefaultPricePointId == null ? "null" : this.DefaultPricePointId.ToString())}"); toStringOutput.Add($"OveragePrices = {(this.OveragePrices == null ? "null" : $"[{string.Join(", ", this.OveragePrices)} ]")}"); @@ -1070,6 +1069,7 @@ public override bool Equals(object obj) toStringOutput.Add($"PricePointCount = {(this.PricePointCount == null ? "null" : this.PricePointCount.ToString())}"); toStringOutput.Add($"PricePointsUrl = {this.PricePointsUrl ?? "null"}"); toStringOutput.Add($"DefaultPricePointName = {this.DefaultPricePointName ?? "null"}"); + toStringOutput.Add($"Taxable = {(this.Taxable == null ? "null" : this.Taxable.ToString())}"); toStringOutput.Add($"TaxCode = {this.TaxCode ?? "null"}"); toStringOutput.Add($"Recurring = {(this.Recurring == null ? "null" : this.Recurring.ToString())}"); toStringOutput.Add($"UpgradeCharge = {(this.UpgradeCharge == null ? "null" : this.UpgradeCharge.ToString())}"); diff --git a/AdvancedBilling.Standard/Models/ComponentCustomPrice.cs b/AdvancedBilling.Standard/Models/ComponentCustomPrice.cs index 729dcf47..5f27c9ee 100644 --- a/AdvancedBilling.Standard/Models/ComponentCustomPrice.cs +++ b/AdvancedBilling.Standard/Models/ComponentCustomPrice.cs @@ -24,9 +24,13 @@ namespace AdvancedBilling.Standard.Models public class ComponentCustomPrice : BaseModel { private Models.IntervalUnit? intervalUnit; + private int? expirationInterval; + private Models.ExpirationIntervalUnit? expirationIntervalUnit; private Dictionary shouldSerialize = new Dictionary { { "interval_unit", false }, + { "expiration_interval", false }, + { "expiration_interval_unit", false }, }; /// @@ -44,12 +48,20 @@ public ComponentCustomPrice() /// pricing_scheme. /// interval. /// interval_unit. + /// renew_prepaid_allocation. + /// rollover_prepaid_remainder. + /// expiration_interval. + /// expiration_interval_unit. public ComponentCustomPrice( List prices, bool? taxIncluded = null, Models.PricingScheme? pricingScheme = null, int? interval = null, - Models.IntervalUnit? intervalUnit = null) + Models.IntervalUnit? intervalUnit = null, + bool? renewPrepaidAllocation = null, + bool? rolloverPrepaidRemainder = null, + int? expirationInterval = null, + Models.ExpirationIntervalUnit? expirationIntervalUnit = null) { this.TaxIncluded = taxIncluded; this.PricingScheme = pricingScheme; @@ -60,6 +72,18 @@ public ComponentCustomPrice( this.IntervalUnit = intervalUnit; } this.Prices = prices; + this.RenewPrepaidAllocation = renewPrepaidAllocation; + this.RolloverPrepaidRemainder = rolloverPrepaidRemainder; + + if (expirationInterval != null) + { + this.ExpirationInterval = expirationInterval; + } + + if (expirationIntervalUnit != null) + { + this.ExpirationIntervalUnit = expirationIntervalUnit; + } } /// @@ -104,6 +128,54 @@ public Models.IntervalUnit? IntervalUnit [JsonProperty("prices")] public List Prices { get; set; } + /// + /// Applicable only to prepaid usage components. Controls whether the allocated quantity renews each period. + /// + [JsonProperty("renew_prepaid_allocation", NullValueHandling = NullValueHandling.Ignore)] + public bool? RenewPrepaidAllocation { get; set; } + + /// + /// Applicable only to prepaid usage components. Controls whether remaining units roll over to the next period. + /// + [JsonProperty("rollover_prepaid_remainder", NullValueHandling = NullValueHandling.Ignore)] + public bool? RolloverPrepaidRemainder { get; set; } + + /// + /// Applicable only when rollover is enabled. Number of `expiration_interval_unit`s after which rollover amounts expire. + /// + [JsonProperty("expiration_interval")] + public int? ExpirationInterval + { + get + { + return this.expirationInterval; + } + + set + { + this.shouldSerialize["expiration_interval"] = true; + this.expirationInterval = value; + } + } + + /// + /// Applicable only when rollover is enabled. Interval unit for rollover expiration (month or day). + /// + [JsonProperty("expiration_interval_unit")] + public Models.ExpirationIntervalUnit? ExpirationIntervalUnit + { + get + { + return this.expirationIntervalUnit; + } + + set + { + this.shouldSerialize["expiration_interval_unit"] = true; + this.expirationIntervalUnit = value; + } + } + /// public override string ToString() { @@ -120,6 +192,22 @@ public void UnsetIntervalUnit() this.shouldSerialize["interval_unit"] = false; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetExpirationInterval() + { + this.shouldSerialize["expiration_interval"] = false; + } + + /// + /// Marks the field to not be serialized. + /// + public void UnsetExpirationIntervalUnit() + { + this.shouldSerialize["expiration_interval_unit"] = false; + } + /// /// Checks if the field should be serialized or not. /// @@ -129,6 +217,24 @@ public bool ShouldSerializeIntervalUnit() return this.shouldSerialize["interval_unit"]; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeExpirationInterval() + { + return this.shouldSerialize["expiration_interval"]; + } + + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeExpirationIntervalUnit() + { + return this.shouldSerialize["expiration_interval_unit"]; + } + /// public override bool Equals(object obj) { @@ -146,6 +252,14 @@ public override bool Equals(object obj) this.IntervalUnit?.Equals(other.IntervalUnit) == true) && (this.Prices == null && other.Prices == null || this.Prices?.Equals(other.Prices) == true) && + (this.RenewPrepaidAllocation == null && other.RenewPrepaidAllocation == null || + this.RenewPrepaidAllocation?.Equals(other.RenewPrepaidAllocation) == true) && + (this.RolloverPrepaidRemainder == null && other.RolloverPrepaidRemainder == null || + this.RolloverPrepaidRemainder?.Equals(other.RolloverPrepaidRemainder) == true) && + (this.ExpirationInterval == null && other.ExpirationInterval == null || + this.ExpirationInterval?.Equals(other.ExpirationInterval) == true) && + (this.ExpirationIntervalUnit == null && other.ExpirationIntervalUnit == null || + this.ExpirationIntervalUnit?.Equals(other.ExpirationIntervalUnit) == true) && base.Equals(obj); } @@ -160,6 +274,10 @@ public override bool Equals(object obj) toStringOutput.Add($"Interval = {(this.Interval == null ? "null" : this.Interval.ToString())}"); toStringOutput.Add($"IntervalUnit = {(this.IntervalUnit == null ? "null" : this.IntervalUnit.ToString())}"); toStringOutput.Add($"Prices = {(this.Prices == null ? "null" : $"[{string.Join(", ", this.Prices)} ]")}"); + toStringOutput.Add($"RenewPrepaidAllocation = {(this.RenewPrepaidAllocation == null ? "null" : this.RenewPrepaidAllocation.ToString())}"); + toStringOutput.Add($"RolloverPrepaidRemainder = {(this.RolloverPrepaidRemainder == null ? "null" : this.RolloverPrepaidRemainder.ToString())}"); + toStringOutput.Add($"ExpirationInterval = {(this.ExpirationInterval == null ? "null" : this.ExpirationInterval.ToString())}"); + toStringOutput.Add($"ExpirationIntervalUnit = {(this.ExpirationIntervalUnit == null ? "null" : this.ExpirationIntervalUnit.ToString())}"); base.ToString(toStringOutput); } diff --git a/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemPreviousQuantity.cs b/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemPreviousQuantity.cs index 1877439b..c6d361a7 100644 --- a/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemPreviousQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemPreviousQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static AllocationPreviewItemPreviousQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : AllocationPreviewItemPreviousQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : AllocationPreviewItemPreviousQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemQuantity.cs b/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemQuantity.cs index 63013c26..ad24e14b 100644 --- a/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/AllocationPreviewItemQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static AllocationPreviewItemQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : AllocationPreviewItemQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : AllocationPreviewItemQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/AllocationPreviousQuantity.cs b/AdvancedBilling.Standard/Models/Containers/AllocationPreviousQuantity.cs index 99f3ebfb..ecf90662 100644 --- a/AdvancedBilling.Standard/Models/Containers/AllocationPreviousQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/AllocationPreviousQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static AllocationPreviousQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : AllocationPreviousQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : AllocationPreviousQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/AllocationQuantity.cs b/AdvancedBilling.Standard/Models/Containers/AllocationQuantity.cs index 6a9b2ae2..19151e6a 100644 --- a/AdvancedBilling.Standard/Models/Containers/AllocationQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/AllocationQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static AllocationQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : AllocationQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : AllocationQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointComponentId.cs b/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointComponentId.cs index 6281ed0e..8c794ca1 100644 --- a/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ArchiveComponentPricePointComponentId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ArchiveComponentPricePointComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ArchiveComponentPricePointComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointPricePointId.cs index 3e6d09bc..25c36fe2 100644 --- a/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ArchiveComponentPricePointPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ArchiveComponentPricePointPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ArchiveComponentPricePointPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ArchiveComponentPricePointPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointPricePointId.cs index d71a6fea..200f302f 100644 --- a/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ArchiveProductPricePointPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ArchiveProductPricePointPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ArchiveProductPricePointPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointProductId.cs b/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointProductId.cs index 283a48cc..0fb4a7b8 100644 --- a/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointProductId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ArchiveProductPricePointProductId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ArchiveProductPricePointProductId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ArchiveProductPricePointProductId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ArchiveProductPricePointProductId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CalendarBillingSnapDay.cs b/AdvancedBilling.Standard/Models/Containers/CalendarBillingSnapDay.cs index 05b3b607..04b92f49 100644 --- a/AdvancedBilling.Standard/Models/Containers/CalendarBillingSnapDay.cs +++ b/AdvancedBilling.Standard/Models/Containers/CalendarBillingSnapDay.cs @@ -15,9 +15,9 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), - typeof(MStringCase) + typeof(SnapDayCase) }, true )] @@ -35,14 +35,14 @@ public static CalendarBillingSnapDay FromNumber(int number) } /// - /// This is String case. + /// This is SnapDay case. /// /// - /// The CalendarBillingSnapDay instance, wrapping the provided string value. + /// The CalendarBillingSnapDay instance, wrapping the provided SnapDay value. /// - public static CalendarBillingSnapDay FromString(string mString) + public static CalendarBillingSnapDay FromSnapDay(SnapDay snapDay) { - return new MStringCase().Set(mString); + return new SnapDayCase().Set(snapDay); } /// @@ -53,73 +53,81 @@ public static CalendarBillingSnapDay FromString(string mString) /// callback function. /// /// - public abstract T Match(Func number, Func mString); + public abstract T Match(Func number, Func snapDay); + + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func snapDay = null) => + Match(number, snapDay); [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CalendarBillingSnapDay, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func snapDay) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } - [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] - private sealed class MStringCase : CalendarBillingSnapDay, ICaseValue + [JsonConverter(typeof(UnionTypeCaseConverter))] + private sealed class SnapDayCase : CalendarBillingSnapDay, ICaseValue { - public string _value; + public SnapDay Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func snapDay) => + snapDay != null ? snapDay(Value) : default; - public MStringCase Set(string value) + public SnapDayCase Set(SnapDay value) { - _value = value; + Value = value; return this; } - public string Get() + public SnapDay Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { - if (!(obj is MStringCase other)) return false; + if (!(obj is SnapDayCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ComponentAllocationChangeAllocatedQuantity.cs b/AdvancedBilling.Standard/Models/Containers/ComponentAllocationChangeAllocatedQuantity.cs index d5a99321..2181ef42 100644 --- a/AdvancedBilling.Standard/Models/Containers/ComponentAllocationChangeAllocatedQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/ComponentAllocationChangeAllocatedQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ComponentAllocationChangeAllocatedQuantity FromString(string mStri /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ComponentAllocationChangeAllocatedQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ComponentAllocationChangeAllocatedQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ComponentPricePointAssignmentPricePoint.cs b/AdvancedBilling.Standard/Models/Containers/ComponentPricePointAssignmentPricePoint.cs index 01e6169c..d77992f2 100644 --- a/AdvancedBilling.Standard/Models/Containers/ComponentPricePointAssignmentPricePoint.cs +++ b/AdvancedBilling.Standard/Models/Containers/ComponentPricePointAssignmentPricePoint.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static ComponentPricePointAssignmentPricePoint FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ComponentPricePointAssignmentPricePoint, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ComponentPricePointAssignmentPricePoint, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CouponPayloadPercentage.cs b/AdvancedBilling.Standard/Models/Containers/CouponPayloadPercentage.cs index 200214c3..ebe6fb1f 100644 --- a/AdvancedBilling.Standard/Models/Containers/CouponPayloadPercentage.cs +++ b/AdvancedBilling.Standard/Models/Containers/CouponPayloadPercentage.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static CouponPayloadPercentage FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CouponPayloadPercentage, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CouponPayloadPercentage, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateAllocationPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/CreateAllocationPricePointId.cs index 78a38aa2..4556ec7b 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateAllocationPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateAllocationPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateAllocationPricePointId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateAllocationPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateAllocationPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointRequestPricePoint.cs b/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointRequestPricePoint.cs index f766b503..fc77eb84 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointRequestPricePoint.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointRequestPricePoint.cs @@ -14,7 +14,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(CreateComponentPricePointCase), typeof(CreatePrepaidUsageComponentPricePointCase) }, @@ -54,71 +54,79 @@ public static CreateComponentPricePointRequestPricePoint FromCreatePrepaidUsageC /// public abstract T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint); + /// + /// Method to match from the provided any-of cases. The parameters represent + /// optional callback functions for any-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func createComponentPricePoint = null, Func createPrepaidUsageComponentPricePoint = null) => + Match(createComponentPricePoint, createPrepaidUsageComponentPricePoint); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreateComponentPricePointCase : CreateComponentPricePointRequestPricePoint, ICaseValue { - public CreateComponentPricePoint _value; + public CreateComponentPricePoint Value; - public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) - { - return createComponentPricePoint(_value); - } + public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) => + createComponentPricePoint != null ? createComponentPricePoint(Value) : default; public CreateComponentPricePointCase Set(CreateComponentPricePoint value) { - _value = value; + Value = value; return this; } public CreateComponentPricePoint Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreateComponentPricePointCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreatePrepaidUsageComponentPricePointCase : CreateComponentPricePointRequestPricePoint, ICaseValue { - public CreatePrepaidUsageComponentPricePoint _value; + public CreatePrepaidUsageComponentPricePoint Value; - public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) - { - return createPrepaidUsageComponentPricePoint(_value); - } + public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) => + createPrepaidUsageComponentPricePoint != null ? createPrepaidUsageComponentPricePoint(Value) : default; public CreatePrepaidUsageComponentPricePointCase Set(CreatePrepaidUsageComponentPricePoint value) { - _value = value; + Value = value; return this; } public CreatePrepaidUsageComponentPricePoint Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreatePrepaidUsageComponentPricePointCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointsRequestPricePoints.cs b/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointsRequestPricePoints.cs index 28595b3c..e03bef7c 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointsRequestPricePoints.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateComponentPricePointsRequestPricePoints.cs @@ -14,7 +14,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(CreateComponentPricePointCase), typeof(CreatePrepaidUsageComponentPricePointCase) }, @@ -54,71 +54,79 @@ public static CreateComponentPricePointsRequestPricePoints FromCreatePrepaidUsag /// public abstract T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint); + /// + /// Method to match from the provided any-of cases. The parameters represent + /// optional callback functions for any-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func createComponentPricePoint = null, Func createPrepaidUsageComponentPricePoint = null) => + Match(createComponentPricePoint, createPrepaidUsageComponentPricePoint); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreateComponentPricePointCase : CreateComponentPricePointsRequestPricePoints, ICaseValue { - public CreateComponentPricePoint _value; + public CreateComponentPricePoint Value; - public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) - { - return createComponentPricePoint(_value); - } + public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) => + createComponentPricePoint != null ? createComponentPricePoint(Value) : default; public CreateComponentPricePointCase Set(CreateComponentPricePoint value) { - _value = value; + Value = value; return this; } public CreateComponentPricePoint Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreateComponentPricePointCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreatePrepaidUsageComponentPricePointCase : CreateComponentPricePointsRequestPricePoints, ICaseValue { - public CreatePrepaidUsageComponentPricePoint _value; + public CreatePrepaidUsageComponentPricePoint Value; - public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) - { - return createPrepaidUsageComponentPricePoint(_value); - } + public override T Match(Func createComponentPricePoint, Func createPrepaidUsageComponentPricePoint) => + createPrepaidUsageComponentPricePoint != null ? createPrepaidUsageComponentPricePoint(Value) : default; public CreatePrepaidUsageComponentPricePointCase Set(CreatePrepaidUsageComponentPricePoint value) { - _value = value; + Value = value; return this; } public CreatePrepaidUsageComponentPricePoint Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreatePrepaidUsageComponentPricePointCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponAmount.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponAmount.cs index 75e1ec52..ea85092d 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponAmount.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponAmount.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceCouponAmount FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceCouponAmount, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateInvoiceCouponAmount, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponPercentage.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponPercentage.cs index f504ff64..3ab3d33b 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponPercentage.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponPercentage.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceCouponPercentage FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceCouponPercentage, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateInvoiceCouponPercentage, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponProductFamilyId.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponProductFamilyId.cs index 9c59fd66..7c829001 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponProductFamilyId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceCouponProductFamilyId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceCouponProductFamilyId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceCouponProductFamilyId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateInvoiceCouponProductFamilyId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemComponentId.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemComponentId.cs index bc76693b..600cc3fa 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceItemComponentId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceItemComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateInvoiceItemComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemPricePointId.cs index 52936a79..d2c5d2d3 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceItemPricePointId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceItemPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateInvoiceItemPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductId.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductId.cs index 3f21f0a3..c9a9947e 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceItemProductId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceItemProductId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateInvoiceItemProductId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductPricePointId.cs index 8d409fc1..99e28f74 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemProductPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceItemProductPricePointId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceItemProductPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateInvoiceItemProductPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemQuantity.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemQuantity.cs index 19b192cf..61e314b5 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(PrecisionCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceItemQuantity FromString(string mString) /// public abstract T Match(Func precision, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func precision = null, Func mString = null) => + Match(precision, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateInvoiceItemQuantity, ICaseValue { - public double _value; + public double Value; - public override T Match(Func precision, Func mString) - { - return precision(_value); - } + public override T Match(Func precision, Func mString) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceItemQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func precision, Func mString) - { - return mString(_value); - } + public override T Match(Func precision, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemUnitPrice.cs index 1222ce86..4ff5bb1e 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoiceItemUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(PrecisionCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateInvoiceItemUnitPrice FromString(string mString) /// public abstract T Match(Func precision, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func precision = null, Func mString = null) => + Match(precision, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateInvoiceItemUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func precision, Func mString) - { - return precision(_value); - } + public override T Match(Func precision, Func mString) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoiceItemUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func precision, Func mString) - { - return mString(_value); - } + public override T Match(Func precision, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateInvoicePaymentAmount.cs b/AdvancedBilling.Standard/Models/Containers/CreateInvoicePaymentAmount.cs index 716ae29d..ea55facc 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateInvoicePaymentAmount.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateInvoicePaymentAmount.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static CreateInvoicePaymentAmount FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateInvoicePaymentAmount, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateInvoicePaymentAmount, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateMetafieldsRequestMetafields.cs b/AdvancedBilling.Standard/Models/Containers/CreateMetafieldsRequestMetafields.cs index 7e4ef69c..4c76449e 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateMetafieldsRequestMetafields.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateMetafieldsRequestMetafields.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(CreateMetafieldCase), typeof(ListOfCreateMetafieldCase) }, @@ -55,71 +55,79 @@ public static CreateMetafieldsRequestMetafields FromListOfCreateMetafield(List public abstract T Match(Func createMetafield, Func, T> listOfCreateMetafield); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func createMetafield = null, Func, T> listOfCreateMetafield = null) => + Match(createMetafield, listOfCreateMetafield); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreateMetafieldCase : CreateMetafieldsRequestMetafields, ICaseValue { - public CreateMetafield _value; + public CreateMetafield Value; - public override T Match(Func createMetafield, Func, T> listOfCreateMetafield) - { - return createMetafield(_value); - } + public override T Match(Func createMetafield, Func, T> listOfCreateMetafield) => + createMetafield != null ? createMetafield(Value) : default; public CreateMetafieldCase Set(CreateMetafield value) { - _value = value; + Value = value; return this; } public CreateMetafield Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreateMetafieldCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter>))] private sealed class ListOfCreateMetafieldCase : CreateMetafieldsRequestMetafields, ICaseValue> { - public List _value; + public List Value; - public override T Match(Func createMetafield, Func, T> listOfCreateMetafield) - { - return listOfCreateMetafield(_value); - } + public override T Match(Func createMetafield, Func, T> listOfCreateMetafield) => + listOfCreateMetafield != null ? listOfCreateMetafield(Value) : default; public ListOfCreateMetafieldCase Set(List value) { - _value = value; + Value = value; return this; } public List Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ListOfCreateMetafieldCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateMultiInvoicePaymentAmount.cs b/AdvancedBilling.Standard/Models/Containers/CreateMultiInvoicePaymentAmount.cs index 70bf5968..bd792787 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateMultiInvoicePaymentAmount.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateMultiInvoicePaymentAmount.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static CreateMultiInvoicePaymentAmount FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateMultiInvoicePaymentAmount, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateMultiInvoicePaymentAmount, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateOrUpdateSegmentPriceUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/CreateOrUpdateSegmentPriceUnitPrice.cs index 6b9f8c5c..7d072165 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateOrUpdateSegmentPriceUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateOrUpdateSegmentPriceUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static CreateOrUpdateSegmentPriceUnitPrice FromPrecision(double precision /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateOrUpdateSegmentPriceUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateOrUpdateSegmentPriceUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationMonth.cs b/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationMonth.cs index f97e811c..3d375739 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationMonth.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationMonth.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreatePaymentProfileExpirationMonth FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreatePaymentProfileExpirationMonth, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreatePaymentProfileExpirationMonth, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationYear.cs b/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationYear.cs index e9c89268..1607b5e6 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationYear.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreatePaymentProfileExpirationYear.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreatePaymentProfileExpirationYear FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreatePaymentProfileExpirationYear, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreatePaymentProfileExpirationYear, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateProductPricePointProductId.cs b/AdvancedBilling.Standard/Models/Containers/CreateProductPricePointProductId.cs index 778dc873..ee3bc372 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateProductPricePointProductId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateProductPricePointProductId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateProductPricePointProductId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateProductPricePointProductId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateProductPricePointProductId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty1Value.cs b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty1Value.cs index ff6e4500..a9878d4c 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty1Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty1Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSegmentSegmentProperty1Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateSegmentSegmentProperty1Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSegmentSegmentProperty1Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : CreateSegmentSegmentProperty1Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty2Value.cs b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty2Value.cs index 08773fa2..f582bbca 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty2Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty2Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSegmentSegmentProperty2Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateSegmentSegmentProperty2Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSegmentSegmentProperty2Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : CreateSegmentSegmentProperty2Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty3Value.cs b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty3Value.cs index 5ffa7182..62d0c44b 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty3Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty3Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSegmentSegmentProperty3Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateSegmentSegmentProperty3Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSegmentSegmentProperty3Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : CreateSegmentSegmentProperty3Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty4Value.cs b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty4Value.cs index 211a8566..b22bb2b8 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty4Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSegmentSegmentProperty4Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSegmentSegmentProperty4Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : CreateSegmentSegmentProperty4Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSegmentSegmentProperty4Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : CreateSegmentSegmentProperty4Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentAllocatedQuantity.cs b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentAllocatedQuantity.cs index 74e685f1..73d5526a 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentAllocatedQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentAllocatedQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateSubscriptionComponentAllocatedQuantity FromString(string mSt /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSubscriptionComponentAllocatedQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSubscriptionComponentAllocatedQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentComponentId.cs b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentComponentId.cs index 0b0b9183..6a05cbf2 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateSubscriptionComponentComponentId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSubscriptionComponentComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSubscriptionComponentComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentPricePointId.cs index dcc4af8c..4f6a01ea 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionComponentPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateSubscriptionComponentPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSubscriptionComponentPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSubscriptionComponentPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionOfferId.cs b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionOfferId.cs index f1c8c184..0cbdffc6 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionOfferId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateSubscriptionOfferId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static CreateSubscriptionOfferId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateSubscriptionOfferId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateSubscriptionOfferId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateUsageComponentId.cs b/AdvancedBilling.Standard/Models/Containers/CreateUsageComponentId.cs index adaa5a3f..6f70052c 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateUsageComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateUsageComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateUsageComponentId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateUsageComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateUsageComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CreateUsageSubscriptionIdOrReference.cs b/AdvancedBilling.Standard/Models/Containers/CreateUsageSubscriptionIdOrReference.cs index 3a7a1876..59722e92 100644 --- a/AdvancedBilling.Standard/Models/Containers/CreateUsageSubscriptionIdOrReference.cs +++ b/AdvancedBilling.Standard/Models/Containers/CreateUsageSubscriptionIdOrReference.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static CreateUsageSubscriptionIdOrReference FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : CreateUsageSubscriptionIdOrReference, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : CreateUsageSubscriptionIdOrReference, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/CustomerErrorResponseErrors.cs b/AdvancedBilling.Standard/Models/Containers/CustomerErrorResponseErrors.cs index 455c249e..b9ccd07d 100644 --- a/AdvancedBilling.Standard/Models/Containers/CustomerErrorResponseErrors.cs +++ b/AdvancedBilling.Standard/Models/Containers/CustomerErrorResponseErrors.cs @@ -16,7 +16,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(CustomerErrorCase), typeof(ListOfStringCase) }, @@ -56,71 +56,79 @@ public static CustomerErrorResponseErrors FromListOfString(List listOfSt /// public abstract T Match(Func customerError, Func, T> listOfString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func customerError = null, Func, T> listOfString = null) => + Match(customerError, listOfString); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CustomerErrorCase : CustomerErrorResponseErrors, ICaseValue { - public CustomerError _value; + public CustomerError Value; - public override T Match(Func customerError, Func, T> listOfString) - { - return customerError(_value); - } + public override T Match(Func customerError, Func, T> listOfString) => + customerError != null ? customerError(Value) : default; public CustomerErrorCase Set(CustomerError value) { - _value = value; + Value = value; return this; } public CustomerError Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CustomerErrorCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter>), JTokenType.String, JTokenType.Null)] private sealed class ListOfStringCase : CustomerErrorResponseErrors, ICaseValue> { - public List _value; + public List Value; - public override T Match(Func customerError, Func, T> listOfString) - { - return listOfString(_value); - } + public override T Match(Func customerError, Func, T> listOfString) => + listOfString != null ? listOfString(Value) : default; public ListOfStringCase Set(List value) { - _value = value; + Value = value; return this; } public List Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ListOfStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/DeductServiceCreditAmount.cs b/AdvancedBilling.Standard/Models/Containers/DeductServiceCreditAmount.cs index ff7d1836..1ecd26e5 100644 --- a/AdvancedBilling.Standard/Models/Containers/DeductServiceCreditAmount.cs +++ b/AdvancedBilling.Standard/Models/Containers/DeductServiceCreditAmount.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static DeductServiceCreditAmount FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : DeductServiceCreditAmount, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : DeductServiceCreditAmount, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/EBBComponentUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/EBBComponentUnitPrice.cs index 2278b9b9..ce2efdb9 100644 --- a/AdvancedBilling.Standard/Models/Containers/EBBComponentUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/EBBComponentUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static EBBComponentUnitPrice FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : EBBComponentUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : EBBComponentUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/EventEventSpecificData.cs b/AdvancedBilling.Standard/Models/Containers/EventEventSpecificData.cs index 6893bd9b..14f04982 100644 --- a/AdvancedBilling.Standard/Models/Containers/EventEventSpecificData.cs +++ b/AdvancedBilling.Standard/Models/Containers/EventEventSpecificData.cs @@ -14,7 +14,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(SubscriptionProductChangeCase), typeof(SubscriptionStateChangeCase), typeof(PaymentRelatedEventsCase), @@ -264,10 +264,40 @@ public abstract T Match( Func itemPricePointChanged, Func customFieldValueChange); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func subscriptionProductChange = null, + Func subscriptionStateChange = null, + Func paymentRelatedEvents = null, + Func refundSuccess = null, + Func componentAllocationChange = null, + Func meteredUsage = null, + Func prepaidUsage = null, + Func dunningStepReached = null, + Func invoiceIssued = null, + Func pendingCancellationChange = null, + Func prepaidSubscriptionBalanceChanged = null, + Func proformaInvoiceIssued = null, + Func subscriptionGroupSignupEventData = null, + Func creditAccountBalanceChanged = null, + Func prepaymentAccountBalanceChanged = null, + Func paymentCollectionMethodChanged = null, + Func itemPricePointChanged = null, + Func customFieldValueChange = null) => + Match(subscriptionProductChange, subscriptionStateChange, paymentRelatedEvents, refundSuccess, componentAllocationChange, meteredUsage, prepaidUsage, dunningStepReached, invoiceIssued, pendingCancellationChange, prepaidSubscriptionBalanceChanged, proformaInvoiceIssued, subscriptionGroupSignupEventData, creditAccountBalanceChanged, prepaymentAccountBalanceChanged, paymentCollectionMethodChanged, itemPricePointChanged, customFieldValueChange); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class SubscriptionProductChangeCase : EventEventSpecificData, ICaseValue { - public SubscriptionProductChange _value; + public SubscriptionProductChange Value; public override T Match( Func subscriptionProductChange, @@ -287,39 +317,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return subscriptionProductChange(_value); - } + Func customFieldValueChange) => + subscriptionProductChange != null ? subscriptionProductChange(Value) : default; public SubscriptionProductChangeCase Set(SubscriptionProductChange value) { - _value = value; + Value = value; return this; } public SubscriptionProductChange Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is SubscriptionProductChangeCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class SubscriptionStateChangeCase : EventEventSpecificData, ICaseValue { - public SubscriptionStateChange _value; + public SubscriptionStateChange Value; public override T Match( Func subscriptionProductChange, @@ -339,39 +367,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return subscriptionStateChange(_value); - } + Func customFieldValueChange) => + subscriptionStateChange != null ? subscriptionStateChange(Value) : default; public SubscriptionStateChangeCase Set(SubscriptionStateChange value) { - _value = value; + Value = value; return this; } public SubscriptionStateChange Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is SubscriptionStateChangeCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentRelatedEventsCase : EventEventSpecificData, ICaseValue { - public PaymentRelatedEvents _value; + public PaymentRelatedEvents Value; public override T Match( Func subscriptionProductChange, @@ -391,39 +417,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return paymentRelatedEvents(_value); - } + Func customFieldValueChange) => + paymentRelatedEvents != null ? paymentRelatedEvents(Value) : default; public PaymentRelatedEventsCase Set(PaymentRelatedEvents value) { - _value = value; + Value = value; return this; } public PaymentRelatedEvents Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentRelatedEventsCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class RefundSuccessCase : EventEventSpecificData, ICaseValue { - public RefundSuccess _value; + public RefundSuccess Value; public override T Match( Func subscriptionProductChange, @@ -443,39 +467,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return refundSuccess(_value); - } + Func customFieldValueChange) => + refundSuccess != null ? refundSuccess(Value) : default; public RefundSuccessCase Set(RefundSuccess value) { - _value = value; + Value = value; return this; } public RefundSuccess Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is RefundSuccessCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ComponentAllocationChangeCase : EventEventSpecificData, ICaseValue { - public ComponentAllocationChange _value; + public ComponentAllocationChange Value; public override T Match( Func subscriptionProductChange, @@ -495,39 +517,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return componentAllocationChange(_value); - } + Func customFieldValueChange) => + componentAllocationChange != null ? componentAllocationChange(Value) : default; public ComponentAllocationChangeCase Set(ComponentAllocationChange value) { - _value = value; + Value = value; return this; } public ComponentAllocationChange Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ComponentAllocationChangeCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class MeteredUsageCase : EventEventSpecificData, ICaseValue { - public MeteredUsage _value; + public MeteredUsage Value; public override T Match( Func subscriptionProductChange, @@ -547,39 +567,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return meteredUsage(_value); - } + Func customFieldValueChange) => + meteredUsage != null ? meteredUsage(Value) : default; public MeteredUsageCase Set(MeteredUsage value) { - _value = value; + Value = value; return this; } public MeteredUsage Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MeteredUsageCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PrepaidUsageCase : EventEventSpecificData, ICaseValue { - public PrepaidUsage _value; + public PrepaidUsage Value; public override T Match( Func subscriptionProductChange, @@ -599,39 +617,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return prepaidUsage(_value); - } + Func customFieldValueChange) => + prepaidUsage != null ? prepaidUsage(Value) : default; public PrepaidUsageCase Set(PrepaidUsage value) { - _value = value; + Value = value; return this; } public PrepaidUsage Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PrepaidUsageCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class DunningStepReachedCase : EventEventSpecificData, ICaseValue { - public DunningStepReached _value; + public DunningStepReached Value; public override T Match( Func subscriptionProductChange, @@ -651,39 +667,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return dunningStepReached(_value); - } + Func customFieldValueChange) => + dunningStepReached != null ? dunningStepReached(Value) : default; public DunningStepReachedCase Set(DunningStepReached value) { - _value = value; + Value = value; return this; } public DunningStepReached Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is DunningStepReachedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class InvoiceIssuedCase : EventEventSpecificData, ICaseValue { - public InvoiceIssued _value; + public InvoiceIssued Value; public override T Match( Func subscriptionProductChange, @@ -703,39 +717,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return invoiceIssued(_value); - } + Func customFieldValueChange) => + invoiceIssued != null ? invoiceIssued(Value) : default; public InvoiceIssuedCase Set(InvoiceIssued value) { - _value = value; + Value = value; return this; } public InvoiceIssued Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is InvoiceIssuedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PendingCancellationChangeCase : EventEventSpecificData, ICaseValue { - public PendingCancellationChange _value; + public PendingCancellationChange Value; public override T Match( Func subscriptionProductChange, @@ -755,39 +767,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return pendingCancellationChange(_value); - } + Func customFieldValueChange) => + pendingCancellationChange != null ? pendingCancellationChange(Value) : default; public PendingCancellationChangeCase Set(PendingCancellationChange value) { - _value = value; + Value = value; return this; } public PendingCancellationChange Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PendingCancellationChangeCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PrepaidSubscriptionBalanceChangedCase : EventEventSpecificData, ICaseValue { - public PrepaidSubscriptionBalanceChanged _value; + public PrepaidSubscriptionBalanceChanged Value; public override T Match( Func subscriptionProductChange, @@ -807,39 +817,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return prepaidSubscriptionBalanceChanged(_value); - } + Func customFieldValueChange) => + prepaidSubscriptionBalanceChanged != null ? prepaidSubscriptionBalanceChanged(Value) : default; public PrepaidSubscriptionBalanceChangedCase Set(PrepaidSubscriptionBalanceChanged value) { - _value = value; + Value = value; return this; } public PrepaidSubscriptionBalanceChanged Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PrepaidSubscriptionBalanceChangedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ProformaInvoiceIssuedCase : EventEventSpecificData, ICaseValue { - public ProformaInvoiceIssued _value; + public ProformaInvoiceIssued Value; public override T Match( Func subscriptionProductChange, @@ -859,39 +867,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return proformaInvoiceIssued(_value); - } + Func customFieldValueChange) => + proformaInvoiceIssued != null ? proformaInvoiceIssued(Value) : default; public ProformaInvoiceIssuedCase Set(ProformaInvoiceIssued value) { - _value = value; + Value = value; return this; } public ProformaInvoiceIssued Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ProformaInvoiceIssuedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class SubscriptionGroupSignupEventDataCase : EventEventSpecificData, ICaseValue { - public SubscriptionGroupSignupEventData _value; + public SubscriptionGroupSignupEventData Value; public override T Match( Func subscriptionProductChange, @@ -911,39 +917,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return subscriptionGroupSignupEventData(_value); - } + Func customFieldValueChange) => + subscriptionGroupSignupEventData != null ? subscriptionGroupSignupEventData(Value) : default; public SubscriptionGroupSignupEventDataCase Set(SubscriptionGroupSignupEventData value) { - _value = value; + Value = value; return this; } public SubscriptionGroupSignupEventData Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is SubscriptionGroupSignupEventDataCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreditAccountBalanceChangedCase : EventEventSpecificData, ICaseValue { - public CreditAccountBalanceChanged _value; + public CreditAccountBalanceChanged Value; public override T Match( Func subscriptionProductChange, @@ -963,39 +967,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return creditAccountBalanceChanged(_value); - } + Func customFieldValueChange) => + creditAccountBalanceChanged != null ? creditAccountBalanceChanged(Value) : default; public CreditAccountBalanceChangedCase Set(CreditAccountBalanceChanged value) { - _value = value; + Value = value; return this; } public CreditAccountBalanceChanged Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreditAccountBalanceChangedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PrepaymentAccountBalanceChangedCase : EventEventSpecificData, ICaseValue { - public PrepaymentAccountBalanceChanged _value; + public PrepaymentAccountBalanceChanged Value; public override T Match( Func subscriptionProductChange, @@ -1015,39 +1017,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return prepaymentAccountBalanceChanged(_value); - } + Func customFieldValueChange) => + prepaymentAccountBalanceChanged != null ? prepaymentAccountBalanceChanged(Value) : default; public PrepaymentAccountBalanceChangedCase Set(PrepaymentAccountBalanceChanged value) { - _value = value; + Value = value; return this; } public PrepaymentAccountBalanceChanged Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PrepaymentAccountBalanceChangedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentCollectionMethodChangedCase : EventEventSpecificData, ICaseValue { - public PaymentCollectionMethodChanged _value; + public PaymentCollectionMethodChanged Value; public override T Match( Func subscriptionProductChange, @@ -1067,39 +1067,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return paymentCollectionMethodChanged(_value); - } + Func customFieldValueChange) => + paymentCollectionMethodChanged != null ? paymentCollectionMethodChanged(Value) : default; public PaymentCollectionMethodChangedCase Set(PaymentCollectionMethodChanged value) { - _value = value; + Value = value; return this; } public PaymentCollectionMethodChanged Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentCollectionMethodChangedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ItemPricePointChangedCase : EventEventSpecificData, ICaseValue { - public ItemPricePointChanged _value; + public ItemPricePointChanged Value; public override T Match( Func subscriptionProductChange, @@ -1119,39 +1117,37 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return itemPricePointChanged(_value); - } + Func customFieldValueChange) => + itemPricePointChanged != null ? itemPricePointChanged(Value) : default; public ItemPricePointChangedCase Set(ItemPricePointChanged value) { - _value = value; + Value = value; return this; } public ItemPricePointChanged Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ItemPricePointChangedCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CustomFieldValueChangeCase : EventEventSpecificData, ICaseValue { - public CustomFieldValueChange _value; + public CustomFieldValueChange Value; public override T Match( Func subscriptionProductChange, @@ -1171,32 +1167,30 @@ public override T Match( Func prepaymentAccountBalanceChanged, Func paymentCollectionMethodChanged, Func itemPricePointChanged, - Func customFieldValueChange) - { - return customFieldValueChange(_value); - } + Func customFieldValueChange) => + customFieldValueChange != null ? customFieldValueChange(Value) : default; public CustomFieldValueChangeCase Set(CustomFieldValueChange value) { - _value = value; + Value = value; return this; } public CustomFieldValueChange Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CustomFieldValueChangeCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/InvoiceEvent.cs b/AdvancedBilling.Standard/Models/Containers/InvoiceEvent.cs index 3f7c06cb..cc9cebcc 100644 --- a/AdvancedBilling.Standard/Models/Containers/InvoiceEvent.cs +++ b/AdvancedBilling.Standard/Models/Containers/InvoiceEvent.cs @@ -14,7 +14,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(ApplyCreditNoteEventCase), typeof(ApplyDebitNoteEventCase), typeof(ApplyPaymentEventCase), @@ -31,7 +31,7 @@ namespace AdvancedBilling.Standard.Models.Containers typeof(VoidInvoiceEventCase), typeof(VoidRemainderEventCase) }, - new string[] { + new[] { "apply_credit_note", "apply_debit_note", "apply_payment", @@ -243,10 +243,37 @@ public abstract T Match( Func voidInvoiceEvent, Func voidRemainderEvent); + /// + /// Method to match from the provided any-of cases. The parameters represent + /// optional callback functions for any-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func applyCreditNoteEvent = null, + Func applyDebitNoteEvent = null, + Func applyPaymentEvent = null, + Func backportInvoiceEvent = null, + Func changeChargebackStatusEvent = null, + Func changeInvoiceCollectionMethodEvent = null, + Func changeInvoiceStatusEvent = null, + Func createCreditNoteEvent = null, + Func createDebitNoteEvent = null, + Func failedPaymentEvent = null, + Func issueInvoiceEvent = null, + Func refundInvoiceEvent = null, + Func removePaymentEvent = null, + Func voidInvoiceEvent = null, + Func voidRemainderEvent = null) => + Match(applyCreditNoteEvent, applyDebitNoteEvent, applyPaymentEvent, backportInvoiceEvent, changeChargebackStatusEvent, changeInvoiceCollectionMethodEvent, changeInvoiceStatusEvent, createCreditNoteEvent, createDebitNoteEvent, failedPaymentEvent, issueInvoiceEvent, refundInvoiceEvent, removePaymentEvent, voidInvoiceEvent, voidRemainderEvent); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ApplyCreditNoteEventCase : InvoiceEvent, ICaseValue { - public ApplyCreditNoteEvent _value; + public ApplyCreditNoteEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -263,39 +290,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return applyCreditNoteEvent(_value); - } + Func voidRemainderEvent) => + applyCreditNoteEvent != null ? applyCreditNoteEvent(Value) : default; public ApplyCreditNoteEventCase Set(ApplyCreditNoteEvent value) { - _value = value; + Value = value; return this; } public ApplyCreditNoteEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ApplyCreditNoteEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ApplyDebitNoteEventCase : InvoiceEvent, ICaseValue { - public ApplyDebitNoteEvent _value; + public ApplyDebitNoteEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -312,39 +337,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return applyDebitNoteEvent(_value); - } + Func voidRemainderEvent) => + applyDebitNoteEvent != null ? applyDebitNoteEvent(Value) : default; public ApplyDebitNoteEventCase Set(ApplyDebitNoteEvent value) { - _value = value; + Value = value; return this; } public ApplyDebitNoteEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ApplyDebitNoteEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ApplyPaymentEventCase : InvoiceEvent, ICaseValue { - public ApplyPaymentEvent _value; + public ApplyPaymentEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -361,39 +384,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return applyPaymentEvent(_value); - } + Func voidRemainderEvent) => + applyPaymentEvent != null ? applyPaymentEvent(Value) : default; public ApplyPaymentEventCase Set(ApplyPaymentEvent value) { - _value = value; + Value = value; return this; } public ApplyPaymentEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ApplyPaymentEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class BackportInvoiceEventCase : InvoiceEvent, ICaseValue { - public BackportInvoiceEvent _value; + public BackportInvoiceEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -410,39 +431,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return backportInvoiceEvent(_value); - } + Func voidRemainderEvent) => + backportInvoiceEvent != null ? backportInvoiceEvent(Value) : default; public BackportInvoiceEventCase Set(BackportInvoiceEvent value) { - _value = value; + Value = value; return this; } public BackportInvoiceEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is BackportInvoiceEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ChangeChargebackStatusEventCase : InvoiceEvent, ICaseValue { - public ChangeChargebackStatusEvent _value; + public ChangeChargebackStatusEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -459,39 +478,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return changeChargebackStatusEvent(_value); - } + Func voidRemainderEvent) => + changeChargebackStatusEvent != null ? changeChargebackStatusEvent(Value) : default; public ChangeChargebackStatusEventCase Set(ChangeChargebackStatusEvent value) { - _value = value; + Value = value; return this; } public ChangeChargebackStatusEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ChangeChargebackStatusEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ChangeInvoiceCollectionMethodEventCase : InvoiceEvent, ICaseValue { - public ChangeInvoiceCollectionMethodEvent _value; + public ChangeInvoiceCollectionMethodEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -508,39 +525,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return changeInvoiceCollectionMethodEvent(_value); - } + Func voidRemainderEvent) => + changeInvoiceCollectionMethodEvent != null ? changeInvoiceCollectionMethodEvent(Value) : default; public ChangeInvoiceCollectionMethodEventCase Set(ChangeInvoiceCollectionMethodEvent value) { - _value = value; + Value = value; return this; } public ChangeInvoiceCollectionMethodEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ChangeInvoiceCollectionMethodEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ChangeInvoiceStatusEventCase : InvoiceEvent, ICaseValue { - public ChangeInvoiceStatusEvent _value; + public ChangeInvoiceStatusEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -557,39 +572,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return changeInvoiceStatusEvent(_value); - } + Func voidRemainderEvent) => + changeInvoiceStatusEvent != null ? changeInvoiceStatusEvent(Value) : default; public ChangeInvoiceStatusEventCase Set(ChangeInvoiceStatusEvent value) { - _value = value; + Value = value; return this; } public ChangeInvoiceStatusEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ChangeInvoiceStatusEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreateCreditNoteEventCase : InvoiceEvent, ICaseValue { - public CreateCreditNoteEvent _value; + public CreateCreditNoteEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -606,39 +619,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return createCreditNoteEvent(_value); - } + Func voidRemainderEvent) => + createCreditNoteEvent != null ? createCreditNoteEvent(Value) : default; public CreateCreditNoteEventCase Set(CreateCreditNoteEvent value) { - _value = value; + Value = value; return this; } public CreateCreditNoteEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreateCreditNoteEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreateDebitNoteEventCase : InvoiceEvent, ICaseValue { - public CreateDebitNoteEvent _value; + public CreateDebitNoteEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -655,39 +666,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return createDebitNoteEvent(_value); - } + Func voidRemainderEvent) => + createDebitNoteEvent != null ? createDebitNoteEvent(Value) : default; public CreateDebitNoteEventCase Set(CreateDebitNoteEvent value) { - _value = value; + Value = value; return this; } public CreateDebitNoteEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreateDebitNoteEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class FailedPaymentEventCase : InvoiceEvent, ICaseValue { - public FailedPaymentEvent _value; + public FailedPaymentEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -704,39 +713,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return failedPaymentEvent(_value); - } + Func voidRemainderEvent) => + failedPaymentEvent != null ? failedPaymentEvent(Value) : default; public FailedPaymentEventCase Set(FailedPaymentEvent value) { - _value = value; + Value = value; return this; } public FailedPaymentEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is FailedPaymentEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class IssueInvoiceEventCase : InvoiceEvent, ICaseValue { - public IssueInvoiceEvent _value; + public IssueInvoiceEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -753,39 +760,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return issueInvoiceEvent(_value); - } + Func voidRemainderEvent) => + issueInvoiceEvent != null ? issueInvoiceEvent(Value) : default; public IssueInvoiceEventCase Set(IssueInvoiceEvent value) { - _value = value; + Value = value; return this; } public IssueInvoiceEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is IssueInvoiceEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class RefundInvoiceEventCase : InvoiceEvent, ICaseValue { - public RefundInvoiceEvent _value; + public RefundInvoiceEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -802,39 +807,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return refundInvoiceEvent(_value); - } + Func voidRemainderEvent) => + refundInvoiceEvent != null ? refundInvoiceEvent(Value) : default; public RefundInvoiceEventCase Set(RefundInvoiceEvent value) { - _value = value; + Value = value; return this; } public RefundInvoiceEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is RefundInvoiceEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class RemovePaymentEventCase : InvoiceEvent, ICaseValue { - public RemovePaymentEvent _value; + public RemovePaymentEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -851,39 +854,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return removePaymentEvent(_value); - } + Func voidRemainderEvent) => + removePaymentEvent != null ? removePaymentEvent(Value) : default; public RemovePaymentEventCase Set(RemovePaymentEvent value) { - _value = value; + Value = value; return this; } public RemovePaymentEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is RemovePaymentEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class VoidInvoiceEventCase : InvoiceEvent, ICaseValue { - public VoidInvoiceEvent _value; + public VoidInvoiceEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -900,39 +901,37 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return voidInvoiceEvent(_value); - } + Func voidRemainderEvent) => + voidInvoiceEvent != null ? voidInvoiceEvent(Value) : default; public VoidInvoiceEventCase Set(VoidInvoiceEvent value) { - _value = value; + Value = value; return this; } public VoidInvoiceEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is VoidInvoiceEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class VoidRemainderEventCase : InvoiceEvent, ICaseValue { - public VoidRemainderEvent _value; + public VoidRemainderEvent Value; public override T Match( Func applyCreditNoteEvent, @@ -949,32 +948,30 @@ public override T Match( Func refundInvoiceEvent, Func removePaymentEvent, Func voidInvoiceEvent, - Func voidRemainderEvent) - { - return voidRemainderEvent(_value); - } + Func voidRemainderEvent) => + voidRemainderEvent != null ? voidRemainderEvent(Value) : default; public VoidRemainderEventCase Set(VoidRemainderEvent value) { - _value = value; + Value = value; return this; } public VoidRemainderEvent Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is VoidRemainderEventCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/InvoiceEventPayment.cs b/AdvancedBilling.Standard/Models/Containers/InvoiceEventPayment.cs index 7c9d893f..a6268a7a 100644 --- a/AdvancedBilling.Standard/Models/Containers/InvoiceEventPayment.cs +++ b/AdvancedBilling.Standard/Models/Containers/InvoiceEventPayment.cs @@ -14,14 +14,14 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(PaymentMethodApplePayCase), typeof(PaymentMethodBankAccountCase), typeof(PaymentMethodCreditCardCase), typeof(PaymentMethodExternalCase), typeof(PaymentMethodPaypalCase) }, - new string[] { + new[] { "apple_pay", "bank_account", "credit_card", @@ -103,198 +103,205 @@ public abstract T Match( Func paymentMethodExternal, Func paymentMethodPaypal); + /// + /// Method to match from the provided any-of cases. The parameters represent + /// optional callback functions for any-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func paymentMethodApplePay = null, + Func paymentMethodBankAccount = null, + Func paymentMethodCreditCard = null, + Func paymentMethodExternal = null, + Func paymentMethodPaypal = null) => + Match(paymentMethodApplePay, paymentMethodBankAccount, paymentMethodCreditCard, paymentMethodExternal, paymentMethodPaypal); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentMethodApplePayCase : InvoiceEventPayment, ICaseValue { - public PaymentMethodApplePay _value; + public PaymentMethodApplePay Value; public override T Match( Func paymentMethodApplePay, Func paymentMethodBankAccount, Func paymentMethodCreditCard, Func paymentMethodExternal, - Func paymentMethodPaypal) - { - return paymentMethodApplePay(_value); - } + Func paymentMethodPaypal) => + paymentMethodApplePay != null ? paymentMethodApplePay(Value) : default; public PaymentMethodApplePayCase Set(PaymentMethodApplePay value) { - _value = value; + Value = value; return this; } public PaymentMethodApplePay Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentMethodApplePayCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentMethodBankAccountCase : InvoiceEventPayment, ICaseValue { - public PaymentMethodBankAccount _value; + public PaymentMethodBankAccount Value; public override T Match( Func paymentMethodApplePay, Func paymentMethodBankAccount, Func paymentMethodCreditCard, Func paymentMethodExternal, - Func paymentMethodPaypal) - { - return paymentMethodBankAccount(_value); - } + Func paymentMethodPaypal) => + paymentMethodBankAccount != null ? paymentMethodBankAccount(Value) : default; public PaymentMethodBankAccountCase Set(PaymentMethodBankAccount value) { - _value = value; + Value = value; return this; } public PaymentMethodBankAccount Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentMethodBankAccountCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentMethodCreditCardCase : InvoiceEventPayment, ICaseValue { - public PaymentMethodCreditCard _value; + public PaymentMethodCreditCard Value; public override T Match( Func paymentMethodApplePay, Func paymentMethodBankAccount, Func paymentMethodCreditCard, Func paymentMethodExternal, - Func paymentMethodPaypal) - { - return paymentMethodCreditCard(_value); - } + Func paymentMethodPaypal) => + paymentMethodCreditCard != null ? paymentMethodCreditCard(Value) : default; public PaymentMethodCreditCardCase Set(PaymentMethodCreditCard value) { - _value = value; + Value = value; return this; } public PaymentMethodCreditCard Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentMethodCreditCardCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentMethodExternalCase : InvoiceEventPayment, ICaseValue { - public PaymentMethodExternal _value; + public PaymentMethodExternal Value; public override T Match( Func paymentMethodApplePay, Func paymentMethodBankAccount, Func paymentMethodCreditCard, Func paymentMethodExternal, - Func paymentMethodPaypal) - { - return paymentMethodExternal(_value); - } + Func paymentMethodPaypal) => + paymentMethodExternal != null ? paymentMethodExternal(Value) : default; public PaymentMethodExternalCase Set(PaymentMethodExternal value) { - _value = value; + Value = value; return this; } public PaymentMethodExternal Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentMethodExternalCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaymentMethodPaypalCase : InvoiceEventPayment, ICaseValue { - public PaymentMethodPaypal _value; + public PaymentMethodPaypal Value; public override T Match( Func paymentMethodApplePay, Func paymentMethodBankAccount, Func paymentMethodCreditCard, Func paymentMethodExternal, - Func paymentMethodPaypal) - { - return paymentMethodPaypal(_value); - } + Func paymentMethodPaypal) => + paymentMethodPaypal != null ? paymentMethodPaypal(Value) : default; public PaymentMethodPaypalCase Set(PaymentMethodPaypal value) { - _value = value; + Value = value; return this; } public PaymentMethodPaypal Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaymentMethodPaypalCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/IssueServiceCreditAmount.cs b/AdvancedBilling.Standard/Models/Containers/IssueServiceCreditAmount.cs index bdcbe9be..77f89c12 100644 --- a/AdvancedBilling.Standard/Models/Containers/IssueServiceCreditAmount.cs +++ b/AdvancedBilling.Standard/Models/Containers/IssueServiceCreditAmount.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(PrecisionCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static IssueServiceCreditAmount FromString(string mString) /// public abstract T Match(Func precision, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func precision = null, Func mString = null) => + Match(precision, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : IssueServiceCreditAmount, ICaseValue { - public double _value; + public double Value; - public override T Match(Func precision, Func mString) - { - return precision(_value); - } + public override T Match(Func precision, Func mString) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : IssueServiceCreditAmount, ICaseValue { - public string _value; + public string Value; - public override T Match(Func precision, Func mString) - { - return mString(_value); - } + public override T Match(Func precision, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ListProductPricePointsInputProductId.cs b/AdvancedBilling.Standard/Models/Containers/ListProductPricePointsInputProductId.cs index 19134c61..37b24f64 100644 --- a/AdvancedBilling.Standard/Models/Containers/ListProductPricePointsInputProductId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ListProductPricePointsInputProductId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ListProductPricePointsInputProductId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ListProductPricePointsInputProductId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ListProductPricePointsInputProductId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ListUsagesInputComponentId.cs b/AdvancedBilling.Standard/Models/Containers/ListUsagesInputComponentId.cs index ac86f781..d328fd0f 100644 --- a/AdvancedBilling.Standard/Models/Containers/ListUsagesInputComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ListUsagesInputComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ListUsagesInputComponentId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ListUsagesInputComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ListUsagesInputComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ListUsagesInputSubscriptionIdOrReference.cs b/AdvancedBilling.Standard/Models/Containers/ListUsagesInputSubscriptionIdOrReference.cs index dcff2b46..676478ff 100644 --- a/AdvancedBilling.Standard/Models/Containers/ListUsagesInputSubscriptionIdOrReference.cs +++ b/AdvancedBilling.Standard/Models/Containers/ListUsagesInputSubscriptionIdOrReference.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ListUsagesInputSubscriptionIdOrReference FromString(string mString /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ListUsagesInputSubscriptionIdOrReference, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ListUsagesInputSubscriptionIdOrReference, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/MetafieldEnum.cs b/AdvancedBilling.Standard/Models/Containers/MetafieldEnum.cs index 4616ad0a..5096eaf2 100644 --- a/AdvancedBilling.Standard/Models/Containers/MetafieldEnum.cs +++ b/AdvancedBilling.Standard/Models/Containers/MetafieldEnum.cs @@ -16,7 +16,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(ListOfStringCase) }, @@ -56,71 +56,79 @@ public static MetafieldEnum FromListOfString(List listOfString) /// public abstract T Match(Func mString, Func, T> listOfString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func, T> listOfString = null) => + Match(mString, listOfString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : MetafieldEnum, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func, T> listOfString) - { - return mString(_value); - } + public override T Match(Func mString, Func, T> listOfString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter>), JTokenType.String, JTokenType.Null)] private sealed class ListOfStringCase : MetafieldEnum, ICaseValue> { - public List _value; + public List Value; - public override T Match(Func mString, Func, T> listOfString) - { - return listOfString(_value); - } + public override T Match(Func mString, Func, T> listOfString) => + listOfString != null ? listOfString(Value) : default; public ListOfStringCase Set(List value) { - _value = value; + Value = value; return this; } public List Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ListOfStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/MeteredComponentUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/MeteredComponentUnitPrice.cs index 1e024c7e..6a9bf996 100644 --- a/AdvancedBilling.Standard/Models/Containers/MeteredComponentUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/MeteredComponentUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static MeteredComponentUnitPrice FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : MeteredComponentUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : MeteredComponentUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/OnOffComponentUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/OnOffComponentUnitPrice.cs index a629a251..684d30d0 100644 --- a/AdvancedBilling.Standard/Models/Containers/OnOffComponentUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/OnOffComponentUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static OnOffComponentUnitPrice FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : OnOffComponentUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : OnOffComponentUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PaymentProfile.cs b/AdvancedBilling.Standard/Models/Containers/PaymentProfile.cs index 3368841b..ee1ac6d5 100644 --- a/AdvancedBilling.Standard/Models/Containers/PaymentProfile.cs +++ b/AdvancedBilling.Standard/Models/Containers/PaymentProfile.cs @@ -14,13 +14,13 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(ApplePayPaymentProfileCase), typeof(BankAccountPaymentProfileCase), typeof(CreditCardPaymentProfileCase), typeof(PaypalPaymentProfileCase) }, - new string[] { + new[] { "apple_pay", "bank_account", "credit_card", @@ -89,155 +89,163 @@ public abstract T Match( Func creditCardPaymentProfile, Func paypalPaymentProfile); + /// + /// Method to match from the provided any-of cases. The parameters represent + /// optional callback functions for any-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func applePayPaymentProfile = null, + Func bankAccountPaymentProfile = null, + Func creditCardPaymentProfile = null, + Func paypalPaymentProfile = null) => + Match(applePayPaymentProfile, bankAccountPaymentProfile, creditCardPaymentProfile, paypalPaymentProfile); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ApplePayPaymentProfileCase : PaymentProfile, ICaseValue { - public ApplePayPaymentProfile _value; + public ApplePayPaymentProfile Value; public override T Match( Func applePayPaymentProfile, Func bankAccountPaymentProfile, Func creditCardPaymentProfile, - Func paypalPaymentProfile) - { - return applePayPaymentProfile(_value); - } + Func paypalPaymentProfile) => + applePayPaymentProfile != null ? applePayPaymentProfile(Value) : default; public ApplePayPaymentProfileCase Set(ApplePayPaymentProfile value) { - _value = value; + Value = value; return this; } public ApplePayPaymentProfile Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ApplePayPaymentProfileCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class BankAccountPaymentProfileCase : PaymentProfile, ICaseValue { - public BankAccountPaymentProfile _value; + public BankAccountPaymentProfile Value; public override T Match( Func applePayPaymentProfile, Func bankAccountPaymentProfile, Func creditCardPaymentProfile, - Func paypalPaymentProfile) - { - return bankAccountPaymentProfile(_value); - } + Func paypalPaymentProfile) => + bankAccountPaymentProfile != null ? bankAccountPaymentProfile(Value) : default; public BankAccountPaymentProfileCase Set(BankAccountPaymentProfile value) { - _value = value; + Value = value; return this; } public BankAccountPaymentProfile Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is BankAccountPaymentProfileCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class CreditCardPaymentProfileCase : PaymentProfile, ICaseValue { - public CreditCardPaymentProfile _value; + public CreditCardPaymentProfile Value; public override T Match( Func applePayPaymentProfile, Func bankAccountPaymentProfile, Func creditCardPaymentProfile, - Func paypalPaymentProfile) - { - return creditCardPaymentProfile(_value); - } + Func paypalPaymentProfile) => + creditCardPaymentProfile != null ? creditCardPaymentProfile(Value) : default; public CreditCardPaymentProfileCase Set(CreditCardPaymentProfile value) { - _value = value; + Value = value; return this; } public CreditCardPaymentProfile Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is CreditCardPaymentProfileCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class PaypalPaymentProfileCase : PaymentProfile, ICaseValue { - public PaypalPaymentProfile _value; + public PaypalPaymentProfile Value; public override T Match( Func applePayPaymentProfile, Func bankAccountPaymentProfile, Func creditCardPaymentProfile, - Func paypalPaymentProfile) - { - return paypalPaymentProfile(_value); - } + Func paypalPaymentProfile) => + paypalPaymentProfile != null ? paypalPaymentProfile(Value) : default; public PaypalPaymentProfileCase Set(PaypalPaymentProfile value) { - _value = value; + Value = value; return this; } public PaypalPaymentProfile Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is PaypalPaymentProfileCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationMonth.cs b/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationMonth.cs index 5841b35c..29a5ad87 100644 --- a/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationMonth.cs +++ b/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationMonth.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static PaymentProfileAttributesExpirationMonth FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : PaymentProfileAttributesExpirationMonth, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : PaymentProfileAttributesExpirationMonth, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationYear.cs b/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationYear.cs index 0fee0f73..45faec9b 100644 --- a/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationYear.cs +++ b/AdvancedBilling.Standard/Models/Containers/PaymentProfileAttributesExpirationYear.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static PaymentProfileAttributesExpirationYear FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : PaymentProfileAttributesExpirationYear, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : PaymentProfileAttributesExpirationYear, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PrepaidUsageComponentUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/PrepaidUsageComponentUnitPrice.cs index 46b994e1..f1a07a4a 100644 --- a/AdvancedBilling.Standard/Models/Containers/PrepaidUsageComponentUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/PrepaidUsageComponentUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static PrepaidUsageComponentUnitPrice FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : PrepaidUsageComponentUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : PrepaidUsageComponentUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PriceEndingQuantity.cs b/AdvancedBilling.Standard/Models/Containers/PriceEndingQuantity.cs index 80f1167a..cccd3a8e 100644 --- a/AdvancedBilling.Standard/Models/Containers/PriceEndingQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/PriceEndingQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static PriceEndingQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : PriceEndingQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : PriceEndingQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PriceStartingQuantity.cs b/AdvancedBilling.Standard/Models/Containers/PriceStartingQuantity.cs index 0e37943a..ee6358c9 100644 --- a/AdvancedBilling.Standard/Models/Containers/PriceStartingQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/PriceStartingQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static PriceStartingQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : PriceStartingQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : PriceStartingQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/PriceUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/PriceUnitPrice.cs index cb5b6e30..268e7536 100644 --- a/AdvancedBilling.Standard/Models/Containers/PriceUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/PriceUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(PrecisionCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static PriceUnitPrice FromString(string mString) /// public abstract T Match(Func precision, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func precision = null, Func mString = null) => + Match(precision, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : PriceUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func precision, Func mString) - { - return precision(_value); - } + public override T Match(Func precision, Func mString) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : PriceUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func precision, Func mString) - { - return mString(_value); - } + public override T Match(Func precision, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/QuantityBasedComponentUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/QuantityBasedComponentUnitPrice.cs index d254f382..9346f92e 100644 --- a/AdvancedBilling.Standard/Models/Containers/QuantityBasedComponentUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/QuantityBasedComponentUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static QuantityBasedComponentUnitPrice FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : QuantityBasedComponentUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : QuantityBasedComponentUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ReactivateSubscriptionRequestResume.cs b/AdvancedBilling.Standard/Models/Containers/ReactivateSubscriptionRequestResume.cs index 438a7d6c..881f2879 100644 --- a/AdvancedBilling.Standard/Models/Containers/ReactivateSubscriptionRequestResume.cs +++ b/AdvancedBilling.Standard/Models/Containers/ReactivateSubscriptionRequestResume.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(BooleanCase), typeof(ResumeOptionsCase) }, @@ -55,71 +55,79 @@ public static ReactivateSubscriptionRequestResume FromResumeOptions(ResumeOption /// public abstract T Match(Func boolean, Func resumeOptions); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func boolean = null, Func resumeOptions = null) => + Match(boolean, resumeOptions); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : ReactivateSubscriptionRequestResume, ICaseValue { - public bool _value; + public bool Value; - public override T Match(Func boolean, Func resumeOptions) - { - return boolean(_value); - } + public override T Match(Func boolean, Func resumeOptions) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class ResumeOptionsCase : ReactivateSubscriptionRequestResume, ICaseValue { - public ResumeOptions _value; + public ResumeOptions Value; - public override T Match(Func boolean, Func resumeOptions) - { - return resumeOptions(_value); - } + public override T Match(Func boolean, Func resumeOptions) => + resumeOptions != null ? resumeOptions(Value) : default; public ResumeOptionsCase Set(ResumeOptions value) { - _value = value; + Value = value; return this; } public ResumeOptions Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ResumeOptionsCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointComponentId.cs b/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointComponentId.cs index 999e691e..20f6248e 100644 --- a/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ReadComponentPricePointComponentId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ReadComponentPricePointComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ReadComponentPricePointComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointPricePointId.cs index 22cdbac9..9a6a373c 100644 --- a/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ReadComponentPricePointPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ReadComponentPricePointPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ReadComponentPricePointPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ReadComponentPricePointPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointPricePointId.cs index 22445e20..d0e057ac 100644 --- a/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ReadProductPricePointPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ReadProductPricePointPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ReadProductPricePointPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointProductId.cs b/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointProductId.cs index 3d020bce..cd5cf967 100644 --- a/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointProductId.cs +++ b/AdvancedBilling.Standard/Models/Containers/ReadProductPricePointProductId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static ReadProductPricePointProductId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : ReadProductPricePointProductId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : ReadProductPricePointProductId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/RefundConsolidatedInvoiceSegmentUids.cs b/AdvancedBilling.Standard/Models/Containers/RefundConsolidatedInvoiceSegmentUids.cs index 46938bcd..abb22fdd 100644 --- a/AdvancedBilling.Standard/Models/Containers/RefundConsolidatedInvoiceSegmentUids.cs +++ b/AdvancedBilling.Standard/Models/Containers/RefundConsolidatedInvoiceSegmentUids.cs @@ -16,7 +16,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(ListOfStringCase), typeof(MStringCase) }, @@ -56,71 +56,79 @@ public static RefundConsolidatedInvoiceSegmentUids FromString(string mString) /// public abstract T Match(Func, T> listOfString, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func, T> listOfString = null, Func mString = null) => + Match(listOfString, mString); + [JsonConverter(typeof(UnionTypeCaseConverter>), JTokenType.String, JTokenType.Null)] private sealed class ListOfStringCase : RefundConsolidatedInvoiceSegmentUids, ICaseValue> { - public List _value; + public List Value; - public override T Match(Func, T> listOfString, Func mString) - { - return listOfString(_value); - } + public override T Match(Func, T> listOfString, Func mString) => + listOfString != null ? listOfString(Value) : default; public ListOfStringCase Set(List value) { - _value = value; + Value = value; return this; } public List Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ListOfStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : RefundConsolidatedInvoiceSegmentUids, ICaseValue { - public string _value; + public string Value; - public override T Match(Func, T> listOfString, Func mString) - { - return mString(_value); - } + public override T Match(Func, T> listOfString, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/RefundInvoiceRequestRefund.cs b/AdvancedBilling.Standard/Models/Containers/RefundInvoiceRequestRefund.cs index a6a9958b..785faadc 100644 --- a/AdvancedBilling.Standard/Models/Containers/RefundInvoiceRequestRefund.cs +++ b/AdvancedBilling.Standard/Models/Containers/RefundInvoiceRequestRefund.cs @@ -14,7 +14,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(RefundInvoiceCase), typeof(RefundConsolidatedInvoiceCase) }, @@ -54,71 +54,79 @@ public static RefundInvoiceRequestRefund FromRefundConsolidatedInvoice(RefundCon /// public abstract T Match(Func refundInvoice, Func refundConsolidatedInvoice); + /// + /// Method to match from the provided any-of cases. The parameters represent + /// optional callback functions for any-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func refundInvoice = null, Func refundConsolidatedInvoice = null) => + Match(refundInvoice, refundConsolidatedInvoice); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class RefundInvoiceCase : RefundInvoiceRequestRefund, ICaseValue { - public RefundInvoice _value; + public RefundInvoice Value; - public override T Match(Func refundInvoice, Func refundConsolidatedInvoice) - { - return refundInvoice(_value); - } + public override T Match(Func refundInvoice, Func refundConsolidatedInvoice) => + refundInvoice != null ? refundInvoice(Value) : default; public RefundInvoiceCase Set(RefundInvoice value) { - _value = value; + Value = value; return this; } public RefundInvoice Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is RefundInvoiceCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class RefundConsolidatedInvoiceCase : RefundInvoiceRequestRefund, ICaseValue { - public RefundConsolidatedInvoice _value; + public RefundConsolidatedInvoice Value; - public override T Match(Func refundInvoice, Func refundConsolidatedInvoice) - { - return refundConsolidatedInvoice(_value); - } + public override T Match(Func refundInvoice, Func refundConsolidatedInvoice) => + refundConsolidatedInvoice != null ? refundConsolidatedInvoice(Value) : default; public RefundConsolidatedInvoiceCase Set(RefundConsolidatedInvoice value) { - _value = value; + Value = value; return this; } public RefundConsolidatedInvoice Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is RefundConsolidatedInvoiceCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/RefundPrepaymentAmount.cs b/AdvancedBilling.Standard/Models/Containers/RefundPrepaymentAmount.cs index 80771599..3f12c2c8 100644 --- a/AdvancedBilling.Standard/Models/Containers/RefundPrepaymentAmount.cs +++ b/AdvancedBilling.Standard/Models/Containers/RefundPrepaymentAmount.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase) }, @@ -55,71 +55,79 @@ public static RefundPrepaymentAmount FromPrecision(double precision) /// public abstract T Match(Func mString, Func precision); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func precision = null) => + Match(mString, precision); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : RefundPrepaymentAmount, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func precision) - { - return mString(_value); - } + public override T Match(Func mString, Func precision) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : RefundPrepaymentAmount, ICaseValue { - public double _value; + public double Value; - public override T Match(Func mString, Func precision) - { - return precision(_value); - } + public override T Match(Func mString, Func precision) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentComponentId.cs b/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentComponentId.cs index 30208187..c674de81 100644 --- a/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static RenewalPreviewComponentComponentId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : RenewalPreviewComponentComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : RenewalPreviewComponentComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentPricePointId.cs index 06c2fa7e..ce298cef 100644 --- a/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/RenewalPreviewComponentPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static RenewalPreviewComponentPricePointId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : RenewalPreviewComponentPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : RenewalPreviewComponentPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty1Value.cs b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty1Value.cs index 08351632..e84fdb8c 100644 --- a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty1Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty1Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SegmentSegmentProperty1Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : SegmentSegmentProperty1Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SegmentSegmentProperty1Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : SegmentSegmentProperty1Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty2Value.cs b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty2Value.cs index 236e27a2..bd7210f7 100644 --- a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty2Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty2Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SegmentSegmentProperty2Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : SegmentSegmentProperty2Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SegmentSegmentProperty2Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : SegmentSegmentProperty2Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty3Value.cs b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty3Value.cs index 3a3d9ca1..be99cfa1 100644 --- a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty3Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty3Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SegmentSegmentProperty3Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : SegmentSegmentProperty3Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SegmentSegmentProperty3Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : SegmentSegmentProperty3Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty4Value.cs b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty4Value.cs index a8ce8ad7..e27dc96c 100644 --- a/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty4Value.cs +++ b/AdvancedBilling.Standard/Models/Containers/SegmentSegmentProperty4Value.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(PrecisionCase), typeof(NumberCase), @@ -83,155 +83,163 @@ public abstract T Match( Func number, Func boolean); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func mString = null, + Func precision = null, + Func number = null, + Func boolean = null) => + Match(mString, precision, number, boolean); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SegmentSegmentProperty4Value, ICaseValue { - public string _value; + public string Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return mString(_value); - } + Func boolean) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : SegmentSegmentProperty4Value, ICaseValue { - public double _value; + public double Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return precision(_value); - } + Func boolean) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SegmentSegmentProperty4Value, ICaseValue { - public int _value; + public int Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return number(_value); - } + Func boolean) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Boolean)] private sealed class BooleanCase : SegmentSegmentProperty4Value, ICaseValue { - public bool _value; + public bool Value; public override T Match( Func mString, Func precision, Func number, - Func boolean) - { - return boolean(_value); - } + Func boolean) => + boolean != null ? boolean(Value) : default; public BooleanCase Set(bool value) { - _value = value; + Value = value; return this; } public bool Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is BooleanCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionComponentAllocatedQuantity.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionComponentAllocatedQuantity.cs index f4f9a4fc..065ceec9 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionComponentAllocatedQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionComponentAllocatedQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static SubscriptionComponentAllocatedQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionComponentAllocatedQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionComponentAllocatedQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceExpirationInterval.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceExpirationInterval.cs index 41f30570..e6b50ed8 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceExpirationInterval.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceExpirationInterval.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionCustomPriceExpirationInterval FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionCustomPriceExpirationInterval, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionCustomPriceExpirationInterval, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInitialChargeInCents.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInitialChargeInCents.cs index cae6e600..a08b9c46 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInitialChargeInCents.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInitialChargeInCents.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(MLongCase) }, @@ -55,71 +55,79 @@ public static SubscriptionCustomPriceInitialChargeInCents FromLong(long mLong) /// public abstract T Match(Func mString, Func mLong); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func mLong = null) => + Match(mString, mLong); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionCustomPriceInitialChargeInCents, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func mLong) - { - return mString(_value); - } + public override T Match(Func mString, Func mLong) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class MLongCase : SubscriptionCustomPriceInitialChargeInCents, ICaseValue { - public long _value; + public long Value; - public override T Match(Func mString, Func mLong) - { - return mLong(_value); - } + public override T Match(Func mString, Func mLong) => + mLong != null ? mLong(Value) : default; public MLongCase Set(long value) { - _value = value; + Value = value; return this; } public long Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is MLongCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInterval.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInterval.cs index f34a3df6..920de419 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInterval.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceInterval.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionCustomPriceInterval FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionCustomPriceInterval, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionCustomPriceInterval, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPricePriceInCents.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPricePriceInCents.cs index 95a24c11..b54ce14a 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPricePriceInCents.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPricePriceInCents.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(MLongCase) }, @@ -55,71 +55,79 @@ public static SubscriptionCustomPricePriceInCents FromLong(long mLong) /// public abstract T Match(Func mString, Func mLong); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func mLong = null) => + Match(mString, mLong); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionCustomPricePriceInCents, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func mLong) - { - return mString(_value); - } + public override T Match(Func mString, Func mLong) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class MLongCase : SubscriptionCustomPricePriceInCents, ICaseValue { - public long _value; + public long Value; - public override T Match(Func mString, Func mLong) - { - return mLong(_value); - } + public override T Match(Func mString, Func mLong) => + mLong != null ? mLong(Value) : default; public MLongCase Set(long value) { - _value = value; + Value = value; return this; } public long Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is MLongCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialInterval.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialInterval.cs index ebdeb026..e9d28482 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialInterval.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialInterval.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionCustomPriceTrialInterval FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionCustomPriceTrialInterval, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionCustomPriceTrialInterval, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialPriceInCents.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialPriceInCents.cs index cda522ba..f58da454 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialPriceInCents.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionCustomPriceTrialPriceInCents.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(MLongCase) }, @@ -55,71 +55,79 @@ public static SubscriptionCustomPriceTrialPriceInCents FromLong(long mLong) /// public abstract T Match(Func mString, Func mLong); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func mLong = null) => + Match(mString, mLong); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionCustomPriceTrialPriceInCents, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func mLong) - { - return mString(_value); - } + public override T Match(Func mString, Func mLong) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class MLongCase : SubscriptionCustomPriceTrialPriceInCents, ICaseValue { - public long _value; + public long Value; - public override T Match(Func mString, Func mLong) - { - return mLong(_value); - } + public override T Match(Func mString, Func mLong) => + mLong != null ? mLong(Value) : default; public MLongCase Set(long value) { - _value = value; + Value = value; return this; } public long Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is MLongCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreateErrorResponseErrors.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreateErrorResponseErrors.cs index 2a869e27..31326a48 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreateErrorResponseErrors.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreateErrorResponseErrors.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(SubscriptionGroupMembersArrayErrorCase), typeof(SubscriptionGroupSingleErrorCase), typeof(MStringCase) @@ -70,114 +70,123 @@ public abstract T Match( Func subscriptionGroupSingleError, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome( + Func subscriptionGroupMembersArrayError = null, + Func subscriptionGroupSingleError = null, + Func mString = null) => + Match(subscriptionGroupMembersArrayError, subscriptionGroupSingleError, mString); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class SubscriptionGroupMembersArrayErrorCase : SubscriptionGroupCreateErrorResponseErrors, ICaseValue { - public SubscriptionGroupMembersArrayError _value; + public SubscriptionGroupMembersArrayError Value; public override T Match( Func subscriptionGroupMembersArrayError, Func subscriptionGroupSingleError, - Func mString) - { - return subscriptionGroupMembersArrayError(_value); - } + Func mString) => + subscriptionGroupMembersArrayError != null ? subscriptionGroupMembersArrayError(Value) : default; public SubscriptionGroupMembersArrayErrorCase Set(SubscriptionGroupMembersArrayError value) { - _value = value; + Value = value; return this; } public SubscriptionGroupMembersArrayError Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is SubscriptionGroupMembersArrayErrorCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class SubscriptionGroupSingleErrorCase : SubscriptionGroupCreateErrorResponseErrors, ICaseValue { - public SubscriptionGroupSingleError _value; + public SubscriptionGroupSingleError Value; public override T Match( Func subscriptionGroupMembersArrayError, Func subscriptionGroupSingleError, - Func mString) - { - return subscriptionGroupSingleError(_value); - } + Func mString) => + subscriptionGroupSingleError != null ? subscriptionGroupSingleError(Value) : default; public SubscriptionGroupSingleErrorCase Set(SubscriptionGroupSingleError value) { - _value = value; + Value = value; return this; } public SubscriptionGroupSingleError Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is SubscriptionGroupSingleErrorCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupCreateErrorResponseErrors, ICaseValue { - public string _value; + public string Value; public override T Match( Func subscriptionGroupMembersArrayError, Func subscriptionGroupSingleError, - Func mString) - { - return mString(_value); - } + Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationMonth.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationMonth.cs index d939799c..d582571f 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationMonth.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationMonth.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupCreditCardExpirationMonth FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupCreditCardExpirationMonth, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupCreditCardExpirationMonth, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationYear.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationYear.cs index 016e12eb..4373da82 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationYear.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardExpirationYear.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupCreditCardExpirationYear FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupCreditCardExpirationYear, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupCreditCardExpirationYear, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardFullNumber.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardFullNumber.cs index 93c1c236..01b3aa68 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardFullNumber.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupCreditCardFullNumber.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupCreditCardFullNumber FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupCreditCardFullNumber, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupCreditCardFullNumber, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentAllocatedQuantity.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentAllocatedQuantity.cs index 249a0906..6d8f1915 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentAllocatedQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentAllocatedQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupSignupComponentAllocatedQuantity FromNumber(int n /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupSignupComponentAllocatedQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupSignupComponentAllocatedQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentComponentId.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentComponentId.cs index 0ff102fe..b009fa70 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupSignupComponentComponentId FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupSignupComponentComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupSignupComponentComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentPricePointId.cs index 2c73ef90..319a808e 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupSignupComponentPricePointId FromNumber(int number /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupSignupComponentPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupSignupComponentPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentUnitBalance.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentUnitBalance.cs index 7321f296..d88531f1 100644 --- a/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentUnitBalance.cs +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionGroupSignupComponentUnitBalance.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static SubscriptionGroupSignupComponentUnitBalance FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : SubscriptionGroupSignupComponentUnitBalance, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : SubscriptionGroupSignupComponentUnitBalance, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/SubscriptionSnapDay.cs b/AdvancedBilling.Standard/Models/Containers/SubscriptionSnapDay.cs new file mode 100644 index 00000000..00faa1b9 --- /dev/null +++ b/AdvancedBilling.Standard/Models/Containers/SubscriptionSnapDay.cs @@ -0,0 +1,134 @@ +// +// AdvancedBilling.Standard +// +// This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). +// +using APIMatic.Core.Utilities.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; + +namespace AdvancedBilling.Standard.Models.Containers +{ + /// + /// This is a container class for one-of types. + /// + [JsonConverter( + typeof(UnionTypeConverter), + new[] { + typeof(NumberCase), + typeof(SnapDayCase) + }, + true + )] + public abstract class SubscriptionSnapDay + { + /// + /// This is Number case. + /// + /// + /// The SubscriptionSnapDay instance, wrapping the provided int value. + /// + public static SubscriptionSnapDay FromNumber(int number) + { + return new NumberCase().Set(number); + } + + /// + /// This is SnapDay case. + /// + /// + /// The SubscriptionSnapDay instance, wrapping the provided SnapDay value. + /// + public static SubscriptionSnapDay FromSnapDay(SnapDay snapDay) + { + return new SnapDayCase().Set(snapDay); + } + + /// + /// Method to match from the provided one-of cases. Here parameters + /// represents the callback functions for one-of type cases. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function. + /// + /// + public abstract T Match(Func number, Func snapDay); + + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func snapDay = null) => + Match(number, snapDay); + + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] + private sealed class NumberCase : SubscriptionSnapDay, ICaseValue + { + public int Value; + + public override T Match(Func number, Func snapDay) => + number != null ? number(Value) : default; + + public NumberCase Set(int value) + { + Value = value; + return this; + } + + public int Get() + { + return Value; + } + + public override string ToString() + { + return Value.ToString(); + } + + public override bool Equals(object obj) + { + if (!(obj is NumberCase other)) return false; + if (ReferenceEquals(this, other)) return true; + return Value == null ? other.Value == null : Value.Equals(other.Value); + } + } + + [JsonConverter(typeof(UnionTypeCaseConverter))] + private sealed class SnapDayCase : SubscriptionSnapDay, ICaseValue + { + public SnapDay Value; + + public override T Match(Func number, Func snapDay) => + snapDay != null ? snapDay(Value) : default; + + public SnapDayCase Set(SnapDay value) + { + Value = value; + return this; + } + + public SnapDay Get() + { + return Value; + } + + public override string ToString() + { + return Value.ToString(); + } + + public override bool Equals(object obj) + { + if (!(obj is SnapDayCase other)) return false; + if (ReferenceEquals(this, other)) return true; + return Value == null ? other.Value == null : Value.Equals(other.Value); + } + } + } +} \ No newline at end of file diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointComponentId.cs b/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointComponentId.cs index 79790ce8..927cac6c 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointComponentId.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointComponentId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdateComponentPricePointComponentId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdateComponentPricePointComponentId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdateComponentPricePointComponentId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointPricePointId.cs index e1064531..cfcac97a 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateComponentPricePointPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdateComponentPricePointPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdateComponentPricePointPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdateComponentPricePointPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateMetafieldsRequestMetafields.cs b/AdvancedBilling.Standard/Models/Containers/UpdateMetafieldsRequestMetafields.cs index f913465d..6cab94bb 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateMetafieldsRequestMetafields.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateMetafieldsRequestMetafields.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(UpdateMetafieldCase), typeof(ListOfUpdateMetafieldCase) }, @@ -55,71 +55,79 @@ public static UpdateMetafieldsRequestMetafields FromListOfUpdateMetafield(List public abstract T Match(Func updateMetafield, Func, T> listOfUpdateMetafield); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func updateMetafield = null, Func, T> listOfUpdateMetafield = null) => + Match(updateMetafield, listOfUpdateMetafield); + [JsonConverter(typeof(UnionTypeCaseConverter))] private sealed class UpdateMetafieldCase : UpdateMetafieldsRequestMetafields, ICaseValue { - public UpdateMetafield _value; + public UpdateMetafield Value; - public override T Match(Func updateMetafield, Func, T> listOfUpdateMetafield) - { - return updateMetafield(_value); - } + public override T Match(Func updateMetafield, Func, T> listOfUpdateMetafield) => + updateMetafield != null ? updateMetafield(Value) : default; public UpdateMetafieldCase Set(UpdateMetafield value) { - _value = value; + Value = value; return this; } public UpdateMetafield Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is UpdateMetafieldCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter>))] private sealed class ListOfUpdateMetafieldCase : UpdateMetafieldsRequestMetafields, ICaseValue> { - public List _value; + public List Value; - public override T Match(Func updateMetafield, Func, T> listOfUpdateMetafield) - { - return listOfUpdateMetafield(_value); - } + public override T Match(Func updateMetafield, Func, T> listOfUpdateMetafield) => + listOfUpdateMetafield != null ? listOfUpdateMetafield(Value) : default; public ListOfUpdateMetafieldCase Set(List value) { - _value = value; + Value = value; return this; } public List Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is ListOfUpdateMetafieldCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdatePriceEndingQuantity.cs b/AdvancedBilling.Standard/Models/Containers/UpdatePriceEndingQuantity.cs index d4e30993..90ecf64b 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdatePriceEndingQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdatePriceEndingQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdatePriceEndingQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdatePriceEndingQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdatePriceEndingQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdatePriceStartingQuantity.cs b/AdvancedBilling.Standard/Models/Containers/UpdatePriceStartingQuantity.cs index d7f03fd8..44efb252 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdatePriceStartingQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdatePriceStartingQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdatePriceStartingQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdatePriceStartingQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdatePriceStartingQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdatePriceUnitPrice.cs b/AdvancedBilling.Standard/Models/Containers/UpdatePriceUnitPrice.cs index 2165384b..ffe77bc4 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdatePriceUnitPrice.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdatePriceUnitPrice.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(PrecisionCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdatePriceUnitPrice FromString(string mString) /// public abstract T Match(Func precision, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func precision = null, Func mString = null) => + Match(precision, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Float)] private sealed class PrecisionCase : UpdatePriceUnitPrice, ICaseValue { - public double _value; + public double Value; - public override T Match(Func precision, Func mString) - { - return precision(_value); - } + public override T Match(Func precision, Func mString) => + precision != null ? precision(Value) : default; public PrecisionCase Set(double value) { - _value = value; + Value = value; return this; } public double Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is PrecisionCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdatePriceUnitPrice, ICaseValue { - public string _value; + public string Value; - public override T Match(Func precision, Func mString) - { - return mString(_value); - } + public override T Match(Func precision, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointPricePointId.cs b/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointPricePointId.cs index 8a6d2214..d85b2ba0 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointPricePointId.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointPricePointId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdateProductPricePointPricePointId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdateProductPricePointPricePointId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdateProductPricePointPricePointId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointProductId.cs b/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointProductId.cs index e9759e20..ad474a63 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointProductId.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateProductPricePointProductId.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UpdateProductPricePointProductId FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdateProductPricePointProductId, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdateProductPricePointProductId, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionNetTerms.cs b/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionNetTerms.cs index 1d55deb6..67827a4f 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionNetTerms.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionNetTerms.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(MStringCase), typeof(NumberCase) }, @@ -55,71 +55,79 @@ public static UpdateSubscriptionNetTerms FromNumber(int number) /// public abstract T Match(Func mString, Func number); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func mString = null, Func number = null) => + Match(mString, number); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UpdateSubscriptionNetTerms, ICaseValue { - public string _value; + public string Value; - public override T Match(Func mString, Func number) - { - return mString(_value); - } + public override T Match(Func mString, Func number) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UpdateSubscriptionNetTerms, ICaseValue { - public int _value; + public int Value; - public override T Match(Func mString, Func number) - { - return number(_value); - } + public override T Match(Func mString, Func number) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionSnapDay.cs b/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionSnapDay.cs index 2e2ef953..18efd1e0 100644 --- a/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionSnapDay.cs +++ b/AdvancedBilling.Standard/Models/Containers/UpdateSubscriptionSnapDay.cs @@ -15,34 +15,34 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { - typeof(SnapDayCase), - typeof(NumberCase) + new[] { + typeof(NumberCase), + typeof(SnapDayCase) }, true )] public abstract class UpdateSubscriptionSnapDay { /// - /// This is SnapDay case. + /// This is Number case. /// /// - /// The UpdateSubscriptionSnapDay instance, wrapping the provided SnapDay value. + /// The UpdateSubscriptionSnapDay instance, wrapping the provided int value. /// - public static UpdateSubscriptionSnapDay FromSnapDay(SnapDay snapDay) + public static UpdateSubscriptionSnapDay FromNumber(int number) { - return new SnapDayCase().Set(snapDay); + return new NumberCase().Set(number); } /// - /// This is Number case. + /// This is SnapDay case. /// /// - /// The UpdateSubscriptionSnapDay instance, wrapping the provided int value. + /// The UpdateSubscriptionSnapDay instance, wrapping the provided SnapDay value. /// - public static UpdateSubscriptionSnapDay FromNumber(int number) + public static UpdateSubscriptionSnapDay FromSnapDay(SnapDay snapDay) { - return new NumberCase().Set(number); + return new SnapDayCase().Set(snapDay); } /// @@ -53,73 +53,81 @@ public static UpdateSubscriptionSnapDay FromNumber(int number) /// callback function. /// /// - public abstract T Match(Func snapDay, Func number); + public abstract T Match(Func number, Func snapDay); - [JsonConverter(typeof(UnionTypeCaseConverter))] - private sealed class SnapDayCase : UpdateSubscriptionSnapDay, ICaseValue + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func snapDay = null) => + Match(number, snapDay); + + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] + private sealed class NumberCase : UpdateSubscriptionSnapDay, ICaseValue { - public SnapDay _value; + public int Value; - public override T Match(Func snapDay, Func number) - { - return snapDay(_value); - } + public override T Match(Func number, Func snapDay) => + number != null ? number(Value) : default; - public SnapDayCase Set(SnapDay value) + public NumberCase Set(int value) { - _value = value; + Value = value; return this; } - public SnapDay Get() + public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { - if (!(obj is SnapDayCase other)) return false; + if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } - [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] - private sealed class NumberCase : UpdateSubscriptionSnapDay, ICaseValue + [JsonConverter(typeof(UnionTypeCaseConverter))] + private sealed class SnapDayCase : UpdateSubscriptionSnapDay, ICaseValue { - public int _value; + public SnapDay Value; - public override T Match(Func snapDay, Func number) - { - return number(_value); - } + public override T Match(Func number, Func snapDay) => + snapDay != null ? snapDay(Value) : default; - public NumberCase Set(int value) + public SnapDayCase Set(SnapDay value) { - _value = value; + Value = value; return this; } - public int Get() + public SnapDay Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { - if (!(obj is NumberCase other)) return false; + if (!(obj is SnapDayCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } } diff --git a/AdvancedBilling.Standard/Models/Containers/UsageQuantity.cs b/AdvancedBilling.Standard/Models/Containers/UsageQuantity.cs index 54d6504b..a15fa3dd 100644 --- a/AdvancedBilling.Standard/Models/Containers/UsageQuantity.cs +++ b/AdvancedBilling.Standard/Models/Containers/UsageQuantity.cs @@ -15,7 +15,7 @@ namespace AdvancedBilling.Standard.Models.Containers /// [JsonConverter( typeof(UnionTypeConverter), - new Type[] { + new[] { typeof(NumberCase), typeof(MStringCase) }, @@ -55,71 +55,79 @@ public static UsageQuantity FromString(string mString) /// public abstract T Match(Func number, Func mString); + /// + /// Method to match from the provided one-of cases. The parameters represent + /// optional callback functions for one-of type cases. You may provide only + /// the callbacks you are interested in; others can be left as null. All + /// callback functions must have the same return type T. This typeparam T + /// represents the type that will be returned after applying the selected + /// callback function, or the default value if no callback is provided for the matched case. + /// + /// + public T MatchSome(Func number = null, Func mString = null) => + Match(number, mString); + [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.Integer)] private sealed class NumberCase : UsageQuantity, ICaseValue { - public int _value; + public int Value; - public override T Match(Func number, Func mString) - { - return number(_value); - } + public override T Match(Func number, Func mString) => + number != null ? number(Value) : default; public NumberCase Set(int value) { - _value = value; + Value = value; return this; } public int Get() { - return _value; + return Value; } public override string ToString() { - return _value.ToString(); + return Value.ToString(); } public override bool Equals(object obj) { if (!(obj is NumberCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value.Equals(other._value); + return Value == null ? other.Value == null : Value.Equals(other.Value); } } [JsonConverter(typeof(UnionTypeCaseConverter), JTokenType.String, JTokenType.Null)] private sealed class MStringCase : UsageQuantity, ICaseValue { - public string _value; + public string Value; - public override T Match(Func number, Func mString) - { - return mString(_value); - } + public override T Match(Func number, Func mString) => + mString != null ? mString(Value) : default; public MStringCase Set(string value) { - _value = value; + Value = value; return this; } public string Get() { - return _value; + return Value; } public override string ToString() { - return _value?.ToString(); + return Value?.ToString(); } public override bool Equals(object obj) { if (!(obj is MStringCase other)) return false; if (ReferenceEquals(this, other)) return true; - return _value == null ? other._value == null : _value?.Equals(other._value) == true; + return Value == null ? other.Value == null : Value?.Equals(other.Value) == true; } } } diff --git a/AdvancedBilling.Standard/Models/CreateAllocation.cs b/AdvancedBilling.Standard/Models/CreateAllocation.cs index 8aab3759..fa77a586 100644 --- a/AdvancedBilling.Standard/Models/CreateAllocation.cs +++ b/AdvancedBilling.Standard/Models/CreateAllocation.cs @@ -193,7 +193,7 @@ public CreateAllocationPricePointId PricePointId } /// - /// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled + /// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. /// [JsonProperty("billing_schedule", NullValueHandling = NullValueHandling.Ignore)] public Models.BillingSchedule BillingSchedule { get; set; } diff --git a/AdvancedBilling.Standard/Models/CreateInvoiceCoupon.cs b/AdvancedBilling.Standard/Models/CreateInvoiceCoupon.cs index b98d274e..284cfad6 100644 --- a/AdvancedBilling.Standard/Models/CreateInvoiceCoupon.cs +++ b/AdvancedBilling.Standard/Models/CreateInvoiceCoupon.cs @@ -35,6 +35,7 @@ public CreateInvoiceCoupon() /// Initializes a new instance of the class. /// /// code. + /// subcode. /// percentage. /// amount. /// description. @@ -42,6 +43,7 @@ public CreateInvoiceCoupon() /// compounding_strategy. public CreateInvoiceCoupon( string code = null, + string subcode = null, CreateInvoiceCouponPercentage percentage = null, CreateInvoiceCouponAmount amount = null, string description = null, @@ -49,6 +51,7 @@ public CreateInvoiceCoupon( Models.CompoundingStrategy? compoundingStrategy = null) { this.Code = code; + this.Subcode = subcode; this.Percentage = percentage; this.Amount = amount; this.Description = description; @@ -62,6 +65,12 @@ public CreateInvoiceCoupon( [JsonProperty("code", NullValueHandling = NullValueHandling.Ignore)] public string Code { get; set; } + /// + /// Gets or sets Subcode. + /// + [JsonProperty("subcode", NullValueHandling = NullValueHandling.Ignore)] + public string Subcode { get; set; } + /// /// Gets or sets Percentage. /// @@ -109,6 +118,8 @@ public override bool Equals(object obj) return obj is CreateInvoiceCoupon other && (this.Code == null && other.Code == null || this.Code?.Equals(other.Code) == true) && + (this.Subcode == null && other.Subcode == null || + this.Subcode?.Equals(other.Subcode) == true) && (this.Percentage == null && other.Percentage == null || this.Percentage?.Equals(other.Percentage) == true) && (this.Amount == null && other.Amount == null || @@ -129,6 +140,7 @@ public override bool Equals(object obj) protected new void ToString(List toStringOutput) { toStringOutput.Add($"Code = {this.Code ?? "null"}"); + toStringOutput.Add($"Subcode = {this.Subcode ?? "null"}"); toStringOutput.Add($"Percentage = {(this.Percentage == null ? "null" : this.Percentage.ToString())}"); toStringOutput.Add($"Amount = {(this.Amount == null ? "null" : this.Amount.ToString())}"); toStringOutput.Add($"Description = {this.Description ?? "null"}"); diff --git a/AdvancedBilling.Standard/Models/CreateInvoiceItem.cs b/AdvancedBilling.Standard/Models/CreateInvoiceItem.cs index eceae5b7..645cc65b 100644 --- a/AdvancedBilling.Standard/Models/CreateInvoiceItem.cs +++ b/AdvancedBilling.Standard/Models/CreateInvoiceItem.cs @@ -93,14 +93,13 @@ public CreateInvoiceItem( public CreateInvoiceItemUnitPrice UnitPrice { get; set; } /// - /// Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. - /// If using Avalara, a tax_code parameter must also be sent. + /// Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. If using AvaTax, a tax_code parameter must also be sent. /// [JsonProperty("taxable", NullValueHandling = NullValueHandling.Ignore)] public bool? Taxable { get; set; } /// - /// Gets or sets TaxCode. + /// A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } diff --git a/AdvancedBilling.Standard/Models/CreateMetafield.cs b/AdvancedBilling.Standard/Models/CreateMetafield.cs index b8e3621e..fb9d3d32 100644 --- a/AdvancedBilling.Standard/Models/CreateMetafield.cs +++ b/AdvancedBilling.Standard/Models/CreateMetafield.cs @@ -63,7 +63,7 @@ public CreateMetafield( public Models.MetafieldScope Scope { get; set; } /// - /// Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' + /// Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. /// [JsonProperty("input_type", NullValueHandling = NullValueHandling.Ignore)] public Models.MetafieldInput? InputType { get; set; } diff --git a/AdvancedBilling.Standard/Models/CreateOrUpdateProduct.cs b/AdvancedBilling.Standard/Models/CreateOrUpdateProduct.cs index 42de2b2b..1e6ffdd8 100644 --- a/AdvancedBilling.Standard/Models/CreateOrUpdateProduct.cs +++ b/AdvancedBilling.Standard/Models/CreateOrUpdateProduct.cs @@ -24,10 +24,12 @@ namespace AdvancedBilling.Standard.Models public class CreateOrUpdateProduct : BaseModel { private Models.IntervalUnit? trialIntervalUnit; + private Models.TrialType? trialType; private Models.ExpirationIntervalUnit? expirationIntervalUnit; private Dictionary shouldSerialize = new Dictionary { { "trial_interval_unit", false }, + { "trial_type", false }, { "expiration_interval_unit", false }, }; @@ -69,7 +71,7 @@ public CreateOrUpdateProduct( long? trialPriceInCents = null, int? trialInterval = null, Models.IntervalUnit? trialIntervalUnit = null, - string trialType = null, + Models.TrialType? trialType = null, int? expirationInterval = null, Models.ExpirationIntervalUnit? expirationIntervalUnit = null, bool? autoCreateSignupPage = null, @@ -90,7 +92,11 @@ public CreateOrUpdateProduct( { this.TrialIntervalUnit = trialIntervalUnit; } - this.TrialType = trialType; + + if (trialType != null) + { + this.TrialType = trialType; + } this.ExpirationInterval = expirationInterval; if (expirationIntervalUnit != null) @@ -126,7 +132,7 @@ public CreateOrUpdateProduct( public string AccountingCode { get; set; } /// - /// Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, please read this attribute from under the signup page. + /// Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. /// [JsonProperty("require_credit_card", NullValueHandling = NullValueHandling.Ignore)] public bool? RequireCreditCard { get; set; } @@ -180,10 +186,22 @@ public Models.IntervalUnit? TrialIntervalUnit } /// - /// Gets or sets TrialType. + /// Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. /// - [JsonProperty("trial_type", NullValueHandling = NullValueHandling.Ignore)] - public string TrialType { get; set; } + [JsonProperty("trial_type")] + public Models.TrialType? TrialType + { + get + { + return this.trialType; + } + + set + { + this.shouldSerialize["trial_type"] = true; + this.trialType = value; + } + } /// /// The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product would expire after 30 days. @@ -216,7 +234,7 @@ public Models.ExpirationIntervalUnit? ExpirationIntervalUnit public bool? AutoCreateSignupPage { get; set; } /// - /// A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } @@ -237,6 +255,14 @@ public void UnsetTrialIntervalUnit() this.shouldSerialize["trial_interval_unit"] = false; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetTrialType() + { + this.shouldSerialize["trial_type"] = false; + } + /// /// Marks the field to not be serialized. /// @@ -254,6 +280,15 @@ public bool ShouldSerializeTrialIntervalUnit() return this.shouldSerialize["trial_interval_unit"]; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeTrialType() + { + return this.shouldSerialize["trial_type"]; + } + /// /// Checks if the field should be serialized or not. /// @@ -319,7 +354,7 @@ public override bool Equals(object obj) toStringOutput.Add($"TrialPriceInCents = {(this.TrialPriceInCents == null ? "null" : this.TrialPriceInCents.ToString())}"); toStringOutput.Add($"TrialInterval = {(this.TrialInterval == null ? "null" : this.TrialInterval.ToString())}"); toStringOutput.Add($"TrialIntervalUnit = {(this.TrialIntervalUnit == null ? "null" : this.TrialIntervalUnit.ToString())}"); - toStringOutput.Add($"TrialType = {this.TrialType ?? "null"}"); + toStringOutput.Add($"TrialType = {(this.TrialType == null ? "null" : this.TrialType.ToString())}"); toStringOutput.Add($"ExpirationInterval = {(this.ExpirationInterval == null ? "null" : this.ExpirationInterval.ToString())}"); toStringOutput.Add($"ExpirationIntervalUnit = {(this.ExpirationIntervalUnit == null ? "null" : this.ExpirationIntervalUnit.ToString())}"); toStringOutput.Add($"AutoCreateSignupPage = {(this.AutoCreateSignupPage == null ? "null" : this.AutoCreateSignupPage.ToString())}"); diff --git a/AdvancedBilling.Standard/Models/CreatePaymentProfile.cs b/AdvancedBilling.Standard/Models/CreatePaymentProfile.cs index 1a69cceb..553b70a3 100644 --- a/AdvancedBilling.Standard/Models/CreatePaymentProfile.cs +++ b/AdvancedBilling.Standard/Models/CreatePaymentProfile.cs @@ -145,7 +145,7 @@ public CreatePaymentProfile( } /// - /// Token received after sending billing informations using chargify.js. + /// Token received after sending billing information using chargify.js. /// [JsonProperty("chargify_token", NullValueHandling = NullValueHandling.Ignore)] public string ChargifyToken { get; set; } @@ -241,7 +241,7 @@ public string BillingAddress2 public string BillingState { get; set; } /// - /// The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. + /// The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. /// [JsonProperty("billing_country", NullValueHandling = NullValueHandling.Ignore)] public string BillingCountry { get; set; } diff --git a/AdvancedBilling.Standard/Models/CreateProductPricePoint.cs b/AdvancedBilling.Standard/Models/CreateProductPricePoint.cs index cce7438b..0b53b77e 100644 --- a/AdvancedBilling.Standard/Models/CreateProductPricePoint.cs +++ b/AdvancedBilling.Standard/Models/CreateProductPricePoint.cs @@ -23,9 +23,11 @@ namespace AdvancedBilling.Standard.Models /// public class CreateProductPricePoint : BaseModel { + private Models.TrialType? trialType; private Models.ExpirationIntervalUnit? expirationIntervalUnit; private Dictionary shouldSerialize = new Dictionary { + { "trial_type", false }, { "expiration_interval_unit", false }, }; @@ -62,7 +64,7 @@ public CreateProductPricePoint( long? trialPriceInCents = null, int? trialInterval = null, Models.IntervalUnit? trialIntervalUnit = null, - string trialType = null, + Models.TrialType? trialType = null, long? initialChargeInCents = null, bool? initialChargeAfterTrial = null, int? expirationInterval = null, @@ -77,7 +79,11 @@ public CreateProductPricePoint( this.TrialPriceInCents = trialPriceInCents; this.TrialInterval = trialInterval; this.TrialIntervalUnit = trialIntervalUnit; - this.TrialType = trialType; + + if (trialType != null) + { + this.TrialType = trialType; + } this.InitialChargeInCents = initialChargeInCents; this.InitialChargeAfterTrial = initialChargeAfterTrial; this.ExpirationInterval = expirationInterval; @@ -138,10 +144,22 @@ public CreateProductPricePoint( public Models.IntervalUnit? TrialIntervalUnit { get; set; } /// - /// Gets or sets TrialType. + /// Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. /// - [JsonProperty("trial_type", NullValueHandling = NullValueHandling.Ignore)] - public string TrialType { get; set; } + [JsonProperty("trial_type")] + public Models.TrialType? TrialType + { + get + { + return this.trialType; + } + + set + { + this.shouldSerialize["trial_type"] = true; + this.trialType = value; + } + } /// /// The product price point initial charge, in integer cents @@ -193,6 +211,14 @@ public override string ToString() return $"CreateProductPricePoint : ({string.Join(", ", toStringOutput)})"; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetTrialType() + { + this.shouldSerialize["trial_type"] = false; + } + /// /// Marks the field to not be serialized. /// @@ -201,6 +227,15 @@ public void UnsetExpirationIntervalUnit() this.shouldSerialize["expiration_interval_unit"] = false; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeTrialType() + { + return this.shouldSerialize["trial_type"]; + } + /// /// Checks if the field should be serialized or not. /// @@ -259,7 +294,7 @@ public override bool Equals(object obj) toStringOutput.Add($"TrialPriceInCents = {(this.TrialPriceInCents == null ? "null" : this.TrialPriceInCents.ToString())}"); toStringOutput.Add($"TrialInterval = {(this.TrialInterval == null ? "null" : this.TrialInterval.ToString())}"); toStringOutput.Add($"TrialIntervalUnit = {(this.TrialIntervalUnit == null ? "null" : this.TrialIntervalUnit.ToString())}"); - toStringOutput.Add($"TrialType = {this.TrialType ?? "null"}"); + toStringOutput.Add($"TrialType = {(this.TrialType == null ? "null" : this.TrialType.ToString())}"); toStringOutput.Add($"InitialChargeInCents = {(this.InitialChargeInCents == null ? "null" : this.InitialChargeInCents.ToString())}"); toStringOutput.Add($"InitialChargeAfterTrial = {(this.InitialChargeAfterTrial == null ? "null" : this.InitialChargeAfterTrial.ToString())}"); toStringOutput.Add($"ExpirationInterval = {(this.ExpirationInterval == null ? "null" : this.ExpirationInterval.ToString())}"); diff --git a/AdvancedBilling.Standard/Models/CreateUsage.cs b/AdvancedBilling.Standard/Models/CreateUsage.cs index dbb50a79..cd812b7e 100644 --- a/AdvancedBilling.Standard/Models/CreateUsage.cs +++ b/AdvancedBilling.Standard/Models/CreateUsage.cs @@ -37,16 +37,19 @@ public CreateUsage() /// price_point_id. /// memo. /// billing_schedule. + /// custom_price. public CreateUsage( double? quantity = null, string pricePointId = null, string memo = null, - Models.BillingSchedule billingSchedule = null) + Models.BillingSchedule billingSchedule = null, + Models.ComponentCustomPrice customPrice = null) { this.Quantity = quantity; this.PricePointId = pricePointId; this.Memo = memo; this.BillingSchedule = billingSchedule; + this.CustomPrice = customPrice; } /// @@ -68,11 +71,17 @@ public CreateUsage( public string Memo { get; set; } /// - /// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled + /// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. /// [JsonProperty("billing_schedule", NullValueHandling = NullValueHandling.Ignore)] public Models.BillingSchedule BillingSchedule { get; set; } + /// + /// Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. + /// + [JsonProperty("custom_price", NullValueHandling = NullValueHandling.Ignore)] + public Models.ComponentCustomPrice CustomPrice { get; set; } + /// public override string ToString() { @@ -96,6 +105,8 @@ public override bool Equals(object obj) this.Memo?.Equals(other.Memo) == true) && (this.BillingSchedule == null && other.BillingSchedule == null || this.BillingSchedule?.Equals(other.BillingSchedule) == true) && + (this.CustomPrice == null && other.CustomPrice == null || + this.CustomPrice?.Equals(other.CustomPrice) == true) && base.Equals(obj); } @@ -109,6 +120,7 @@ public override bool Equals(object obj) toStringOutput.Add($"PricePointId = {this.PricePointId ?? "null"}"); toStringOutput.Add($"Memo = {this.Memo ?? "null"}"); toStringOutput.Add($"BillingSchedule = {(this.BillingSchedule == null ? "null" : this.BillingSchedule.ToString())}"); + toStringOutput.Add($"CustomPrice = {(this.CustomPrice == null ? "null" : this.CustomPrice.ToString())}"); base.ToString(toStringOutput); } diff --git a/AdvancedBilling.Standard/Models/EBBComponent.cs b/AdvancedBilling.Standard/Models/EBBComponent.cs index 03d53dd5..a28b14a5 100644 --- a/AdvancedBilling.Standard/Models/EBBComponent.cs +++ b/AdvancedBilling.Standard/Models/EBBComponent.cs @@ -145,7 +145,7 @@ public EBBComponent( public EBBComponentUnitPrice UnitPrice { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } diff --git a/AdvancedBilling.Standard/Models/ListCouponsFilter.cs b/AdvancedBilling.Standard/Models/ListCouponsFilter.cs index 25232b0c..0bd7fe2e 100644 --- a/AdvancedBilling.Standard/Models/ListCouponsFilter.cs +++ b/AdvancedBilling.Standard/Models/ListCouponsFilter.cs @@ -41,6 +41,7 @@ public ListCouponsFilter() /// ids. /// codes. /// use_site_exchange_rate. + /// include_archived. public ListCouponsFilter( Models.BasicDateField? dateField = null, DateTime? startDate = null, @@ -49,7 +50,8 @@ public ListCouponsFilter( DateTimeOffset? endDatetime = null, List ids = null, List codes = null, - bool? useSiteExchangeRate = null) + bool? useSiteExchangeRate = null, + bool? includeArchived = null) { this.DateField = dateField; this.StartDate = startDate; @@ -59,6 +61,7 @@ public ListCouponsFilter( this.Ids = ids; this.Codes = codes; this.UseSiteExchangeRate = useSiteExchangeRate; + this.IncludeArchived = includeArchived; } /// @@ -108,11 +111,17 @@ public ListCouponsFilter( public List Codes { get; set; } /// - /// Allows fetching coupons with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. + /// If true, restricts the list to coupons whose pricing is recalculated from the site’s current exchange rates, so their currency_prices array contains on-the-fly conversions rather than stored price records. If false, restricts the list to coupons that have manually defined amounts for each currency, ensuring the response includes the saved currency_prices entries instead of exchange-rate-derived values. Use in query `filter[use_site_exchange_rate]=true`. /// [JsonProperty("use_site_exchange_rate", NullValueHandling = NullValueHandling.Ignore)] public bool? UseSiteExchangeRate { get; set; } + /// + /// Controls returning archived coupons. + /// + [JsonProperty("include_archived", NullValueHandling = NullValueHandling.Ignore)] + public bool? IncludeArchived { get; set; } + /// public override string ToString() { @@ -144,6 +153,8 @@ public override bool Equals(object obj) this.Codes?.Equals(other.Codes) == true) && (this.UseSiteExchangeRate == null && other.UseSiteExchangeRate == null || this.UseSiteExchangeRate?.Equals(other.UseSiteExchangeRate) == true) && + (this.IncludeArchived == null && other.IncludeArchived == null || + this.IncludeArchived?.Equals(other.IncludeArchived) == true) && base.Equals(obj); } @@ -161,6 +172,7 @@ public override bool Equals(object obj) toStringOutput.Add($"Ids = {(this.Ids == null ? "null" : $"[{string.Join(", ", this.Ids)} ]")}"); toStringOutput.Add($"Codes = {(this.Codes == null ? "null" : $"[{string.Join(", ", this.Codes)} ]")}"); toStringOutput.Add($"UseSiteExchangeRate = {(this.UseSiteExchangeRate == null ? "null" : this.UseSiteExchangeRate.ToString())}"); + toStringOutput.Add($"IncludeArchived = {(this.IncludeArchived == null ? "null" : this.IncludeArchived.ToString())}"); base.ToString(toStringOutput); } diff --git a/AdvancedBilling.Standard/Models/ListMetadataForResourceTypeInput.cs b/AdvancedBilling.Standard/Models/ListMetadataForResourceTypeInput.cs index 302a6fcd..70b74c3e 100644 --- a/AdvancedBilling.Standard/Models/ListMetadataForResourceTypeInput.cs +++ b/AdvancedBilling.Standard/Models/ListMetadataForResourceTypeInput.cs @@ -71,7 +71,7 @@ public ListMetadataForResourceTypeInput( } /// - /// the resource type to which the metafields belong + /// The resource type to which the metafields belong. /// [JsonProperty("resource_type")] public Models.ResourceType ResourceType { get; set; } diff --git a/AdvancedBilling.Standard/Models/ListMetadataInput.cs b/AdvancedBilling.Standard/Models/ListMetadataInput.cs index ca72b8de..d21a486d 100644 --- a/AdvancedBilling.Standard/Models/ListMetadataInput.cs +++ b/AdvancedBilling.Standard/Models/ListMetadataInput.cs @@ -50,7 +50,7 @@ public ListMetadataInput( } /// - /// the resource type to which the metafields belong + /// The resource type to which the metafields belong. /// [JsonProperty("resource_type")] public Models.ResourceType ResourceType { get; set; } diff --git a/AdvancedBilling.Standard/Models/ListMetafieldsInput.cs b/AdvancedBilling.Standard/Models/ListMetafieldsInput.cs index 49d1bf5b..26bf1088 100644 --- a/AdvancedBilling.Standard/Models/ListMetafieldsInput.cs +++ b/AdvancedBilling.Standard/Models/ListMetafieldsInput.cs @@ -53,13 +53,13 @@ public ListMetafieldsInput( } /// - /// the resource type to which the metafields belong + /// The resource type to which the metafields belong. /// [JsonProperty("resource_type")] public Models.ResourceType ResourceType { get; set; } /// - /// filter by the name of the metafield + /// Filter by the name of the metafield. /// [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)] public string Name { get; set; } diff --git a/AdvancedBilling.Standard/Models/Metafield.cs b/AdvancedBilling.Standard/Models/Metafield.cs index 1ac392ad..a14058d7 100644 --- a/AdvancedBilling.Standard/Models/Metafield.cs +++ b/AdvancedBilling.Standard/Models/Metafield.cs @@ -85,13 +85,13 @@ public Metafield( public Models.MetafieldScope Scope { get; set; } /// - /// the amount of subscriptions this metafield has been applied to in Chargify + /// The amount of subscriptions this metafield has been applied to in Advanced Billing. /// [JsonProperty("data_count", NullValueHandling = NullValueHandling.Ignore)] public int? DataCount { get; set; } /// - /// Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' + /// Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. /// [JsonProperty("input_type", NullValueHandling = NullValueHandling.Ignore)] public Models.MetafieldInput? InputType { get; set; } diff --git a/AdvancedBilling.Standard/Models/MetafieldScope.cs b/AdvancedBilling.Standard/Models/MetafieldScope.cs index 98623ad1..cf571a48 100644 --- a/AdvancedBilling.Standard/Models/MetafieldScope.cs +++ b/AdvancedBilling.Standard/Models/MetafieldScope.cs @@ -83,13 +83,13 @@ public MetafieldScope( public Models.IncludeOption? Portal { get; set; } /// - /// Include (1) or exclude (0) metafields from being viewable by your ecosystem. + /// Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being viewable by your ecosystem. /// [JsonProperty("public_show", NullValueHandling = NullValueHandling.Ignore)] public Models.IncludeOption? PublicShow { get; set; } /// - /// Include (1) or exclude (0) metafields from being edited by your ecosystem. + /// Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being editable by your ecosystem. /// [JsonProperty("public_edit", NullValueHandling = NullValueHandling.Ignore)] public Models.IncludeOption? PublicEdit { get; set; } diff --git a/AdvancedBilling.Standard/Models/MeteredComponent.cs b/AdvancedBilling.Standard/Models/MeteredComponent.cs index 22c79730..de95d322 100644 --- a/AdvancedBilling.Standard/Models/MeteredComponent.cs +++ b/AdvancedBilling.Standard/Models/MeteredComponent.cs @@ -151,7 +151,7 @@ public MeteredComponent( public MeteredComponentUnitPrice UnitPrice { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } diff --git a/AdvancedBilling.Standard/Models/OnOffComponent.cs b/AdvancedBilling.Standard/Models/OnOffComponent.cs index 643eb5c0..694d1b0e 100644 --- a/AdvancedBilling.Standard/Models/OnOffComponent.cs +++ b/AdvancedBilling.Standard/Models/OnOffComponent.cs @@ -180,7 +180,7 @@ public Models.CreditType? DowngradeCredit public OnOffComponentUnitPrice UnitPrice { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } diff --git a/AdvancedBilling.Standard/Models/PaymentProfileAttributes.cs b/AdvancedBilling.Standard/Models/PaymentProfileAttributes.cs index 75d15292..77e57f71 100644 --- a/AdvancedBilling.Standard/Models/PaymentProfileAttributes.cs +++ b/AdvancedBilling.Standard/Models/PaymentProfileAttributes.cs @@ -220,7 +220,7 @@ public string BillingAddress2 public string BillingState { get; set; } /// - /// (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. + /// (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. /// [JsonProperty("billing_country", NullValueHandling = NullValueHandling.Ignore)] public string BillingCountry { get; set; } diff --git a/AdvancedBilling.Standard/Models/PrepaidUsageComponent.cs b/AdvancedBilling.Standard/Models/PrepaidUsageComponent.cs index dfa1b231..53bf45cb 100644 --- a/AdvancedBilling.Standard/Models/PrepaidUsageComponent.cs +++ b/AdvancedBilling.Standard/Models/PrepaidUsageComponent.cs @@ -216,7 +216,7 @@ public Models.CreditType? DowngradeCredit public PrepaidUsageComponentUnitPrice UnitPrice { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } diff --git a/AdvancedBilling.Standard/Models/Product.cs b/AdvancedBilling.Standard/Models/Product.cs index 79fe7427..57bc4fe6 100644 --- a/AdvancedBilling.Standard/Models/Product.cs +++ b/AdvancedBilling.Standard/Models/Product.cs @@ -327,7 +327,7 @@ public string AccountingCode } /// - /// Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, please read this attribute from under the signup page. + /// Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. /// [JsonProperty("request_credit_card", NullValueHandling = NullValueHandling.Ignore)] public bool? RequestCreditCard { get; set; } @@ -618,7 +618,7 @@ public string UpdateReturnParams public bool? RequireShippingAddress { get; set; } /// - /// A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code")] public string TaxCode diff --git a/AdvancedBilling.Standard/Models/ProductPricePoint.cs b/AdvancedBilling.Standard/Models/ProductPricePoint.cs index 3dfd247f..6f223f95 100644 --- a/AdvancedBilling.Standard/Models/ProductPricePoint.cs +++ b/AdvancedBilling.Standard/Models/ProductPricePoint.cs @@ -27,6 +27,7 @@ public class ProductPricePoint : BaseModel private long? trialPriceInCents; private int? trialInterval; private Models.IntervalUnit? trialIntervalUnit; + private Models.TrialType? trialType; private bool? introductoryOffer; private long? initialChargeInCents; private bool? initialChargeAfterTrial; @@ -40,6 +41,7 @@ public class ProductPricePoint : BaseModel { "trial_price_in_cents", false }, { "trial_interval", false }, { "trial_interval_unit", false }, + { "trial_type", false }, { "introductory_offer", false }, { "initial_charge_in_cents", false }, { "initial_charge_after_trial", false }, @@ -93,7 +95,7 @@ public ProductPricePoint( long? trialPriceInCents = null, int? trialInterval = null, Models.IntervalUnit? trialIntervalUnit = null, - string trialType = null, + Models.TrialType? trialType = null, bool? introductoryOffer = null, long? initialChargeInCents = null, bool? initialChargeAfterTrial = null, @@ -134,7 +136,11 @@ public ProductPricePoint( { this.TrialIntervalUnit = trialIntervalUnit; } - this.TrialType = trialType; + + if (trialType != null) + { + this.TrialType = trialType; + } if (introductoryOffer != null) { @@ -282,10 +288,22 @@ public Models.IntervalUnit? TrialIntervalUnit } /// - /// Gets or sets TrialType. + /// Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. /// - [JsonProperty("trial_type", NullValueHandling = NullValueHandling.Ignore)] - public string TrialType { get; set; } + [JsonProperty("trial_type")] + public Models.TrialType? TrialType + { + get + { + return this.trialType; + } + + set + { + this.shouldSerialize["trial_type"] = true; + this.trialType = value; + } + } /// /// reserved for future use @@ -498,6 +516,14 @@ public void UnsetTrialIntervalUnit() this.shouldSerialize["trial_interval_unit"] = false; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetTrialType() + { + this.shouldSerialize["trial_type"] = false; + } + /// /// Marks the field to not be serialized. /// @@ -590,6 +616,15 @@ public bool ShouldSerializeTrialIntervalUnit() return this.shouldSerialize["trial_interval_unit"]; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeTrialType() + { + return this.shouldSerialize["trial_type"]; + } + /// /// Checks if the field should be serialized or not. /// @@ -726,7 +761,7 @@ public override bool Equals(object obj) toStringOutput.Add($"TrialPriceInCents = {(this.TrialPriceInCents == null ? "null" : this.TrialPriceInCents.ToString())}"); toStringOutput.Add($"TrialInterval = {(this.TrialInterval == null ? "null" : this.TrialInterval.ToString())}"); toStringOutput.Add($"TrialIntervalUnit = {(this.TrialIntervalUnit == null ? "null" : this.TrialIntervalUnit.ToString())}"); - toStringOutput.Add($"TrialType = {this.TrialType ?? "null"}"); + toStringOutput.Add($"TrialType = {(this.TrialType == null ? "null" : this.TrialType.ToString())}"); toStringOutput.Add($"IntroductoryOffer = {(this.IntroductoryOffer == null ? "null" : this.IntroductoryOffer.ToString())}"); toStringOutput.Add($"InitialChargeInCents = {(this.InitialChargeInCents == null ? "null" : this.InitialChargeInCents.ToString())}"); toStringOutput.Add($"InitialChargeAfterTrial = {(this.InitialChargeAfterTrial == null ? "null" : this.InitialChargeAfterTrial.ToString())}"); diff --git a/AdvancedBilling.Standard/Models/QuantityBasedComponent.cs b/AdvancedBilling.Standard/Models/QuantityBasedComponent.cs index 197f5027..83c50c73 100644 --- a/AdvancedBilling.Standard/Models/QuantityBasedComponent.cs +++ b/AdvancedBilling.Standard/Models/QuantityBasedComponent.cs @@ -210,7 +210,7 @@ public Models.CreditType? DowngradeCredit public QuantityBasedComponentUnitPrice UnitPrice { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code", NullValueHandling = NullValueHandling.Ignore)] public string TaxCode { get; set; } diff --git a/AdvancedBilling.Standard/Models/ResumeOptions.cs b/AdvancedBilling.Standard/Models/ResumeOptions.cs index ebc72826..efa2c9e3 100644 --- a/AdvancedBilling.Standard/Models/ResumeOptions.cs +++ b/AdvancedBilling.Standard/Models/ResumeOptions.cs @@ -44,7 +44,7 @@ public ResumeOptions( } /// - /// Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in it's current state. + /// Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in its current state. /// [JsonProperty("require_resume", NullValueHandling = NullValueHandling.Ignore)] public bool? RequireResume { get; set; } diff --git a/AdvancedBilling.Standard/Models/Subscription.cs b/AdvancedBilling.Standard/Models/Subscription.cs index 46c57d06..4a230609 100644 --- a/AdvancedBilling.Standard/Models/Subscription.cs +++ b/AdvancedBilling.Standard/Models/Subscription.cs @@ -12,6 +12,7 @@ using System.Threading.Tasks; using APIMatic.Core.Utilities.Converters; using AdvancedBilling.Standard; +using AdvancedBilling.Standard.Models.Containers; using AdvancedBilling.Standard.Utilities; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -36,7 +37,7 @@ public class Subscription : BaseModel private DateTimeOffset? currentPeriodStartedAt; private DateTimeOffset? delayedCancelAt; private string couponCode; - private string snapDay; + private SubscriptionSnapDay snapDay; private Models.NestedSubscriptionGroup mGroup; private string paymentType; private string referralCode; @@ -194,7 +195,7 @@ public Subscription( string signupRevenue = null, DateTimeOffset? delayedCancelAt = null, string couponCode = null, - string snapDay = null, + SubscriptionSnapDay snapDay = null, Models.CollectionMethod? paymentCollectionMethod = null, Models.Customer customer = null, Models.Product product = null, @@ -771,7 +772,7 @@ public string CouponCode /// The day of the month that the subscription will charge according to calendar billing rules, if used. /// [JsonProperty("snap_day")] - public string SnapDay + public SubscriptionSnapDay SnapDay { get { @@ -1023,7 +1024,7 @@ public int? PayerId } /// - /// The balance in cents plus the estimated renewal amount in cents. Returned ONLY for readSubscription operation as it's compute intensive operation. + /// The balance in cents plus the estimated renewal amount in cents. Returned ONLY for the readSubscription operation as it's a compute intensive operation. /// [JsonProperty("current_billing_amount_in_cents", NullValueHandling = NullValueHandling.Ignore)] public long? CurrentBillingAmountInCents { get; set; } @@ -2035,7 +2036,7 @@ public override bool Equals(object obj) toStringOutput.Add($"SignupRevenue = {this.SignupRevenue ?? "null"}"); toStringOutput.Add($"DelayedCancelAt = {(this.DelayedCancelAt == null ? "null" : this.DelayedCancelAt.ToString())}"); toStringOutput.Add($"CouponCode = {this.CouponCode ?? "null"}"); - toStringOutput.Add($"SnapDay = {this.SnapDay ?? "null"}"); + toStringOutput.Add($"SnapDay = {(this.SnapDay == null ? "null" : this.SnapDay.ToString())}"); toStringOutput.Add($"PaymentCollectionMethod = {(this.PaymentCollectionMethod == null ? "null" : this.PaymentCollectionMethod.ToString())}"); toStringOutput.Add($"Customer = {(this.Customer == null ? "null" : this.Customer.ToString())}"); toStringOutput.Add($"Product = {(this.Product == null ? "null" : this.Product.ToString())}"); diff --git a/AdvancedBilling.Standard/Models/SubscriptionCustomPrice.cs b/AdvancedBilling.Standard/Models/SubscriptionCustomPrice.cs index 9a669c18..42ae840f 100644 --- a/AdvancedBilling.Standard/Models/SubscriptionCustomPrice.cs +++ b/AdvancedBilling.Standard/Models/SubscriptionCustomPrice.cs @@ -24,9 +24,11 @@ namespace AdvancedBilling.Standard.Models /// public class SubscriptionCustomPrice : BaseModel { + private Models.TrialType? trialType; private Models.ExpirationIntervalUnit? expirationIntervalUnit; private Dictionary shouldSerialize = new Dictionary { + { "trial_type", false }, { "expiration_interval_unit", false }, }; @@ -48,6 +50,7 @@ public SubscriptionCustomPrice() /// trial_price_in_cents. /// trial_interval. /// trial_interval_unit. + /// trial_type. /// initial_charge_in_cents. /// initial_charge_after_trial. /// expiration_interval. @@ -62,6 +65,7 @@ public SubscriptionCustomPrice( SubscriptionCustomPriceTrialPriceInCents trialPriceInCents = null, SubscriptionCustomPriceTrialInterval trialInterval = null, Models.IntervalUnit? trialIntervalUnit = null, + Models.TrialType? trialType = null, SubscriptionCustomPriceInitialChargeInCents initialChargeInCents = null, bool? initialChargeAfterTrial = null, SubscriptionCustomPriceExpirationInterval expirationInterval = null, @@ -76,6 +80,11 @@ public SubscriptionCustomPrice( this.TrialPriceInCents = trialPriceInCents; this.TrialInterval = trialInterval; this.TrialIntervalUnit = trialIntervalUnit; + + if (trialType != null) + { + this.TrialType = trialType; + } this.InitialChargeInCents = initialChargeInCents; this.InitialChargeAfterTrial = initialChargeAfterTrial; this.ExpirationInterval = expirationInterval; @@ -135,6 +144,24 @@ public SubscriptionCustomPrice( [JsonProperty("trial_interval_unit", NullValueHandling = NullValueHandling.Ignore)] public Models.IntervalUnit? TrialIntervalUnit { get; set; } + /// + /// Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. + /// + [JsonProperty("trial_type")] + public Models.TrialType? TrialType + { + get + { + return this.trialType; + } + + set + { + this.shouldSerialize["trial_type"] = true; + this.trialType = value; + } + } + /// /// (Optional) /// @@ -185,6 +212,14 @@ public override string ToString() return $"SubscriptionCustomPrice : ({string.Join(", ", toStringOutput)})"; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetTrialType() + { + this.shouldSerialize["trial_type"] = false; + } + /// /// Marks the field to not be serialized. /// @@ -193,6 +228,15 @@ public void UnsetExpirationIntervalUnit() this.shouldSerialize["expiration_interval_unit"] = false; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeTrialType() + { + return this.shouldSerialize["trial_type"]; + } + /// /// Checks if the field should be serialized or not. /// @@ -225,6 +269,8 @@ public override bool Equals(object obj) this.TrialInterval?.Equals(other.TrialInterval) == true) && (this.TrialIntervalUnit == null && other.TrialIntervalUnit == null || this.TrialIntervalUnit?.Equals(other.TrialIntervalUnit) == true) && + (this.TrialType == null && other.TrialType == null || + this.TrialType?.Equals(other.TrialType) == true) && (this.InitialChargeInCents == null && other.InitialChargeInCents == null || this.InitialChargeInCents?.Equals(other.InitialChargeInCents) == true) && (this.InitialChargeAfterTrial == null && other.InitialChargeAfterTrial == null || @@ -252,6 +298,7 @@ public override bool Equals(object obj) toStringOutput.Add($"TrialPriceInCents = {(this.TrialPriceInCents == null ? "null" : this.TrialPriceInCents.ToString())}"); toStringOutput.Add($"TrialInterval = {(this.TrialInterval == null ? "null" : this.TrialInterval.ToString())}"); toStringOutput.Add($"TrialIntervalUnit = {(this.TrialIntervalUnit == null ? "null" : this.TrialIntervalUnit.ToString())}"); + toStringOutput.Add($"TrialType = {(this.TrialType == null ? "null" : this.TrialType.ToString())}"); toStringOutput.Add($"InitialChargeInCents = {(this.InitialChargeInCents == null ? "null" : this.InitialChargeInCents.ToString())}"); toStringOutput.Add($"InitialChargeAfterTrial = {(this.InitialChargeAfterTrial == null ? "null" : this.InitialChargeAfterTrial.ToString())}"); toStringOutput.Add($"ExpirationInterval = {(this.ExpirationInterval == null ? "null" : this.ExpirationInterval.ToString())}"); diff --git a/AdvancedBilling.Standard/Models/TrialType.cs b/AdvancedBilling.Standard/Models/TrialType.cs new file mode 100644 index 00000000..d3f69fed --- /dev/null +++ b/AdvancedBilling.Standard/Models/TrialType.cs @@ -0,0 +1,36 @@ +// +// AdvancedBilling.Standard +// +// This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). +// +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using APIMatic.Core.Utilities.Converters; +using AdvancedBilling.Standard; +using AdvancedBilling.Standard.Utilities; +using Newtonsoft.Json; + +namespace AdvancedBilling.Standard.Models +{ + /// + /// TrialType. + /// + + [JsonConverter(typeof(StringEnumConverter))] + public enum TrialType + { + /// + /// NoObligation. + /// + [EnumMember(Value = "no_obligation")] + NoObligation, + + /// + /// PaymentExpected. + /// + [EnumMember(Value = "payment_expected")] + PaymentExpected + } +} \ No newline at end of file diff --git a/AdvancedBilling.Standard/Models/UpdateComponent.cs b/AdvancedBilling.Standard/Models/UpdateComponent.cs index 12de6e9b..7aaee53c 100644 --- a/AdvancedBilling.Standard/Models/UpdateComponent.cs +++ b/AdvancedBilling.Standard/Models/UpdateComponent.cs @@ -153,7 +153,7 @@ public string AccountingCode public bool? Taxable { get; set; } /// - /// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. + /// A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. /// [JsonProperty("tax_code")] public string TaxCode diff --git a/AdvancedBilling.Standard/Models/UpdateMetafield.cs b/AdvancedBilling.Standard/Models/UpdateMetafield.cs index cfabd699..a5f65c83 100644 --- a/AdvancedBilling.Standard/Models/UpdateMetafield.cs +++ b/AdvancedBilling.Standard/Models/UpdateMetafield.cs @@ -73,13 +73,13 @@ public UpdateMetafield( public Models.MetafieldScope Scope { get; set; } /// - /// Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' + /// Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. /// [JsonProperty("input_type", NullValueHandling = NullValueHandling.Ignore)] public Models.MetafieldInput? InputType { get; set; } /// - /// Only applicable when input_type is radio or dropdown + /// Only applicable when input_type is radio or dropdown. /// [JsonConverter(typeof(CoreListConverter), typeof(JsonStringConverter))] [JsonProperty("enum", NullValueHandling = NullValueHandling.Ignore)] diff --git a/AdvancedBilling.Standard/Models/UpdatePaymentProfile.cs b/AdvancedBilling.Standard/Models/UpdatePaymentProfile.cs index b0a94527..36b0f8bf 100644 --- a/AdvancedBilling.Standard/Models/UpdatePaymentProfile.cs +++ b/AdvancedBilling.Standard/Models/UpdatePaymentProfile.cs @@ -153,7 +153,7 @@ public UpdatePaymentProfile( public string BillingZip { get; set; } /// - /// The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. + /// The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. /// [JsonProperty("billing_country", NullValueHandling = NullValueHandling.Ignore)] public string BillingCountry { get; set; } diff --git a/AdvancedBilling.Standard/Models/UpdateSubscription.cs b/AdvancedBilling.Standard/Models/UpdateSubscription.cs index f3aea160..5e72e80a 100644 --- a/AdvancedBilling.Standard/Models/UpdateSubscription.cs +++ b/AdvancedBilling.Standard/Models/UpdateSubscription.cs @@ -24,9 +24,11 @@ namespace AdvancedBilling.Standard.Models /// public class UpdateSubscription : BaseModel { + private UpdateSubscriptionSnapDay snapDay; private string dunningCommunicationDelayTimeZone; private Dictionary shouldSerialize = new Dictionary { + { "snap_day", false }, { "dunning_communication_delay_time_zone", false }, }; @@ -92,7 +94,11 @@ public UpdateSubscription( this.ProductChangeDelayed = productChangeDelayed; this.NextProductId = nextProductId; this.NextProductPricePointId = nextProductPricePointId; - this.SnapDay = snapDay; + + if (snapDay != null) + { + this.SnapDay = snapDay; + } this.InitialBillingAt = initialBillingAt; this.DeferSignup = deferSignup; this.NextBillingAt = nextBillingAt; @@ -153,8 +159,20 @@ public UpdateSubscription( /// /// Use for subscriptions with product eligible for calendar billing only. Value can be 1-28 or 'end'. /// - [JsonProperty("snap_day", NullValueHandling = NullValueHandling.Ignore)] - public UpdateSubscriptionSnapDay SnapDay { get; set; } + [JsonProperty("snap_day")] + public UpdateSubscriptionSnapDay SnapDay + { + get + { + return this.snapDay; + } + + set + { + this.shouldSerialize["snap_day"] = true; + this.snapDay = value; + } + } /// /// (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. It can be canceled, allocated to, or have its billing date changed. etc. When the `initial_billing_at` date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. You can omit the initial_billing_at date to activate the subscription immediately. See the [subscription import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format) documentation for more information about Date/Time formats. @@ -269,6 +287,14 @@ public override string ToString() return $"UpdateSubscription : ({string.Join(", ", toStringOutput)})"; } + /// + /// Marks the field to not be serialized. + /// + public void UnsetSnapDay() + { + this.shouldSerialize["snap_day"] = false; + } + /// /// Marks the field to not be serialized. /// @@ -277,6 +303,15 @@ public void UnsetDunningCommunicationDelayTimeZone() this.shouldSerialize["dunning_communication_delay_time_zone"] = false; } + /// + /// Checks if the field should be serialized or not. + /// + /// A boolean weather the field should be serialized or not. + public bool ShouldSerializeSnapDay() + { + return this.shouldSerialize["snap_day"]; + } + /// /// Checks if the field should be serialized or not. /// diff --git a/AdvancedBilling.sln b/AdvancedBilling.sln index 662e28ef..619f3c9a 100644 --- a/AdvancedBilling.sln +++ b/AdvancedBilling.sln @@ -2,7 +2,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.26430.14 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedBilling.Standard", "AdvancedBilling.Standard/AdvancedBilling.Standard.csproj", "{cd90c6fa-6e72-47b3-bb97-69758ee23b9d}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdvancedBilling.Standard", "AdvancedBilling.Standard/AdvancedBilling.Standard.csproj", "{5775dd65-212e-4a64-b81e-4dc69a724096}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -10,10 +10,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {cd90c6fa-6e72-47b3-bb97-69758ee23b9d}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {cd90c6fa-6e72-47b3-bb97-69758ee23b9d}.Debug|Any CPU.Build.0 = Debug|Any CPU - {cd90c6fa-6e72-47b3-bb97-69758ee23b9d}.Release|Any CPU.ActiveCfg = Release|Any CPU - {cd90c6fa-6e72-47b3-bb97-69758ee23b9d}.Release|Any CPU.Build.0 = Release|Any CPU + {5775dd65-212e-4a64-b81e-4dc69a724096}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5775dd65-212e-4a64-b81e-4dc69a724096}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5775dd65-212e-4a64-b81e-4dc69a724096}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5775dd65-212e-4a64-b81e-4dc69a724096}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index e94b133c..22f31fcf 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,15 @@ curl -u :x -H Accept:application/json -H Content-Type:application/json If you are building with .NET CLI tools then you can also use the following command: ```bash -dotnet add package Maxio.AdvancedBillingSdk --version 7.0.1 +dotnet add package Maxio.AdvancedBillingSdk --version 8.0.0 ``` You can also view the package at: -https://www.nuget.org/packages/Maxio.AdvancedBillingSdk/7.0.1 +https://www.nuget.org/packages/Maxio.AdvancedBillingSdk/8.0.0 ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/client.md) The following parameters are configurable for the API Client: @@ -46,11 +46,13 @@ The following parameters are configurable for the API Client: | Site | `string` | The subdomain for your Advanced Billing site.
*Default*: `"subdomain"` | | Environment | `Environment` | The API environment.
**Default: `Environment.US`** | | Timeout | `TimeSpan` | Http client timeout.
*Default*: `TimeSpan.FromSeconds(120)` | -| HttpClientConfiguration | [`Action`](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-client-configuration-builder.md) | Action delegate that configures the HTTP client by using the HttpClientConfiguration.Builder for customizing API call settings.
*Default*: `new HttpClient()` | -| BasicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | +| HttpClientConfiguration | [`Action`](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-client-configuration-builder.md) | Action delegate that configures the HTTP client by using the HttpClientConfiguration.Builder for customizing API call settings.
*Default*: `new HttpClient()` | +| BasicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | The API client can be initialized as follows: +### Code-Based Initialization + ```csharp using AdvancedBilling.Standard; using AdvancedBilling.Standard.Authentication; @@ -69,6 +71,27 @@ AdvancedBillingClient client = new AdvancedBillingClient.Builder() .Build(); ``` +### Configuration-Based Initialization + +```csharp +using AdvancedBilling.Standard; +using Microsoft.Extensions.Configuration; + +namespace ConsoleApp; + +// Build the IConfiguration using .NET conventions (JSON, environment, etc.) +var configuration = new ConfigurationBuilder() + .AddJsonFile("config.json") + .AddEnvironmentVariables() // [optional] read environment variables + .Build(); + +// Instantiate your SDK and configure it from IConfiguration +var client = AdvancedBillingClient + .FromConfiguration(configuration.GetSection("AdvancedBilling")); +``` + +See the [Configuration-Based Initialization](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/configuration-based-initialization.md) section for details. + ## Environments The SDK can be configured to use a different environment for making API calls. Available environments are: @@ -84,63 +107,64 @@ The SDK can be configured to use a different environment for making API calls. A This API uses the following authentication schemes. -* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/billing-portal.md) +* [Component Price Points](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/component-price-points.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-products.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/controllers/webhooks.md) ## SDK Infrastructure ### Configuration -* [HttpClientConfiguration](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-client-configuration.md) -* [HttpClientConfigurationBuilder](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-client-configuration-builder.md) -* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/proxy-configuration-builder.md) +* [Configuration-Based Initialization](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/configuration-based-initialization.md) +* [HttpClientConfiguration](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-client-configuration.md) +* [HttpClientConfigurationBuilder](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-client-configuration-builder.md) +* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/proxy-configuration-builder.md) ### HTTP -* [HttpCallback](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-callback.md) -* [HttpContext](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-context.md) -* [HttpRequest](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-request.md) -* [HttpResponse](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-response.md) -* [HttpStringResponse](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/http-string-response.md) +* [HttpCallback](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-callback.md) +* [HttpContext](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-context.md) +* [HttpRequest](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-request.md) +* [HttpResponse](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-response.md) +* [HttpStringResponse](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/http-string-response.md) ### Utilities -* [ApiException](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/api-exception.md) -* [ApiHelper](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/api-helper.md) -* [CustomDateTimeConverter](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/custom-date-time-converter.md) -* [UnixDateTimeConverter](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/7.0.1/doc/unix-date-time-converter.md) +* [ApiException](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/api-exception.md) +* [ApiHelper](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/api-helper.md) +* [CustomDateTimeConverter](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/custom-date-time-converter.md) +* [UnixDateTimeConverter](https://www.github.com/maxio-com/ab-dotnet-sdk/tree/8.0.0/doc/unix-date-time-converter.md) diff --git a/doc/client.md b/doc/client.md index a7d02132..81c8e2db 100644 --- a/doc/client.md +++ b/doc/client.md @@ -13,6 +13,8 @@ The following parameters are configurable for the API Client: The API client can be initialized as follows: +## Code-Based Initialization + ```csharp using AdvancedBilling.Standard; using AdvancedBilling.Standard.Authentication; @@ -31,6 +33,27 @@ AdvancedBillingClient client = new AdvancedBillingClient.Builder() .Build(); ``` +## Configuration-Based Initialization + +```csharp +using AdvancedBilling.Standard; +using Microsoft.Extensions.Configuration; + +namespace ConsoleApp; + +// Build the IConfiguration using .NET conventions (JSON, environment, etc.) +var configuration = new ConfigurationBuilder() + .AddJsonFile("config.json") + .AddEnvironmentVariables() // [optional] read environment variables + .Build(); + +// Instantiate your SDK and configure it from IConfiguration +var client = AdvancedBillingClient + .FromConfiguration(configuration.GetSection("AdvancedBilling")); +``` + +See the [Configuration-Based Initialization](../doc/configuration-based-initialization.md) section for details. + ## Maxio Advanced BillingClient Class The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK. diff --git a/doc/configuration-based-initialization.md b/doc/configuration-based-initialization.md new file mode 100644 index 00000000..3c95d5bb --- /dev/null +++ b/doc/configuration-based-initialization.md @@ -0,0 +1,69 @@ + +# Configuration-Based Initialization + +Sdk Client initialization through configuration. + +The SDK client can also be initialized directly from an `IConfiguration` instance using the `FromConfiguration` method available on the `Builder` or `SDKClient` class. + +This enables the SDK to automatically read configuration values from various sources such as JSON files, environment variables, or other .NET configuration providers. + +If a required environment variable or configuration value is missing, the SDK will fall back to its default configuration value. + +## Example: Initializing SDK Client from Configuration + +The following code sample demonstrates how to initialize the SDK client using an `IConfiguration` section. + +The `Builder.FromConfiguration` method reads values from the provided configuration section and returns a builder instance, allowing you to override specific properties directly in code if needed before building the final client. + +```csharp +using AdvancedBilling.Standard; +using Microsoft.Extensions.Configuration; +using Environment = AdvancedBilling.Standard.Environment; + +namespace ConsoleApp; + +// Build the IConfiguration using .NET conventions (JSON, environment, etc.) +var configuration = new ConfigurationBuilder() + .AddJsonFile("config.json") + .AddEnvironmentVariables() // [optional] read environment variables + .Build(); + +// Instantiate your SDK builder and configure it from IConfiguration with overrides +var client = AdvancedBillingClient.Builder + .FromConfiguration(configuration.GetSection("AdvancedBilling")) + .Environment(Environment.US) + .HttpClientConfig(c => c.Timeout(TimeSpan.FromSeconds(60))) + .Build(); +``` + +## Example Configuration File + +```csharp +{ + "AdvancedBilling": { + "Environment": "us", + "Site": "site", + "BasicAuthCredentials": { + "Username": "username", + "Password": "password", + }, + "HttpClientConfig": { + "Timeout": "00:01:00", + "NumberOfRetries": 3, + "BackoffFactor": 2, + "RetryInterval": 1, + "MaximumRetryWaitTime": "00:02:00", + "StatusCodesToRetry": [408, 413], + "RequestMethodsToRetry": ["GET", "PUT", "DELETE"], + "ProxyConfiguration": { + "Address": "http://localhost:3000", + "Port": 8080, + "Tunnel": false, + "User": "username", + "Pass": "password", + } + } + } +} +``` + diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md index 9049a81e..b6d42b48 100644 --- a/doc/controllers/advance-invoice.md +++ b/doc/controllers/advance-invoice.md @@ -17,7 +17,7 @@ AdvanceInvoiceController advanceInvoiceController = client.AdvanceInvoiceControl # Issue Advance Invoice -Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. +Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error. That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated. We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it. @@ -114,7 +114,7 @@ catch (ApiException e) # Void Advance Invoice Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. -A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs](../../doc/models/invoice.md). +A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs](../../doc/models/invoice.md). ```csharp VoidAdvanceInvoiceAsync( diff --git a/doc/controllers/api-exports.md b/doc/controllers/api-exports.md index 1e5c33a5..86cc32c0 100644 --- a/doc/controllers/api-exports.md +++ b/doc/controllers/api-exports.md @@ -51,7 +51,7 @@ ListExportedProformaInvoicesInput listExportedProformaInvoicesInput = new ListEx { BatchId = "batch_id8", PerPage = 100, - Page = 2, + Page = 1, }; try @@ -102,7 +102,7 @@ ListExportedInvoicesInput listExportedInvoicesInput = new ListExportedInvoicesIn { BatchId = "batch_id8", PerPage = 100, - Page = 2, + Page = 1, }; try @@ -153,7 +153,7 @@ ListExportedSubscriptionsInput listExportedSubscriptionsInput = new ListExported { BatchId = "batch_id8", PerPage = 100, - Page = 2, + Page = 1, }; try diff --git a/doc/controllers/billing-portal.md b/doc/controllers/billing-portal.md index 9ccc46b4..d8676528 100644 --- a/doc/controllers/billing-portal.md +++ b/doc/controllers/billing-portal.md @@ -32,7 +32,7 @@ If your customer has been invited to the Billing Portal, then they will receive If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing. -In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), please **do not** make an API request to Advanced Billing every time. +In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time. ```csharp EnableBillingPortalForCustomerAsync( diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index 709728ce..87826a67 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -210,7 +210,7 @@ ListComponentPricePointsAsync( ListComponentPricePointsInput listComponentPricePointsInput = new ListComponentPricePointsInput { ComponentId = 222, - Page = 2, + Page = 1, PerPage = 50, FilterType = Liquid error: Value cannot be null. (Parameter 'key'), }; @@ -428,7 +428,7 @@ catch (ApiException e) # Update Component Price Point -When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones. +When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. Passing in a price bracket without an `id` will attempt to create a new price. @@ -911,7 +911,7 @@ ListAllComponentPricePointsAsync( ListAllComponentPricePointsInput listAllComponentPricePointsInput = new ListAllComponentPricePointsInput { Include = ListComponentsPricePointsInclude.CurrencyPrices, - Page = 2, + Page = 1, PerPage = 50, Filter = new ListPricePointsFilter { diff --git a/doc/controllers/components.md b/doc/controllers/components.md index 38139d71..bd179f43 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -32,7 +32,7 @@ Metered components are used to bill for any type of unit that resets to 0 at the Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```csharp CreateMeteredComponentAsync( @@ -162,7 +162,7 @@ One-time quantity-based components are used to create ad hoc usage charges that The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```csharp CreateQuantityBasedComponentAsync( @@ -282,7 +282,7 @@ This request will create a component definition of kind **on_off_component** und On/off components are used for any flat fee, recurring add on (think $99/month for tech support or a flat add on shipping fee). -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```csharp CreateOnOffComponentAsync( @@ -387,7 +387,7 @@ This request will create a component definition of kind **prepaid_usage_componen Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```csharp CreatePrepaidUsageComponentAsync( @@ -535,7 +535,7 @@ Event-based components are similar to other component types, in that you define So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```csharp CreateEventBasedComponentAsync( @@ -976,7 +976,7 @@ ListComponentsAsync( ListComponentsInput listComponentsInput = new ListComponentsInput { DateField = BasicDateField.UpdatedAt, - Page = 2, + Page = 1, PerPage = 50, Filter = new ListComponentsFilter { @@ -1220,7 +1220,7 @@ ListComponentsForProductFamilyAsync( ListComponentsForProductFamilyInput listComponentsForProductFamilyInput = new ListComponentsForProductFamilyInput { ProductFamilyId = 140, - Page = 2, + Page = 1, PerPage = 50, Filter = new ListComponentsFilter { diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md index 27c0c875..1c1cd150 100644 --- a/doc/controllers/coupons.md +++ b/doc/controllers/coupons.md @@ -30,9 +30,9 @@ CouponsController couponsController = client.CouponsController; ## Coupons Documentation -Coupons can be administered in the Advanced Billing application or created via API. Please view our section on [creating coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creating-Editing-Deleting-Coupons) for more information. +Coupons can be administered in the Advanced Billing application or created via API. View our section on [creating coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creating-Editing-Deleting-Coupons) for more information. -Additionally, for documentation on how to apply a coupon to a subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). +Additionally, for documentation on how to apply a coupon to a subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). ## Create Coupon @@ -117,8 +117,6 @@ catch (ApiException e) List coupons for a specific Product Family in a Site. -If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. - ```csharp ListCouponsForProductFamilyAsync( Models.ListCouponsForProductFamilyInput input) @@ -144,7 +142,7 @@ ListCouponsForProductFamilyAsync( ListCouponsForProductFamilyInput listCouponsForProductFamilyInput = new ListCouponsForProductFamilyInput { ProductFamilyId = 140, - Page = 2, + Page = 1, PerPage = 50, Filter = new ListCouponsFilter { @@ -584,8 +582,6 @@ catch (ApiException e) You can retrieve a list of coupons. -If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. - ```csharp ListCouponsAsync( Models.ListCouponsInput input) @@ -609,7 +605,7 @@ ListCouponsAsync( ```csharp ListCouponsInput listCouponsInput = new ListCouponsInput { - Page = 2, + Page = 1, PerPage = 50, Filter = new ListCouponsFilter { @@ -710,8 +706,8 @@ ReadCouponUsageAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `productFamilyId` | `int` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs | -| `couponId` | `int` | Template, Required | The Advanced Billing id of the coupon | +| `productFamilyId` | `int` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs. | +| `couponId` | `int` | Template, Required | The Advanced Billing id of the coupon. | ## Response Type @@ -954,7 +950,7 @@ When creating a coupon subcode, you must specify a coupon to attach it to using Full documentation on how to create coupon subcodes in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes). -Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). +Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). ## Create Coupon Subcode @@ -1056,7 +1052,7 @@ ListCouponSubcodesAsync( ListCouponSubcodesInput listCouponSubcodesInput = new ListCouponSubcodesInput { CouponId = 162, - Page = 2, + Page = 1, PerPage = 50, }; diff --git a/doc/controllers/custom-fields.md b/doc/controllers/custom-fields.md index 3fd4f9b2..6b076ccd 100644 --- a/doc/controllers/custom-fields.md +++ b/doc/controllers/custom-fields.md @@ -23,30 +23,20 @@ CustomFieldsController customFieldsController = client.CustomFieldsController; # Create Metafields -## Custom Fields: Metafield Intro +Creates metafields on a Site for either the Subscriptions or Customers resource. -**Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. +Metafields and their metadata are created in the Custom Fields configuration page on your Site. Metafields can be populated with metadata when you create them or later with the [Update Metafield](../../doc/controllers/custom-fields.md#update-metafield), [Create Metadata](../../doc/controllers/custom-fields.md#create-metadata), or [Update Metadata](../../doc/controllers/custom-fields.md#update-metadata) endpoints. The Create Metadata and Update Metadata endpoints allow you to add metafields and metadata values to a specific subscription or customer. -+ **Metafield is the custom field** -+ **Metadata is the data populating the custom field.** +Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. -Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/sections/24266118312589-Custom-Fields). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab). +> Note: After creating a metafield, the resource type cannot be modified. -Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record. +In the UI and product documentation, metafields and metadata are called Custom Fields. -## Create Metafields +- Metafield is the custom field +- Metadata is the data populating the custom field. -Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact. - -Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer. - -### Metafields "On-the-Fly" - -It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existent name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”. - -### Metafield Scope Warning - -If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**. +See [Custom Fields Reference](https://docs.maxio.com/hc/en-us/articles/24266140850573-Custom-Fields-Reference) and [Custom Fields Tab](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab) for information on using Custom Fields in the Advanced Billing UI. ```csharp CreateMetafieldsAsync( @@ -58,7 +48,7 @@ CreateMetafieldsAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `body` | [`CreateMetafieldsRequest`](../../doc/models/create-metafields-request.md) | Body, Optional | - | ## Response Type @@ -77,8 +67,10 @@ CreateMetafieldsRequest body = new CreateMetafieldsRequest Name = "Dropdown field", Scope = new MetafieldScope { - PublicShow = IncludeOption.Include, - PublicEdit = IncludeOption.Include, + Csv = IncludeOption.Exclude, + Invoices = IncludeOption.Exclude, + Statements = IncludeOption.Exclude, + Portal = IncludeOption.Include, }, InputType = MetafieldInput.Dropdown, MEnum = new List @@ -144,7 +136,7 @@ catch (ApiException e) # List Metafields -This endpoint lists metafields associated with a site. The metafield description and usage is contained in the response. +Lists the metafields and their associated details for a Site and resource type. You can filter the request to a specific metafield. ```csharp ListMetafieldsAsync( @@ -155,8 +147,8 @@ ListMetafieldsAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | -| `name` | `string` | Query, Optional | filter by the name of the metafield | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | +| `name` | `string` | Query, Optional | Filter by the name of the metafield. | | `page` | `int?` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `int?` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | | `direction` | [`SortingDirection?`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | @@ -171,7 +163,7 @@ ListMetafieldsAsync( ListMetafieldsInput listMetafieldsInput = new ListMetafieldsInput { ResourceType = ResourceType.Subscriptions, - Page = 2, + Page = 1, PerPage = 50, }; @@ -190,10 +182,10 @@ catch (ApiException e) ```json { - "total_count": 0, - "current_page": 0, + "total_count": 1, + "current_page": 1, "total_pages": 0, - "per_page": 0, + "per_page": 50, "metafields": [ { "id": 0, @@ -217,7 +209,33 @@ catch (ApiException e) # Update Metafield -Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact. +Updates metafields on your Site for a resource type. Depending on the request structure, you can update or add metafields and metadata to the Subscriptions or Customers resource. + +With this endpoint, you can: + +- Add metafields. If the metafield specified in current_name does not exist, a new metafield is added. + + > Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. + +- Change the name of a metafield. + + > Note: To keep the metafield name the same and only update the metadata for the metafield, you must use the current metafield name in both the `current_name` and `name` parameters. + +- Change the input type for the metafield. For example, you can change a metafield input type from text to a dropdown. If you change the input type from text to a dropdown or radio, you must update the specific subscriptions or customers where the metafield was used to reflect the updated metafield and metadata. + +- Add metadata values to the existing metadata for a dropdown or radio metafield. + + > Note: Updates to metadata overwrite. To add one or more values, you must specify all metadata values including the new value you want to add. + +- Add new metadata to a dropdown or radio for a metafield that was created without metadata. + +- Remove metadata for a dropdown or radio for a metafield. + + > Note: Updates to metadata overwrite existing values. To remove one or more values, specify all metadata values except those you want to remove. + +- Add or update scope settings for a metafield. + + > Note: Scope changes overwrite existing settings. You must specify the complete scope, including the changes you want to make. ```csharp UpdateMetafieldAsync( @@ -229,7 +247,7 @@ UpdateMetafieldAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `body` | [`UpdateMetafieldsRequest`](../../doc/models/update-metafields-request.md) | Body, Optional | - | ## Response Type @@ -260,9 +278,7 @@ catch (ApiException e) # Delete Metafield -Use the following method to delete a metafield. This will remove the metafield from the Site. - -Additionally, this will remove the metafield and associated metadata with all Subscriptions on the Site. +Deletes a metafield from your Site. Removes the metafield and associated metadata from all Subscriptions or Customers resources on the Site. ```csharp DeleteMetafieldAsync( @@ -274,7 +290,7 @@ DeleteMetafieldAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `name` | `string` | Query, Optional | The name of the metafield to be deleted | ## Response Type @@ -305,28 +321,11 @@ catch (ApiException e) # Create Metadata -## Custom Fields: Metadata Intro +Creates metadata and metafields for a specific subscription or customer, or updates metadata values of existing metafields for a subscription or customer. Metadata values are limited to 2 KB in size. -**Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. +If you create metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field. You can update the input_type for the metafield with the [Update Metafield](../../doc/controllers/custom-fields.md#update-metafield) endpoint. -+ **Metafield is the custom field** -+ **Metadata is the data populating the custom field.** - -Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24266164865677-Custom-Fields-Overview). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab) - -Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**. - -## Metadata limits - -Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource. - -## Create Metadata - -This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value. - -### Subscription or Customer Resource - -Please pay special attention to the resource you use when creating metadata. +> Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. ```csharp CreateMetadataAsync( @@ -339,7 +338,7 @@ CreateMetadataAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resourceId` | `int` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `body` | [`CreateMetadataRequest`](../../doc/models/create-metadata-request.md) | Body, Optional | - | @@ -393,11 +392,7 @@ catch (ApiException e) # List Metadata -This request will list all of the metadata belonging to a particular resource (ie. subscription, customer) that is specified. - -## Metadata Data - -This endpoint will also display the current stats of your metadata to use as a tool for pagination. +Lists metadata and metafields for a specific customer or subscription. ```csharp ListMetadataAsync( @@ -408,7 +403,7 @@ ListMetadataAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resourceId` | `int` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `page` | `int?` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `int?` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | @@ -424,7 +419,7 @@ ListMetadataInput listMetadataInput = new ListMetadataInput { ResourceType = ResourceType.Subscriptions, ResourceId = 60, - Page = 2, + Page = 1, PerPage = 50, }; @@ -439,10 +434,35 @@ catch (ApiException e) } ``` +## Example Response *(as JSON)* + +```json +{ + "total_count": 1, + "current_page": 1, + "total_pages": 1, + "per_page": 50, + "metadata": [ + { + "id": 77889911, + "value": "green", + "resource_id": 1234567, + "metafield_id": 112233, + "deleted_at": null, + "name": "Color" + } + ] +} +``` + # Update Metadata -This method allows you to update the existing metadata associated with a subscription or customer. +Updates metadata and metafields on the Site and the customer or subscription specified, and updates the metadata value on a subscription or customer. + +If you update metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field to the Site and to the subscription or customer you specify. You can update the input_type for the metafield with the Update Metafield endpoint. + +Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscription and another 100 for Customer. ```csharp UpdateMetadataAsync( @@ -455,7 +475,7 @@ UpdateMetadataAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resourceId` | `int` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `body` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Optional | - | @@ -491,29 +511,7 @@ catch (ApiException e) # Delete Metadata -This method removes the metadata from the subscriber/customer cited. - -## Query String Usage - -For instance if you wanted to delete the metadata for customer 99 named weight you would request: - -``` -https://acme.chargify.com/customers/99/metadata.json?name=weight -``` - -If you want to delete multiple metadata fields for a customer 99 named: `weight` and `age` you wrould request: - -``` -https://acme.chargify.com/customers/99/metadata.json?names[]=weight&names[]=age -``` - -## Successful Response - -For a success, there will be a code `200` and the plain text response `true`. - -## Unsuccessful Response - -When a failed response is encountered, you will receive a `404` response and the plain text response of `true`. +Deletes one or more metafields (and associated metadata) from the specified subscription or customer. ```csharp DeleteMetadataAsync( @@ -527,7 +525,7 @@ DeleteMetadataAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resourceId` | `int` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `name` | `string` | Query, Optional | Name of field to be removed. | | `names` | `List` | Query, Optional | Names of fields to be removed. Use in query: `names[]=field1&names[]=my-field&names[]=another-field`. | @@ -564,19 +562,7 @@ catch (ApiException e) # List Metadata for Resource Type -This method will provide you information on usage of metadata across your selected resource (ie. subscriptions, customers) - -## Metadata Data - -This endpoint will also display the current stats of your metadata to use as a tool for pagination. - -### Metadata for multiple records - -`https://acme.chargify.com/subscriptions/metadata.json?resource_ids[]=1&resource_ids[]=2` - -## Read Metadata for a Site - -This endpoint will list the number of pages of metadata information that are contained within a site. +Lists metadata for a specified array of subscriptions or customers. ```csharp ListMetadataForResourceTypeAsync( @@ -587,7 +573,7 @@ ListMetadataForResourceTypeAsync( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `page` | `int?` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | | `perPage` | `int?` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `20`

**Constraints**: `<= 200` | | `dateField` | [`BasicDateField?`](../../doc/models/basic-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. | @@ -609,7 +595,7 @@ ListMetadataForResourceTypeAsync( ListMetadataForResourceTypeInput listMetadataForResourceTypeInput = new ListMetadataForResourceTypeInput { ResourceType = ResourceType.Subscriptions, - Page = 2, + Page = 1, PerPage = 50, DateField = BasicDateField.UpdatedAt, }; diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 0c842ac8..30343be4 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -31,7 +31,7 @@ Full documentation on how to locate, create and edit Customers in the Advanced B Advanced Billing requires that you use the ISO Standard Country codes when formatting country attribute of the customer. -Countries should be formatted as 2 characters. For more information, please see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) +Countries should be formatted as 2 characters. For more information, see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) ## Required State Format @@ -39,7 +39,7 @@ Advanced Billing requires that you use the ISO Standard State codes when formatt + US States (2 characters): [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US) -+ States Outside the US (2-3 characters): To find the correct state codes outside of the US, please go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. ++ States Outside the US (2-3 characters): To find the correct state codes outside of the US, go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. ## Locale @@ -154,7 +154,7 @@ Common use cases are: + Search by a reference value from your application + Search by a first or last name -To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). +To retrieve a single, exact match by reference, use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). ```csharp ListCustomersAsync( @@ -184,7 +184,7 @@ ListCustomersAsync( ```csharp ListCustomersInput listCustomersInput = new ListCustomersInput { - Page = 2, + Page = 1, PerPage = 30, DateField = BasicDateField.UpdatedAt, }; diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md index d9090088..4556dda5 100644 --- a/doc/controllers/events-based-billing-segments.md +++ b/doc/controllers/events-based-billing-segments.md @@ -129,7 +129,7 @@ ListSegmentsForPricePointInput listSegmentsForPricePointInput = new ListSegments { ComponentId = "component_id8", PricePointId = "price_point_id8", - Page = 2, + Page = 1, PerPage = 50, Filter = new ListSegmentsFilter { diff --git a/doc/controllers/events.md b/doc/controllers/events.md index 8bb4d6eb..62d50b82 100644 --- a/doc/controllers/events.md +++ b/doc/controllers/events.md @@ -116,7 +116,7 @@ ListEventsAsync( ```csharp ListEventsInput listEventsInput = new ListEventsInput { - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Desc, Filter = new List @@ -242,7 +242,7 @@ ListSubscriptionEventsAsync( ListSubscriptionEventsInput listSubscriptionEventsInput = new ListSubscriptionEventsInput { SubscriptionId = 222, - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Desc, Filter = new List @@ -336,7 +336,7 @@ ReadEventsCountAsync( ```csharp ReadEventsCountInput readEventsCountInput = new ReadEventsCountInput { - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Desc, Filter = new List diff --git a/doc/controllers/insights.md b/doc/controllers/insights.md index cdd4c479..200016a4 100644 --- a/doc/controllers/insights.md +++ b/doc/controllers/insights.md @@ -180,7 +180,7 @@ ListMrrMovementsAsync( ```csharp ListMrrMovementsInput listMrrMovementsInput = new ListMrrMovementsInput { - Page = 2, + Page = 1, PerPage = 20, }; @@ -288,7 +288,7 @@ ListMrrPerSubscriptionInput listMrrPerSubscriptionInput = new ListMrrPerSubscrip }, }, AtTime = "at_time=2022-01-10T10:00:00-05:00", - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Desc, }; diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 0e3d2f9f..50d39cf1 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -142,7 +142,7 @@ ListInvoicesAsync( ```csharp ListInvoicesInput listInvoicesInput = new ListInvoicesInput { - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Desc, LineItems = false, @@ -227,7 +227,7 @@ catch (ApiException e) "organization": "", "email": "meg@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -293,7 +293,7 @@ catch (ApiException e) "organization": "", "email": "food@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "", "line2": "", @@ -359,7 +359,7 @@ catch (ApiException e) "organization": "123", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 Anywhere Street", "line2": "", @@ -425,7 +425,7 @@ catch (ApiException e) "organization": "", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -546,7 +546,7 @@ catch (ApiException e) "organization": null, "email": "joe@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": null, "line2": null, @@ -667,7 +667,7 @@ ListInvoiceEventsAsync( ```csharp ListInvoiceEventsInput listInvoiceEventsInput = new ListInvoiceEventsInput { - Page = 2, + Page = 1, PerPage = 100, }; @@ -1269,7 +1269,7 @@ ListCreditNotesAsync( ```csharp ListCreditNotesInput listCreditNotesInput = new ListCreditNotesInput { - Page = 2, + Page = 1, PerPage = 50, LineItems = false, Discounts = false, @@ -2156,7 +2156,7 @@ ListConsolidatedInvoiceSegmentsAsync( ListConsolidatedInvoiceSegmentsInput listConsolidatedInvoiceSegmentsInput = new ListConsolidatedInvoiceSegmentsInput { InvoiceUid = "invoice_uid0", - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Asc, }; @@ -2216,7 +2216,7 @@ catch (ApiException e) "organization": "", "email": "meg@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -2282,7 +2282,7 @@ catch (ApiException e) "organization": "", "email": "food@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "", "line2": "", @@ -2348,7 +2348,7 @@ catch (ApiException e) "organization": "123", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 Anywhere Street", "line2": "", @@ -2414,7 +2414,7 @@ catch (ApiException e) "organization": "", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -2539,6 +2539,42 @@ If You want to use existing coupon for discount creation, only `code` and option ... ``` +#### Using Coupon Subcodes + +You can also use coupon subcodes to apply existing coupons with specific subcodes: + +```json +... + "coupons": [ + { + "subcode": "SUB1", + "product_family_id": 1 + } + ] +... +``` + +**Important:** You cannot specify both `code` and `subcode` for the same coupon. Use either: + +- `code` to apply a main coupon +- `subcode` to apply a specific coupon subcode + +The API response will include both the main coupon code and the subcode used: + +```json +... + "coupons": [ + { + "code": "MAIN123", + "subcode": "SUB1", + "product_family_id": 1, + "percentage": 10, + "description": "Special discount" + } + ] +... +``` + ### Coupon options #### Code @@ -2547,6 +2583,10 @@ Coupon `code` will be displayed on invoice discount section. Coupon code can only contain uppercase letters, numbers, and allowed special characters. Lowercase letters will be converted to uppercase. It can be used to select an existing coupon from the catalog, or as an ad hoc coupon when passed with `percentage` or `amount`. +#### Subcode + +Coupon `subcode` allows you to apply existing coupons using their subcodes. When a subcode is used, the API response will include both the main coupon code and the specific subcode that was applied. Subcodes are case-insensitive and will be converted to uppercase automatically. + #### Percentage Coupon `percentage` can take values from 0 to 100 and up to 4 decimal places. It cannot be used with `amount`. Only for ad hoc coupons, will be ignored if `code` is used to select an existing coupon from the catalog. @@ -2606,7 +2646,7 @@ By default, invoices will be created with a due date matching the date of invoic #### Addresses -The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. Please see below for the details on which parameters can be sent for each address object. +The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. See below for the details on which parameters can be sent for each address object. #### Memo and Payment Instructions @@ -2775,9 +2815,9 @@ catch (ApiException e) This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. -Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. +If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. -On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. +On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. ```csharp SendInvoiceAsync( diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md index 9609e4bb..da55f99f 100644 --- a/doc/controllers/offers.md +++ b/doc/controllers/offers.md @@ -161,7 +161,7 @@ ListOffersAsync( ```csharp ListOffersInput listOffersInput = new ListOffersInput { - Page = 2, + Page = 1, PerPage = 50, IncludeArchived = true, }; diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 9b580b6a..79f68708 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -26,236 +26,37 @@ PaymentProfilesController paymentProfilesController = client.PaymentProfilesCont # Create Payment Profile -Use this endpoint to create a payment profile for a customer. +Creates a payment profile for a customer. -Payment Profiles house the credit card, ACH (Authorize.Net or Stripe only,) or PayPal (Braintree only,) data for a customer. The payment information is attached to the customer within Advanced Billing, as opposed to the Subscription itself. +When you create a new payment profile for a customer via the API, it does not automatically make the profile current for any of the customer’s subscriptions. To use the payment profile as the default, you must set it explicitly for the subscription or subscription group. -You must include a customer_id so that Advanced Billing will attach it to the customer entry. If no customer_id is included the API will return a 404. +Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating payment profiles. -## Create a Payment Profile for ACH usage +Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. -If you would like to create a payment method that is a Bank Account applicable for ACH payments use the following: +Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. -```json -{ -"payment_profile": { - "customer_id": [Valid-Customer-ID], - "bank_name": "Best Bank", - "bank_routing_number": "021000089", - "bank_account_number": "111111111111", - "bank_account_type": "checking", - "bank_account_holder_type": "business", - "payment_type": "bank_account" - } -} -``` - -## Taxable Subscriptions - -If your subscriber pays taxes on their purchased product, and you are attempting to create or update the `payment_profile`, complete address information is required. For information on required address formatting to allow your subscriber to be taxed, please see our documentation [here](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-signups#taxes) - -## Payment Profile Documentation - -Full documentation on how Payment Profiles operate within Advanced Billing can be located under the following links: +See the following articles to learn more about subscriptions and payments: + [Subscriber Payment Details](https://maxio.zendesk.com/hc/en-us/articles/24251599929613-Subscription-Summary-Payment-Details-Tab) + [Self Service Pages](https://maxio.zendesk.com/hc/en-us/articles/24261425318541-Self-Service-Pages) (Allows credit card updates by Subscriber) + [Public Signup Pages payment settings](https://maxio.zendesk.com/hc/en-us/articles/24261368332557-Individual-Page-Settings) - -## Create a Payment Profile with a Chargify.js token - -```json -{ - "payment_profile": { - "customer_id": 1036, - "chargify_token": "tok_w68qcpnftyv53jk33jv6wk3w" - } -} -``` - -## Active Payment Methods - -Creating a new payment profile for a Customer via the API will not make that Payment Profile current for any of the Customer’s Subscriptions. In order to utilize the payment profile as the default, it must be set as the default payment profile for the subscription or subscription group. - -## Requirements - -Either the full_number, expiration_month, and expiration_year or if you have an existing vault_token from your gateway, that vault_token and the current_vault are required. -Passing in the vault_token and current_vault are only allowed when creating a new payment profile. - -### Taxable Subscriptions - -If your subscriber pays taxes on their purchased product, and you are attempting to create or update the `payment_profile`, complete address information is required. For information on required address formatting to allow your subscriber to be taxed, please see our documentation [here](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-signups#taxes) - -## BraintreeBlue - -Some merchants use Braintree JavaScript libraries directly and then pass `payment_method_nonce` and/or `paypal_email` to create a payment profile. This implementation is deprecated and does not handle 3D Secure. Instead, we have provided [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDI0-overview) which is continuously improved and supports Credit Cards (along with 3D Secure), PayPal and ApplePay payment types. - -## GoCardless - -For more information on GoCardless, please view the following resources: - ++ [Taxes](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-signups#taxes) ++ [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview) + + [Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) + + [Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) + + [Chargify.js with Stripe Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) + + [Chargify.js with Stripe Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRECQQ4ECS3ZA55GY7) + + [Chargify.js with Stripe BECS Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway) + + [Chargify.js with Stripe BECS Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) + [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless) - -+ [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) - -+ [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) - -### GoCardless with Local Bank Details - -Following examples create customer, bank account and mandate in GoCardless: - -```json -{ - "payment_profile": { - "customer_id": "Valid-Customer-ID", - "bank_name": "Royal Bank of France", - "bank_account_number": "0000000", - "bank_routing_number": "0003", - "bank_branch_code": "00006", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } -} -``` - -### GoCardless with IBAN - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "French Bank", - "bank_iban": "FR1420041010050500013M02606", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } -} -``` - -### Importing GoCardless - -If the customer, bank account, and mandate already exist in GoCardless, a payment profile can be created by using the IDs. In order to create masked versions of `bank_account_number` and `bank_routing_number` that are used to display within Advanced Billing Admin UI, you can pass the last four digits for this fields which then will be saved in this form `XXXX[four-provided-digits]`. - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "customer_vault_token": [Existing GoCardless Customer ID] - "vault_token": [Existing GoCardless Mandate ID], - "current_vault": "gocardless", - "bank_name": "French Bank", - "bank_account_number": [Last Four Of The Existing Account Number or IBAN if applicable], - "bank_routing_number": [Last Four Of The Existing Routing Number], - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } -} -``` - -## SEPA Direct Debit - -For more information on Stripe SEPA Direct Debit, please view the following resources: - + [Full documentation on Stripe SEPA Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRECQQ4ECS3ZA55GY7) - -### Stripe SEPA Direct Debit Payment Profiles - -The following example creates a customer, bank account and mandate in Stripe: - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "Deutsche bank", - "bank_iban": "DE89370400440532013000", - "payment_type": "bank_account", - "billing_address": "Test", - "billing_city": "Berlin", - "billing_state": "Brandenburg", - "billing_zip": "12345", - "billing_country": "DE" - } -} -``` - -## Stripe BECS Direct Debit - -For more information on Stripe BECS Direct Debit, please view the following resources: - + [Full documentation on Stripe BECS Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe BECS Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway) - -+ [Using Chargify.js with Stripe BECS Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) - -### Stripe BECS Direct Debit Payment Profiles - -The following example creates a customer, bank account and mandate in Stripe: - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "Australian bank", - "bank_branch_code": "000000", - "bank_account_number": "000123456" - "payment_type": "bank_account", - "billing_address": "Test", - "billing_city": "Stony Rise", - "billing_state": "Tasmania", - "billing_zip": "12345", - "billing_country": "AU" - } -} -``` - -## Stripe BACS Direct Debit - -Contact the support team to enable this payment method. -For more information on Stripe BACS Direct Debit, please view the following resources: - + [Full documentation on Stripe BACS Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) -### Stripe BACS Direct Debit Payment Profiles +## 3D Secure Authentication during payment profile creation. -The following example creates a customer, bank account and mandate in Stripe: - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "British bank", - "bank_branch_code": "108800", - "bank_account_number": "00012345" - "payment_type": "bank_account", - "billing_address": "Test", - "billing_city": "London", - "billing_state": "LND", - "billing_zip": "12345", - "billing_country": "GB" - } -} -``` - -## 3D Secure - Checkout - -It may happen that a payment needs 3D Secure Authentication when the payment profile is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: +When a payment requires 3D Secure Authentication to adhear to Strong Customer Authentication (SCA) during payment profile creation, the request enters a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). In this case, a 422 Unprocessable Entity status is returned with the following response: ```json { @@ -275,29 +76,34 @@ It may happen that a payment needs 3D Secure Authentication when the payment pro ``` To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. -Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information: + +Optionally, you can specify the `callback_url` parameter in the `action_link` URL to receive notification about the result of 3D Secure Authentication. + +The `callback_url` will return the following information: - whether the authentication was successful (`success`) - the payment profile ID (`payment_profile_id`) -Lastly, you can also specify a `redirect_url` parameter within the `action_link` URL if you’d like to redirect a customer back to your site. +You can also specify a `redirect_url` parameter in the `action_link` URL to redirect the customer back to your site. + +You cannot use action_link in an iframe inside a custom application. You must redirect the customer directly to the `action_link` and use the `redirect_url` or `callback_url` to be notified of the result. -It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. +The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: -The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://checkout-test.chargifypay.test/3d-secure/checkout/pay_uerzhsxd5uhkbodx5jhvkg6yeu?one_time_token_id=93&callback_url=http://localhost:4000&redirect_url=https://yourpage.com` +`https://checkout-test.chargifypay.test/3d-secure/checkout/pay_uerzhsxd5uhkbodx5jhvkg6yeu?one_time_token_id=93&callback_url=http://localhost:4000&redirect_url=https://yourpage.com` ### Example Redirect Flow -You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference: +Here's an example flow to redirect customers to different pages depending on whether SCA was performed successfully: -1. Create a payment profile via API; it requires 3DS -2. You receive a `action_link` in the response. -3. Use this `action_link` to, for example, connect with your internal resources or generate a session_id -4. Include 1 of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to +1. Create a payment profile via the API; it requires 3DS. +2. You receive an `action_link` in the response. +3. Use this `action_link` to, for example, connect with your internal resources or generate a `session_id`. +4. Include one of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to. 5. Redirect the customer to the `action_link` with `callback_url` and `redirect_url` applied -6. After the customer finishes 3DS authentication, we let you know the result by making a request to applied `callback_url`. -7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known -8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not +6. After the customer completes 3DS authentication, we notify you of the result via the applied `callback_url`. +7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known. +8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine if the redirect was successful. ```csharp CreatePaymentProfileAsync( @@ -321,13 +127,8 @@ CreatePaymentProfileRequest body = new CreatePaymentProfileRequest { PaymentProfile = new CreatePaymentProfile { - PaymentType = PaymentType.BankAccount, - CustomerId = 123, - BankName = "Best Bank", - BankRoutingNumber = "021000089", - BankAccountNumber = "111111111111", - BankAccountType = BankAccountType.Checking, - BankAccountHolderType = BankAccountHolderType.Business, + ChargifyToken = "tok_w68qcpnftyv53jk33jv6wk3w", + CustomerId = 1036, }, }; @@ -405,7 +206,7 @@ ListPaymentProfilesAsync( ```csharp ListPaymentProfilesInput listPaymentProfilesInput = new ListPaymentProfilesInput { - Page = 2, + Page = 1, PerPage = 50, }; @@ -488,7 +289,7 @@ catch (ApiException e) Using the GET method you can retrieve a Payment Profile identified by its unique ID. -Please note that a different JSON object will be returned if the card method on file is a bank account. +Note that a different JSON object will be returned if the card method on file is a bank account. ### Response for Bank Account @@ -656,11 +457,6 @@ UpdatePaymentProfileRequest body = new UpdatePaymentProfileRequest { FirstName = "Graham", LastName = "Test", - FullNumber = "4111111111111111", - CardType = CardType.Master, - ExpirationMonth = "04", - ExpirationYear = "2030", - CurrentVault = AllVaults.Bogus, BillingAddress = "456 Juniper Court", BillingCity = "Boulder", BillingState = "CO", @@ -692,23 +488,13 @@ catch (ApiException e) "id": 10088716, "first_name": "Test", "last_name": "Subscription", - "masked_card_number": "XXXX-XXXX-XXXX-1", - "card_type": "bogus", - "expiration_month": 1, - "expiration_year": 2022, - "customer_id": 14543792, - "current_vault": "bogus", - "vault_token": "1", "billing_address": "123 Montana Way", "billing_city": "Billings", "billing_state": "MT", "billing_zip": "59101", "billing_country": "US", - "customer_vault_token": null, "billing_address_2": "", - "payment_type": "credit_card", - "site_gateway_setting_id": 1, - "gateway_handle": null + "payment_type": "bank_account" } } ``` @@ -864,8 +650,8 @@ catch (ApiException e) { "payment_profile": { "id": 10089892, - "first_name": "Chester", - "last_name": "Tester", + "first_name": "John", + "last_name": "Doe", "customer_id": 14543792, "current_vault": "stripe_connect", "vault_token": "cus_0123abc456def", diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md index b545d445..133a2006 100644 --- a/doc/controllers/product-families.md +++ b/doc/controllers/product-families.md @@ -18,7 +18,7 @@ ProductFamiliesController productFamiliesController = client.ProductFamiliesCont # List Products for Product Family -This method allows to retrieve a list of Products belonging to a Product Family. +Retrieves a list of Products belonging to a Product Family. ```csharp ListProductsForProductFamilyAsync( @@ -51,7 +51,7 @@ ListProductsForProductFamilyAsync( ListProductsForProductFamilyInput listProductsForProductFamilyInput = new ListProductsForProductFamilyInput { ProductFamilyId = "product_family_id4", - Page = 2, + Page = 1, PerPage = 50, DateField = BasicDateField.UpdatedAt, Filter = new ListProductsFilter @@ -185,7 +185,7 @@ catch (ApiException e) # Create Product Family -This method will create a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. +Creates a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. Full documentation on how Product Families operate within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product-Families). @@ -250,7 +250,7 @@ catch (ApiException e) # List Product Families -This method allows to retrieve a list of Product Families for a site. +Retrieve a list of Product Families for a site. ```csharp ListProductFamiliesAsync( @@ -322,7 +322,7 @@ catch (ApiException e) # Read Product Family -This method allows to retrieve a Product Family via the `product_family_id`. The response will contain a Product Family object. +Retrieves a Product Family via the `product_family_id`. The response will contain a Product Family object. The product family can be specified either with the id number, or with the `handle:my-family` format. diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md index cf7e1f9d..4781aded 100644 --- a/doc/controllers/product-price-points.md +++ b/doc/controllers/product-price-points.md @@ -25,7 +25,7 @@ ProductPricePointsController productPricePointsController = client.ProductPriceP # Create Product Price Point -[Product Price Point Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points) +Creates a Product Price Point. See the [Product Price Point](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points) documentation for details. ```csharp CreateProductPricePointAsync( @@ -61,7 +61,7 @@ CreateProductPricePointRequest body = new CreateProductPricePointRequest TrialPriceInCents = 4900L, TrialInterval = 1, TrialIntervalUnit = IntervalUnit.Month, - TrialType = "payment_expected", + TrialType = TrialType.PaymentExpected, InitialChargeInCents = 120000L, InitialChargeAfterTrial = false, ExpirationInterval = 12, @@ -119,7 +119,7 @@ catch (ApiException e) # List Product Price Points -Use this endpoint to retrieve a list of product price points. +Retrieves a list of product price points. ```csharp ListProductPricePointsAsync( @@ -147,7 +147,7 @@ ListProductPricePointsAsync( ListProductPricePointsInput listProductPricePointsInput = new ListProductPricePointsInput { ProductId = ListProductPricePointsInputProductId.FromNumber(124), - Page = 2, + Page = 1, PerPage = 10, FilterType = Liquid error: Value cannot be null. (Parameter 'key'), }; @@ -195,9 +195,9 @@ catch (ApiException e) # Update Product Price Point -Use this endpoint to update a product price point. +Updates a product price point. -Note: Custom product price points are not able to be updated. +Note: Custom product price points cannot be updated. ```csharp UpdateProductPricePointAsync( @@ -351,7 +351,7 @@ catch (ApiException e) # Archive Product Price Point -Use this endpoint to archive a product price point. +Archives a product price point. ```csharp ArchiveProductPricePointAsync( @@ -495,9 +495,9 @@ catch (ApiException e) # Promote Product Price Point to Default -Use this endpoint to make a product price point the default for the product. +Sets a product price point as the default for the product. -Note: Custom product price points are not able to be set as the default for a product. +Note: Custom product price points cannot be set as the default for a product. ```csharp PromoteProductPricePointToDefaultAsync( @@ -591,7 +591,7 @@ catch (ApiException e) # Bulk Create Product Price Points -Use this endpoint to create multiple product price points in one request. +Creates multiple product price points in one request. ```csharp BulkCreateProductPricePointsAsync( @@ -628,7 +628,7 @@ BulkCreateProductPricePointsRequest body = new BulkCreateProductPricePointsReque TrialPriceInCents = 4900L, TrialInterval = 1, TrialIntervalUnit = IntervalUnit.Month, - TrialType = "payment_expected", + TrialType = TrialType.PaymentExpected, InitialChargeInCents = 120000L, InitialChargeAfterTrial = false, ExpirationInterval = 12, @@ -644,7 +644,7 @@ BulkCreateProductPricePointsRequest body = new BulkCreateProductPricePointsReque TrialPriceInCents = 4900L, TrialInterval = 1, TrialIntervalUnit = IntervalUnit.Month, - TrialType = "payment_expected", + TrialType = TrialType.PaymentExpected, InitialChargeInCents = 120000L, InitialChargeAfterTrial = false, ExpirationInterval = 12, @@ -705,7 +705,7 @@ catch (ApiException e) # Create Product Currency Prices -This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings. +Creates currency prices for a given currency that has been defined on the site level in your settings. When creating currency prices, they need to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. @@ -797,11 +797,11 @@ catch (ApiException e) # Update Product Currency Prices -This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point. +Updates the `price`s of currency prices for a given currency that exists on the product price point. When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. -Note: Currency Prices are not able to be updated for custom product price points. +Note: Currency Prices cannot be updated for custom product price points. ```csharp UpdateProductCurrencyPricesAsync( @@ -931,7 +931,7 @@ ListAllProductPricePointsInput listAllProductPricePointsInput = new ListAllProdu }, }, Include = ListProductsPricePointsInclude.CurrencyPrices, - Page = 2, + Page = 1, PerPage = 50, }; diff --git a/doc/controllers/products.md b/doc/controllers/products.md index 12c3eaad..7156e345 100644 --- a/doc/controllers/products.md +++ b/doc/controllers/products.md @@ -20,7 +20,9 @@ ProductsController productsController = client.ProductsController; # Create Product -Use this method to create a product within your Advanced Billing site. +Creates a product in your Advanced Billing site. + +See the following product docuemation for more information: + [Products Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview) + [Changing a Subscription's Product](https://maxio.zendesk.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations) @@ -135,7 +137,7 @@ catch (ApiException e) # Read Product -This endpoint allows you to read the current details of a product that you've created in Advanced Billing. +Reads the current details of a product. ```csharp ReadProductAsync( @@ -213,7 +215,7 @@ catch (ApiException e) # Update Product -Use this method to change aspects of an existing product. +Updates aspects of an existing product. ### Input Attributes Update Notes @@ -312,7 +314,7 @@ catch (ApiException e) # Archive Product -Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. +Archives the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product. @@ -398,7 +400,7 @@ catch (ApiException e) # Read Product by Handle -This method allows to retrieve a Product object by its `api_handle`. +Retrieves a Product object by its `api_handle`. ```csharp ReadProductByHandleAsync( @@ -542,7 +544,7 @@ ListProductsInput listProductsInput = new ListProductsInput 3, }, }, - Page = 2, + Page = 1, PerPage = 50, IncludeArchived = true, Include = ListProductsInclude.PrepaidProductPricePoint, diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md index 7882d7a3..d01de43b 100644 --- a/doc/controllers/proforma-invoices.md +++ b/doc/controllers/proforma-invoices.md @@ -176,7 +176,7 @@ catch (ApiException e) This endpoint will create a proforma invoice and return it as a response. If the information becomes outdated, simply void the old proforma invoice and generate a new one. -If you would like to preview the next billing amounts without generating a full proforma invoice, please use the renewal preview endpoint. +If you would like to preview the next billing amounts without generating a full proforma invoice, use the renewal preview endpoint. ## Restrictions @@ -256,7 +256,7 @@ ListProformaInvoicesAsync( ListProformaInvoicesInput listProformaInvoicesInput = new ListProformaInvoicesInput { SubscriptionId = 222, - Page = 2, + Page = 1, PerPage = 50, Direction = Direction.Desc, LineItems = false, diff --git a/doc/controllers/reason-codes.md b/doc/controllers/reason-codes.md index baa331e7..4c358ff9 100644 --- a/doc/controllers/reason-codes.md +++ b/doc/controllers/reason-codes.md @@ -106,7 +106,7 @@ ListReasonCodesAsync( ```csharp ListReasonCodesInput listReasonCodesInput = new ListReasonCodesInput { - Page = 2, + Page = 1, PerPage = 50, }; diff --git a/doc/controllers/sales-commissions.md b/doc/controllers/sales-commissions.md index 0ac93d15..b5cca93a 100644 --- a/doc/controllers/sales-commissions.md +++ b/doc/controllers/sales-commissions.md @@ -23,7 +23,7 @@ Endpoint returns subscriptions with associated sales reps The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). -Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. +Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. > Note: The request is at seller level, it means `<>` variable will be replaced by `app` @@ -53,7 +53,7 @@ ListSalesCommissionSettingsInput listSalesCommissionSettingsInput = new ListSale { SellerId = "seller_id8", Authorization = "Bearer <>", - Page = 2, + Page = 1, PerPage = 100, }; @@ -111,7 +111,7 @@ Endpoint returns sales rep list with details The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). -Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. +Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. > Note: The request is at seller level, it means `<>` variable will be replaced by `app` @@ -141,7 +141,7 @@ ListSalesRepsInput listSalesRepsInput = new ListSalesRepsInput { SellerId = "seller_id8", Authorization = "Bearer <>", - Page = 2, + Page = 1, PerPage = 100, }; @@ -248,7 +248,7 @@ Endpoint returns sales rep and attached subscriptions details. The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). -Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. +Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. > Note: The request is at seller level, it means `<>` variable will be replaced by `app` @@ -283,7 +283,7 @@ ReadSalesRepAsync( string sellerId = "seller_id8"; string salesRepId = "sales_rep_id4"; string authorization = "Bearer <>"; -int? page = 2; +int? page = 1; int? perPage = 100; try { diff --git a/doc/controllers/sites.md b/doc/controllers/sites.md index c52bdcfb..da22533a 100644 --- a/doc/controllers/sites.md +++ b/doc/controllers/sites.md @@ -170,7 +170,7 @@ ListChargifyJsPublicKeysAsync( ```csharp ListChargifyJsPublicKeysInput listChargifyJsPublicKeysInput = new ListChargifyJsPublicKeysInput { - Page = 2, + Page = 1, PerPage = 50, }; diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index b6fd4b12..575ba54e 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -612,7 +612,7 @@ ListAllocationsAsync( ```csharp int subscriptionId = 222; int componentId = 222; -int? page = 2; +int? page = 1; try { List result = await subscriptionComponentsController.ListAllocationsAsync( @@ -1113,34 +1113,35 @@ catch (ApiException e) # Create Usage -## Documentation +Records an instance of metered or prepaid usage for a subscription. + +You can report metered or prepaid usage to Advanced Billing as often as you wish. You can report usage as it happens or periodically, such as each night or once per billing period. -Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, please see the following resources: +Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, see the following resources: -+ [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage) -+ [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status) +It is not possible to record metered usage for more than one component at a time Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. -You may choose to report metered or prepaid usage to Advanced Billing as often as you wish. You may report usage as it happens. You may also report usage periodically, such as each night or once per billing period. If usage events occur in your system very frequently (on the order of thousands of times an hour), it is best to accumulate usage into batches on your side, and then report those batches less frequently, such as daily. This will ensure you remain below any API throttling limits. If your use case requires higher rates of usage reporting, we recommend utilizing Events Based Components. +See the following product documention articles for more information: -## Create Usage for Subscription +- [Create and Manage Components](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). A +- [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage) +- [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status) -This endpoint allows you to record an instance of metered or prepaid usage for a subscription. The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](./b3A6MTQxMDgzNzQ-read-subscription-component) for the subscription. +The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](../../doc/controllers/subscription-components.md#read-subscription-component) for the subscription. ## Price Point ID usage -If you are using price points, for metered and prepaid usage components, Advanced Billing gives you the option to specify a price point in your request. +If you are using price points, for metered and prepaid usage components Advanced Billing gives you the option to specify a price point in your request. You do not need to specify a price point ID. If a price point is not included, the default price point for the component will be used when the usage is recorded. -If an invalid `price_point_id` is submitted, the endpoint will return an error. - ## Deducting Usage -In the event that you need to reverse a previous usage report or otherwise deduct from the current usage balance, you may provide a negative quantity. +If you need to reverse a previous usage report or otherwise deduct from the current usage balance, you can provide a negative quantity. Example: -Previously recorded: +Previously recorded quantity was 5000: ```json { @@ -1151,7 +1152,7 @@ Previously recorded: } ``` -At this point, `unit_balance` would be `5000`. To reduce the balance to `0`, POST the following payload: +To reduce the quantity to `0`, POST the following payload: ```json { @@ -1164,12 +1165,6 @@ At this point, `unit_balance` would be `5000`. To reduce the balance to `0`, POS The `unit_balance` has a floor of `0`; negative unit balances are never allowed. For example, if the usage balance is 100 and you deduct 200 units, the unit balance would then be `0`, not `-100`. -## FAQ - -Q. Is it possible to record metered usage for more than one component at a time? - -A. No. Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. - ```csharp CreateUsageAsync( CreateUsageSubscriptionIdOrReference subscriptionIdOrReference, @@ -1292,7 +1287,7 @@ ListUsagesInput listUsagesInput = new ListUsagesInput { SubscriptionIdOrReference = ListUsagesInputSubscriptionIdOrReference.FromNumber(234), ComponentId = ListUsagesInputComponentId.FromNumber(144), - Page = 2, + Page = 1, PerPage = 50, }; @@ -1625,7 +1620,7 @@ ListSubscriptionComponentsForSiteAsync( ```csharp ListSubscriptionComponentsForSiteInput listSubscriptionComponentsForSiteInput = new ListSubscriptionComponentsForSiteInput { - Page = 2, + Page = 1, PerPage = 50, Sort = ListSubscriptionComponentsSort.UpdatedAt, Filter = new ListSubscriptionComponentsForSiteFilter diff --git a/doc/controllers/subscription-group-invoice-account.md b/doc/controllers/subscription-group-invoice-account.md index 5b33c2fa..913566c4 100644 --- a/doc/controllers/subscription-group-invoice-account.md +++ b/doc/controllers/subscription-group-invoice-account.md @@ -99,7 +99,7 @@ ListPrepaymentsForSubscriptionGroupAsync( ListPrepaymentsForSubscriptionGroupInput listPrepaymentsForSubscriptionGroupInput = new ListPrepaymentsForSubscriptionGroupInput { Uid = "uid0", - Page = 2, + Page = 1, PerPage = 50, Filter = new ListPrepaymentsFilter { diff --git a/doc/controllers/subscription-group-status.md b/doc/controllers/subscription-group-status.md index 8b1f01da..c2e15592 100644 --- a/doc/controllers/subscription-group-status.md +++ b/doc/controllers/subscription-group-status.md @@ -18,9 +18,9 @@ SubscriptionGroupStatusController subscriptionGroupStatusController = client.Sub # Cancel Subscriptions in Group -This endpoint will immediately cancel all subscriptions within the specified group. The group is identified by it's `uid` passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members as well must be on automatic billing or they must be prepaid. +Cancels all subscriptions within the specified group immediately. The group is identified by the `uid` that is passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members must be on automatic billing or prepaid. -In order to cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. +To cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. ```csharp CancelSubscriptionsInGroupAsync( @@ -71,7 +71,7 @@ catch (ApiException e) # Initiate Delayed Cancellation for Group -This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by it's uid passed in the URL. +This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by its uid passed in the URL. All subscriptions in the group must be on automatic billing in order to successfully cancel them, and the group must not be in a "past_due" state. diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md index 853a9e4c..6eff214b 100644 --- a/doc/controllers/subscription-groups.md +++ b/doc/controllers/subscription-groups.md @@ -32,6 +32,8 @@ You must provide one and only one of the `payment_profile_id`/`credit_card_attri Only one of the `subscriptions` can have `"primary": true` attribute set. When passing product to a subscription you can use either `product_id` or `product_handle` or `offer_id`. You can also use `custom_price` instead. +The subscription request examples below will be split into two sections. +The first section, "Subscription Customization", will focus on passing different information with a subscription, such as components, calendar billing, and custom fields. These examples will presume you are using a secure chargify_token generated by Chargify.js. ```csharp SignupWithSubscriptionGroupAsync( @@ -200,7 +202,7 @@ ListSubscriptionGroupsAsync( ```csharp ListSubscriptionGroupsInput listSubscriptionGroupsInput = new ListSubscriptionGroupsInput { - Page = 2, + Page = 1, PerPage = 50, Include = new List { @@ -571,7 +573,7 @@ For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/ Passing `group` parameters with a `target` containing a `type` and optional `id` is all that's needed. When the `target` parameter specifies a `"customer"` or `"subscription"` that is already part of a hierarchy, the subscription will become a member of the customer's subscription group. If the target customer or subscription is not part of a subscription group, a new group will be created and the subscription will become part of the group with the specified target customer set as the responsible payer for the group's subscriptions. -**Please Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. +**Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. Rather than specifying a customer, the `target` parameter could instead simply have a value of @@ -579,7 +581,7 @@ Rather than specifying a customer, the `target` parameter could instead simply h * `"parent"` which indicates the subscription will be paid for by the subscribing customer's parent within a customer hierarchy, or * `"eldest"` which indicates the subscription will be paid for by the root-level customer in the subscribing customer's hierarchy. -To create a new subscription into a subscription group, please reference the following: +To create a new subscription into a subscription group, reference the following: [Create Subscription in a Subscription Group](https://developers.chargify.com/docs/api-docs/d571659cf0f24-create-subscription#subscription-in-a-subscription-group) ```csharp diff --git a/doc/controllers/subscription-invoice-account.md b/doc/controllers/subscription-invoice-account.md index f520f766..9b3f6e54 100644 --- a/doc/controllers/subscription-invoice-account.md +++ b/doc/controllers/subscription-invoice-account.md @@ -62,7 +62,7 @@ In order to specify a prepayment made against a subscription, specify the `amoun When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. -Please note that you **can't** pass `amount_in_cents`. +Note that passing `amount_in_cents` is now allowed. ```csharp CreatePrepaymentAsync( @@ -161,7 +161,7 @@ ListPrepaymentsAsync( ListPrepaymentsInput listPrepaymentsInput = new ListPrepaymentsInput { SubscriptionId = 222, - Page = 2, + Page = 1, PerPage = 50, Filter = new ListPrepaymentsFilter { @@ -360,7 +360,7 @@ ListServiceCreditsAsync( ```csharp int subscriptionId = 222; -int? page = 2; +int? page = 1; int? perPage = 50; try { diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md index 47963cdd..f61cbf3d 100644 --- a/doc/controllers/subscription-notes.md +++ b/doc/controllers/subscription-notes.md @@ -107,7 +107,7 @@ ListSubscriptionNotesAsync( ListSubscriptionNotesInput listSubscriptionNotesInput = new ListSubscriptionNotesInput { SubscriptionId = 222, - Page = 2, + Page = 1, PerPage = 50, }; diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md index 2d334717..25732dcb 100644 --- a/doc/controllers/subscription-products.md +++ b/doc/controllers/subscription-products.md @@ -30,11 +30,11 @@ Full documentation on how to record Migrations in the Advanced Billing UI can be ## Failed Migrations -One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to it's current product. Please be aware of this issue! +Importaint note: One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to its current product. ## Migration 3D Secure - Stripe -It may happen that a payment needs 3D Secure Authentication when the subscription is migrated to a new product; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: +When a payment requires 3D Secure Authentication to adhear to Strong Customer Authentication (SCA) when the subscription is migrated to a new product, the request enters a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: ```json { @@ -62,7 +62,7 @@ The final URL that you send a customer to to complete 3D Secure may resemble the ### Example Redirect Flow -You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference: +You may wish to redirect customers to different pages depending on whether SCA was performed successfully. Here's an example flow to use as a reference: 1. Create a migration via API; it requires 3DS 2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 5d95b5c7..5a393aa6 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -545,7 +545,7 @@ This will place the subscription in the on_hold state and it will not renew. ## Limitations -You may not place a subscription on hold if the `next_billing` date is within 24 hours. +You may not place a subscription on hold if the `next_billing_at` date is within 24 hours. ```csharp PauseSubscriptionAsync( @@ -894,8 +894,7 @@ catch (ApiException e) Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). -**Please note: The term -"resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.** +**Note: The term "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.** + The response returns the subscription object in the `active` or `trialing` state. + The `canceled_at` and `cancellation_message` fields do not have values. @@ -1361,7 +1360,7 @@ catch (ApiException e) The Chargify API allows you to preview a renewal by posting to the renewals endpoint. Renewal Preview is an object representing a subscription’s next assessment. You can retrieve it to see a snapshot of how much your customer will be charged on their next renewal. -The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). +The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). ## Optional Component Fields diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 4041232c..e9ccf660 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -26,624 +26,21 @@ SubscriptionsController subscriptionsController = client.SubscriptionsController # Create Subscription -Full documentation on how subscriptions operate within Advanced Billing can be located under the following topics: +Creates a Subscription for a customer and product -+ [Subscriptions Reference](https://maxio.zendesk.com/hc/en-us/articles/24251526991757-Subscription-Overview) -+ [Subscriptions Actions](https://maxio.zendesk.com/hc/en-us/articles/24251983024653-Subscription-Actions-Overview) -+ [Subscription Cancellation](https://maxio.zendesk.com/hc/en-us/articles/24251957778829-Cancel-Subscriptions) -+ [Subscription Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming) -+ [Subscription Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) +Specify the product with `product_id` or `product_handle`. To set a specific product pricepPoint, use `product_price_point_handle` or `product_price_point_id`. -When creating a subscription, you must specify a product and a customer. Credit card details may be required, depending on the options for the Product being subscribed ([see Product Options](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing)). +Identify an existing customer with `customer_id` or `customer_reference`. Optionally, include an existing payment profile using `payment_profile_id`. To create a new customer, pass customer_attributes. -The product may be specified by `product_id` or by `product_handle` (API Handle). In similar fashion, to pass a particular product price point, you may either use `product_price_point_handle` or `product_price_point_id`. +Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating subscriptions. -An existing customer may be specified by a `customer_id` (ID within Advanced Billing) or a `customer_reference` (unique value within your app that you have shared with Advanced Billing via the reference attribute on a customer). You may also pass in an existing payment profile for that customer with `payment_profile_id`. A new customer may be created by providing `customer_attributes`. +Payment information may be required to create a subscription, depending on the options for the Product being subscribed. See [product options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Products) for more information. See the [Payments Profile](../../doc/controllers/payment-profiles.md#create-payment-profile) endpoint for details on payment parameters. -Credit card details may be required, depending on the options for the product being subscribed. The product can be specified by `product_id` or by `product_handle` (API Handle). +Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. -If you are creating a subscription with a payment profile, the attribute to send will be `credit_card_attributes` or `bank_account_attributes` for ACH and Direct Debit. That said, when you read the subscription after creation, we return the profile details under `credit_card` or `bank_account`. +Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. -## Bulk creation of subscriptions - -Bulk creation of subscriptions is currently not supported. For scenarios where multiple subscriptions must be added, particularly when assigning to the same subscription group, it is essential to switch to a single-threaded approach. - -To avoid data conflicts or inaccuracies, incorporate a sleep interval between requests. - -While this single-threaded approach may impact performance, it ensures data consistency and accuracy in cases where concurrent creation attempts could otherwise lead to issues with subscription alignment and integrity. - -## Taxable Subscriptions - -If your intent is to charge your subscribers tax via [Avalara Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara-VAT-Tax) or [Custom Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-Taxes), there are a few considerations to be made regarding collecting subscription data. -For subscribers to be eligible to be taxed, the following information for the `customer` object or `payment_profile` object must by supplied: - -+ A subscription to a [taxable product](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing#tax-settings) -+ [Full valid billing or shipping address](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanced-Billing-Managed-Sales-Tax#full-address-required-for-taxable-subscriptions) to identify the tax locale -+ The portion of the address that houses the [state information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanced-Billing-Managed-Sales-Tax#required-state-format-for-taxable-subscriptions) of either adddress must adhere to the ISO standard of a 2-3 character limit/format. -+ The portion of the address that houses the [country information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanced-Billing-Managed-Sales-Tax#required-country-format-for-taxable-subscriptions) must adhere to the ISO standard of a 2 character limit/format. - -## Subscription Request Examples - -The subscription examples below will be split into two sections. - -The first section, "Subscription Customization", will focus on passing different information with a subscription, such as components, calendar billing, and custom fields. These examples will presume you are using a secure `chargify_token` generated by Chargify.js. - -The second section, "Passing Payment Information", will focus on passing payment information into Advanced Billing. Please be aware that collecting and sending Advanced Billing raw card details requires PCI compliance on your end; these examples are provided as guidance. If your business is not PCI compliant, we recommend using Chargify.js to collect credit cards or bank accounts. - -# Subscription Customization - -## With Components - -Different components require slightly different data. For example, quantity-based and on/off components accept `allocated_quantity`, while metered components accept `unit_balance`. - -When creating a subscription with a component, a `price_point_id` can be passed in along with the `component_id` to specify which price point to use. If not passed in, the default price point will be used. - -Note: if an invalid `price_point_id` is used, the subscription will still proceed but will use the component's default price point. - -Components and their price points may be added by ID or by handle. See the example request body labeled "Components By Handle (Quantity-Based)"; the format will be the same for other component types. - -## With Coupon(s) - -Pass an array of `coupon_codes`. See the example request body "With Coupon". - -## With Manual Invoice Collection - -The `invoice` collection method works only on legacy Statement Architecture. - -On Relationship Invoicing Architecture use the `remittance` collection method. - -## Prepaid Subscription - -A prepaid subscription can be created with the usual subscription creation parameters, specifying `prepaid` as the `payment_collection_method` and including a nested `prepaid_configuration`. - -After a prepaid subscription has been created, additional funds can be manually added to the prepayment account through the [Create Prepayment Endpoint](https://developers.chargify.com/docs/api-docs/7ec482de77ba7-create-prepayment). - -Prepaid subscriptions do not work on legacy Statement Architecture. - -## With Metafields - -Metafields can either attach to subscriptions or customers. Metafields are popuplated with the supplied metadata to the resource specified. - -If the metafield doesn't exist yet, it will be created on-the-fly. - -## With Custom Pricing - -Custom pricing is pricing specific to the subscription in question. -Create a subscription with custom pricing by passing pricing information instead of a price point. -For a custom priced product, pass the custom_price object in place of `product_price_point_id`. For a custom priced component, pass the `custom_price` object within the component object. -Custom prices and price points can exist in harmony on a subscription. - -# Passing Payment Information - -## Subscription with Chargify.js token - -The `chargify_token` can be obtained using [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0). The token represents payment profile attributes that were provided by the customer in their browser and stored at the payment gateway. - -The `payment_type` attribute may either be `credit_card` or `bank_account`, depending on the type of payment method being added. If a bank account is being passed, the payment attributes should be changed to `bank_account_attributes`. - -```json -{ - "subscription": { - "product_handle": "pro-plan", - "customer_attributes": { - "first_name": "Joe", - "last_name": "Smith", - "email": "j.smith@example.com" - }, - "credit_card_attributes": { - "chargify_token": "tok_cwhvpfcnbtgkd8nfkzf9dnjn", - "payment_type": "credit_card" - } - } -} -``` - -## Subscription with vault token - -If you already have a customer and card stored in your payment gateway, you may create a subscription with a `vault_token`. Providing the last_four, card type and expiration date will allow the card to be displayed properly in the Advanced Billing UI. - -```json -{ - "subscription": { - "product_handle": "pro-plan", - "customer_attributes": { - "first_name": "Joe", - "last_name": "Smith", - "email": "j.smith@example.com" - }, - "credit_card_attributes": { - first_name: "Joe, - last_name: "Smith", - card_type: "visa", - expiration_month: "05", - expiration_year: "2025", - last_four: "1234", - vault_token: "12345abc", - current_vault: "braintree_blue" - } -} -``` - -## Subscription with ACH as Payment Profile - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Joe", - "last_name": "Blow", - "email": "joe@example.com", - "zip": "02120", - "state": "MA", - "reference": "XYZ", - "phone": "(617) 111 - 0000", - "organization": "Acme", - "country": "US", - "city": "Boston", - "address_2": null, - "address": "123 Mass Ave." - }, - "bank_account_attributes": { - "bank_name": "Best Bank", - "bank_routing_number": "021000089", - "bank_account_number": "111111111111", - "bank_account_type": "checking", - "bank_account_holder_type": "business", - "payment_type": "bank_account" - } - } -} -``` - -## Subscription with PayPal payment profile - -### With the nonce from Braintree JS - -```json -{ "subscription": { - "product_handle":"test-product-b", - "customer_attributes": { - "first_name":"Amelia", - "last_name":"Johnson", - "email":"amelia@example.com", - "organization":"My Awesome Company" - }, - "payment_profile_attributes":{ - "paypal_email": "amelia@example.com", - "current_vault": "braintree_blue", - "payment_method_nonce":"abc123", - "payment_type":"paypal_account" - } - } -``` - -### With the Braintree Customer ID as the vault token: - -```json -{ "subscription": { - "product_handle":"test-product-b", - "customer_attributes": { - "first_name":"Amelia", - "last_name":"Johnson", - "email":"amelia@example.com", - "organization":"My Awesome Company" - }, - "payment_profile_attributes":{ - "paypal_email": "amelia@example.com", - "current_vault": "braintree_blue", - "vault_token":"58271347", - "payment_type":"paypal_account" - } - } -``` - -## Subscription using GoCardless Bank Number - -These examples creates a customer, bank account and mandate in GoCardless. - -For more information on GoCardless, please view the following two resources: - -+ [Payment Profiles via API for GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#gocardless) - -+ [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless) - -+ [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) - -+ [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Royal Bank of France", - "bank_account_number": "0000000", - "bank_routing_number": "0003", - "bank_branch_code": "00006", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } - } -} -``` - -## Subscription using GoCardless IBAN Number - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "French Bank", - "bank_iban": "FR1420041010050500013M02606", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } - } -} -``` - -## Subscription using Stripe SEPA Direct Debit - -For more information on Stripe Direct Debit, please view the following two resources: - -+ [Payment Profiles via API for Stripe SEPA Direct Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#sepa-direct-debit) - -+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe SEPA Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_iban": "DE89370400440532013000", - "payment_type": "bank_account" - } - } -} -``` - -## Subscription using Stripe BECS Direct Debit - -For more information on Stripe Direct Debit, please view the following two resources: - -+ [Payment Profiles via API for Stripe BECS Direct Debit](../../doc/controllers/payment-profiles.md#create-payment-profile) - -+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe BECS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRX4B1TYZKZD8ZND6D) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_branch_code": "000000", - "bank_account_number": "000123456", - "payment_type": "bank_account" - } - } -} -``` - -## Subscription using Stripe BACS Direct Debit - -For more information on Stripe Direct Debit, please view the following two resources: - -+ [Payment Profiles via API for Stripe BACS Direct Debit](../../doc/controllers/payment-profiles.md#create-payment-profile) - -+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe BACS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR7PA1DJ3XE9MD05FM) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_branch_code": "108800", - "bank_account_number": "00012345", - "payment_type": "bank_account", - "billing_address": "123 Main St.", - "billing_city": "London", - "billing_state": "LND", - "billing_zip": "W1A 1AA", - "billing_country": "GB" - } - } -} -``` - -## 3D Secure - Stripe - -It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: - -```json -{ - "errors": [ - "Your card was declined. This transaction requires 3D secure authentication." - ], - "gateway_payment_id": "pi_1F0aGoJ2UDb3Q4av7zU3sHPh", - "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.", - "action_link": "http://acme.chargify.com/3d-secure/pi_1F0aGoJ2UDb3Q4av7zU3sHPh?one_time_token_id=242" -} -``` - -To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. -Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information: - -- whether the authentication was successful (`success`) -- the gateway ID for the payment (`gateway_payment_id`) -- the subscription ID (`subscription_id`) - -Lastly, you can also specify a `redirect_url` within the `action_link` URL if you’d like to redirect a customer back to your site. - -It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - -The final URL that you send a customer to to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com` - -## 3D Secure - Checkout - -It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: - -```json -{ - "errors": [ - "Your card was declined. This transaction requires 3D secure authentication." - ], - "gateway_payment_id": "pay_6gjofv7dlyrkpizlolsuspvtiu", - "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.", - "action_link": "http://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123" -} -``` - -To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. -Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information: - -- whether the authentication was successful (`success`) -- the gateway ID for the payment (`gateway_payment_id`) -- the subscription ID (`subscription_id`) - -Lastly, you can also specify a `redirect_url` parameter within the `action_link` URL if you’d like to redirect a customer back to your site. - -It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - -The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com` - -### Example Redirect Flow - -You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference: - -1. Create a subscription via API; it requires 3DS -2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. -3. Use this `gateway_payment_id` to, for example, connect with your internal resources or generate a session_id -4. Include 1 of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to -5. Redirect the customer to the `action_link` with `callback_url` and `redirect_url` applied -6. After the customer finishes 3DS authentication, we let you know the result by making a request to applied `callback_url`. -7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known -8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not - -## Subscriptions Import - -Subscriptions can be “imported” via the API to handle the following scenarios: - -+ You already have existing subscriptions with specific start and renewal dates that you would like to import to Advanced Billing -+ You already have credit cards stored in your provider’s vault and you would like to create subscriptions using those tokens - -Before importing, you should have already set up your products to match your offerings. Then, you can create Subscriptions via the API just like you normally would, but using a few special attributes. - -Full documentation on how import Subscriptions using the **import tool** in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports). - -### Important Notices and Disclaimers regarding Imports - -Before performing a bulk import of subscriptions via the API, we suggest reading the [Subscriptions Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) instructions to understand the repurcussions of a large import. - -### Subscription Input Attributes - -The following _additional_ attributes to the subscription input attributes make imports possible: `next_billing_at`, `previous_billing_at`, and `import_mrr`. - -### Current Vault - -If you are using a Legacy gateway such as "eWAY Rapid (Legacy)" or "Stripe (Legacy)" then please contact Support for further instructions on subscription imports. - -### Braintree Blue (Braintree v2) Imports - -Braintree Blue is Braintree’s newer (version 2) API. For this gateway, please provide the `vault_token` parameter with the value from Braintree’s “Customer ID” rather than the “Payment Profile Token”. At this time we do not use `current_vault_token` with the Braintree Blue gateway, and we only support a single payment profile per Braintree Customer. - -When importing PayPal type payment profiles, please set `payment_type` to `paypal_account`. - -### Stripe ACH Imports - -If the bank account has already been verified, currently you will need to create the customer, create the payment profile in Advanced Billing - setting verified=true, then create a subscription using the customer_id and payment_profile_id. - -### Webhooks During Import - -If no `next_billing_at` is provided, webhooks will be fired as normal. If you do set a future `next_billing_at`, only a subset of the webhooks are fired when the subscription is created. Keep reading for more information as to what webhooks will be fired under which scenarios. - -#### Successful creation with Billing Date - -Scenario: If `next_billing_at` provided - -+ `signup_success` -+ `billing_date_change` - -#### Successful creation without Billing Date - -Scenario: If no `next_billing_at` provided - -+ `signup_success` -+ `payment_success` - -#### Unsuccessful creation - -Scenario: If card can’t be charged, and no `next_billing_at` provided - -+ signup_failure - -#### Webhooks fired when next_billing_at is reached: - -+ `renewal_success or renewal_failure` -+ `payment_success or payment_failure` - -### Date and Time Formats - -We will attempt to parse any string you send as the value of next_billing_at in to a date or time. For best results, use a known format like described in “Date and Time Specification” of RFC 2822 or ISO 8601 . - -The following are all equivalent and will work as input to `next_billing_at`: - -``` -Aug 06 2030 11:34:00 -0400 -Aug 06 2030 11:34 -0400 -2030-08-06T11:34:00-04:00 -8/6/2030 11:34:00 EDT -8/6/2030 8:34:00 PDT -2030-08-06T15:34:00Z -``` - -You may also pass just a date, in which case we will assume the time to be noon - -``` -2010-08-06 -``` - -## Subscription Hierarchies & WhoPays - -When subscription groups were first added to our Relationship Invoicing architecture, to group together invoices for related subscriptions and allow for complex customer hierarchies and WhoPays scenarios, they were designed to consist of a primary and a collection of group members. The primary would control many aspects of the group, such as when the consolidated invoice is generated. As of today, groups still function this way. - -In the future, the concept of a "primary" will be removed in order to offer more flexibility into group management and reduce confusion concerning what actions must be done on a primary level, rather than a member level. - -We have introduced a two scheme system as a bridge between these two group organizations. Scheme 1, which is relevant to all subscription groups today, marks the group as being "ruled" by a primary. - -When reading a subscription via API, they will return a top-level attribute called `group`, which will denote which scheme is being used. At this time, the `scheme` attribute will always be 1. - -### Subscription in a Customer Hierarchy - -For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays) features, it is possible to create subscriptions within a customer hierarchy. This can be achieved through the API by passing group parameters in the **Create Subscription** request. - -+ The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - -When the `target` parameter specifies a customer that is already part of a hierarchy, the new subscription will become a member of the customer hierarchy as well. If the target customer is not part of a hierarchy, a new customer hierarchy will be created and both the target customer and the new subscription will become part of the hierarchy with the specified target customer set as the responsible payer for the hierarchy's subscriptions. - -Rather than specifying a customer, the `target` parameter could instead simply have a value of `self` which indicates the subscription will be paid for not by some other customer, but by the subscribing customer. This will be true whether the customer is being created new, is already part of a hierarchy, or already exists outside a hierarchy. A valid payment method must also be specified in the subscription parameters. - -Note that when creating subscriptions in a customer hierarchy, if the customer hierarchy does not already have a payment method, passing valid credit card attributes in the subscription parameters will also result in the payment method being established as the default payment method for the customer hierarchy irrespective of the responsible payer. - -The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the default subscription group in the customer hierarchy. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the default subscription group in the customer hierarchy also. - -### Subscription in a Subscription Group - -For sites making use of [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) it may be desireable to create a subscription as part of a [subscription group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscription-Groups-Overview) in order to rely on [invoice consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). This can be achieved through the API by passing group parameters in the Create Subscription request. The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - -The `target` parameters specify an existing subscription with which the newly created subscription should be grouped. If the target subscription is already part of a group, the new subscription will become a member of the group as well. If the target subscription is not part of a group, a new group will be created and both the target and the new subscription will become part of the group with the target as the group's primary subscription. - -The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the target subscription. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the target subscription also. - -## Providing Agreement Acceptance Params - -It is possible to provide a proof of customer's acceptance of terms and policies. -We will be storing this proof in case it might be required (i.e. chargeback). -Currently, we already keep it for subscriptions created via Public Signup Pages. -In order to create a subscription with the proof of agreement acceptance, you must provide additional parameters `agreement acceptance` with `ip_address` and at least one url to the policy that was accepted: `terms_url` or `privacy_policy_url`. Additional urls that can be provided: `return_refund_policy_url`, `delivery_policy_url` and -`secure_checkout_policy_url`. - -```json - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "agreement_acceptance": { - "ip_address": "1.2.3.4", - "terms_url": "https://terms.url", - "privacy_policy_url": "https://privacy_policy.url", - "return_refund_policy_url": "https://return_refund_policy.url", - "delivery_policy_url": "https://delivery_policy.url", - "secure_checkout_policy_url": "https://secure_checkout_policy.url" - } - } -} -``` - -**For Maxio Payments subscriptions, the agreement acceptance params are required, with at least terms_url provided.** - -## Providing ACH Agreement params - -It is also possible to provide a proof that a customer authorized ACH agreement terms. -The proof will be stored and the email will be sent to the customer with a copy of the terms (if enabled). -In order to create a subscription with the proof of authorized ACH agreement terms, you must provide the additional parameter `ach_agreement` with the following nested parameters: `agreement_terms`, `authorizer_first_name`, `authorizer_last_name` and `ip_address`. -Each of them is required. - -```json - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_routing_number": "021000089", - "bank_account_number": "111111111111", - "bank_account_type": "checking", - "bank_account_holder_type": "business", - "payment_type": "bank_account" - }, - "ach_agreement": { - "agreement_terms": "ACH agreement terms", - "authorizer_first_name": "Jane", - "authorizer_last_name": "Doe", - "ip_address": "1.2.3.4" - } - } -``` +See the [Subscription Signups](page:introduction/basic-concepts/subscription-signup) article for more information on working with subscriptions in Advanced Billing. ```csharp CreateSubscriptionAsync( @@ -672,7 +69,7 @@ CreateSubscriptionRequest body = new CreateSubscriptionRequest CustomerAttributes = new CustomerAttributes { FirstName = "Joe", - LastName = "Blow", + LastName = "Smith", Email = "joe@example.com", Organization = "Acme", Reference = "XYZ", @@ -891,7 +288,7 @@ ListSubscriptionsAsync( ```csharp ListSubscriptionsInput listSubscriptionsInput = new ListSubscriptionsInput { - Page = 2, + Page = 1, PerPage = 50, StartDate = DateTime.Parse("2022-07-01"), EndDate = DateTime.Parse("2022-08-01"), @@ -922,47 +319,55 @@ catch (ApiException e) # Update Subscription -The subscription endpoint allows you to instantly update one or many attributes about a subscription in a single call. +Updates one or more attributes of a subscription. ## Update Subscription Payment Method -Change the card that your Subscriber uses for their subscription. You can also use this method to simply change the expiration date of the card **if your gateway allows**. +Change the card that your subscriber uses for their subscription. You can also use this method to change the expiration date of the card **if your gateway allows**. -Note that partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. +Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. + +Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. + +> Note: Partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. + +## Update Product You also use this method to change the subscription to a different product by setting a new value for product_handle. A product change can be done in two different ways, **product change** or **delayed product change**. -## Product Change +### Product Change -This endpoint may be used to change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you desire complex product changes or prorated upgrades and downgrades instead, please see the documentation on Migrating Subscription Products. +You can change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you require complex product changes or prorated upgrades and downgrades instead, please see the documentation on [Migrating Subscription Products](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations#product-changes-and-migrations-0-0). -To perform a product change, simply set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point will be used. +To perform a product change, set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point is used. ### Delayed Product Change This method also changes the product and/or price point, and the new payment amount is calculated and charged at the normal start of the next period. -This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a Delayed Product Change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. +This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a delayed product change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. You can also perform a delayed change to the price point by passing in either `product_price_point_id` or `product_price_point_handle` -**Note: To cancel a delayed product change, set `next_product_id` to an empty string.** +> **Note:** To cancel a delayed product change, set `next_product_id` to an empty string. ## Billing Date Changes +You can update dates for a subscrption. + ### Regular Billing Date Changes Send the `next_billing_at` to set the next billing date for the subscription. After that date passes and the subscription is processed, the following billing date will be set according to the subscription's product period. -Note that if you pass an invalid date, we will automatically interpret and set the correct date. For example, when February 30 is entered, the next billing will be set to March 2nd in a non-leap year. +> Note: If you pass an invalid date, the correct date is automatically set to he correct date. For example, if February 30 is passed, the next billing would be set to March 2nd in a non-leap year. -The server response will not return data under the key/value pair of `next_billing`. Please view the key/value pair of `current_period_ends_at` to verify that the `next_billing` date has been changed successfully. +The server response will not return data under the key/value pair of `next_billing_at`. View the key/value pair of `current_period_ends_at` to verify that the `next_billing_at` date has been changed successfully. -### Snap Day Changes +### Calendar Billing and Snap Day Changes For a subscription using Calendar Billing, setting the next billing date is a bit different. Send the `snap_day` attribute to change the calendar billing date for **a subscription using a product eligible for calendar billing**. -Note: If you change the product associated with a subscription that contains a `snap_date` and immediately `READ/GET` the subscription data, it will still contain evidence of the existing `snap_date`. This is due to the fact that a product change is instantanous and only affects the product associated with a subscription. After the `next_billing` date arrives, the `snap_day` associated with the subscription will return to `null.` Another way of looking at this is that you willl have to wait for the next billing cycle to arrive before the `snap_date` will reset to `null`. +> Note: If you change the product associated with a subscription that contains a `snap_day` and immediately `READ/GET` the subscription data, it will still contain original `snap_day`. The `snap_day`will will reset to 'null on the next billing cycle. This is because a product change is instantanous and only affects the product associated with a subscription. ```csharp UpdateSubscriptionAsync( @@ -1443,7 +848,7 @@ For sites in test mode, you may purge individual subscriptions. Provide the subscription ID in the url. To confirm, supply the customer ID in the query string `ack` parameter. You may also delete the customer record and/or payment profiles by passing `cascade` parameters. For example, to delete just the customer record, the query params would be: `?ack={customer_id}&cascade[]=customer` -If you need to remove subscriptions from a live site, please contact support to discuss your use case. +If you need to remove subscriptions from a live site, contact support to discuss your use case. ### Delete customer and payment profile @@ -1580,7 +985,7 @@ The "Next Billing" amount and "Next Billing" date are represented in each Subscr A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction. -For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). +For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). ## Taxable Subscriptions @@ -1590,15 +995,15 @@ This endpoint will preview taxes applicable to a purchase. In order for taxes to + The preview must be for the purchase of a taxable product or component, or combination of the two. + The subscription payload must contain a full billing or shipping address in order to calculate tax -For more information about creating taxable previews, please see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes) +For more information about creating taxable previews, see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes) -You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, please note that when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. +You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` attribute. ## Non-taxable Subscriptions -If you'd like to calculate subscriptions that do not include tax, please feel free to leave off the billing information. +If you'd like to calculate subscriptions that do not include tax you may leave off the billing information. ```csharp PreviewSubscriptionAsync( @@ -1976,7 +1381,7 @@ catch (ApiException e) Use this endpoint to remove a coupon from an existing subscription. -For more information on the expected behaviour of removing a coupon from a subscription, please see our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon) +For more information on the expected behaviour of removing a coupon from a subscription, See our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon) ```csharp RemoveCouponFromSubscriptionAsync( diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md index cccc3197..d692d2ac 100644 --- a/doc/controllers/webhooks.md +++ b/doc/controllers/webhooks.md @@ -48,7 +48,7 @@ ListWebhooksAsync( ```csharp ListWebhooksInput listWebhooksInput = new ListWebhooksInput { - Page = 2, + Page = 1, PerPage = 50, }; diff --git a/doc/models/activate-event-based-component.md b/doc/models/activate-event-based-component.md index 57f0d969..b644e120 100644 --- a/doc/models/activate-event-based-component.md +++ b/doc/models/activate-event-based-component.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `PricePointId` | `int?` | Optional | The Chargify id of the price point | -| `BillingSchedule` | [`BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled | +| `BillingSchedule` | [`BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. | | `CustomPrice` | [`ComponentCustomPrice`](../../doc/models/component-custom-price.md) | Optional | Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. | ## Example (as JSON) @@ -37,7 +37,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } } ``` diff --git a/doc/models/billing-schedule.md b/doc/models/billing-schedule.md index 9b8eee7c..fd5380bf 100644 --- a/doc/models/billing-schedule.md +++ b/doc/models/billing-schedule.md @@ -1,7 +1,7 @@ # Billing Schedule -This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled +This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. ## Structure diff --git a/doc/models/bulk-create-product-price-points-request.md b/doc/models/bulk-create-product-price-points-request.md index 430c8c9c..00de016b 100644 --- a/doc/models/bulk-create-product-price-points-request.md +++ b/doc/models/bulk-create-product-price-points-request.md @@ -26,7 +26,7 @@ "trial_price_in_cents": 196, "trial_interval": 250, "trial_interval_unit": "day", - "trial_type": "trial_type6" + "trial_type": "no_obligation" } ] } diff --git a/doc/models/calendar-billing.md b/doc/models/calendar-billing.md index 49883a9b..1a250f33 100644 --- a/doc/models/calendar-billing.md +++ b/doc/models/calendar-billing.md @@ -18,7 +18,7 @@ ```json { - "snap_day": 210, + "snap_day": 28, "calendar_billing_first_charge": "prorated" } ``` diff --git a/doc/models/chargify-ebb.md b/doc/models/chargify-ebb.md index e740d325..93a13382 100644 --- a/doc/models/chargify-ebb.md +++ b/doc/models/chargify-ebb.md @@ -10,8 +10,8 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `Timestamp` | `DateTimeOffset?` | Optional | This timestamp determines what billing period the event will be billed in. If your request payload does not include it, Chargify will add `chargify.timestamp` to the event payload and set the value to `now`. | -| `Id` | `string` | Optional | A unique ID set by Chargify. Please note that this field is reserved. If `chargify.id` is present in the request payload, it will be overwritten. | -| `CreatedAt` | `DateTimeOffset?` | Optional | An ISO-8601 timestamp, set by Chargify at the time each event is recorded. Please note that this field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten. | +| `Id` | `string` | Optional | A unique ID set by Chargify. This field is reserved. If `chargify.id` is present in the request payload, it will be overwritten. | +| `CreatedAt` | `DateTimeOffset?` | Optional | An ISO-8601 timestamp, set by Chargify at the time each event is recorded. This field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten. | | `UniquenessToken` | `string` | Optional | User-defined string scoped per-stream. Duplicate events within a stream will be silently ignored. Tokens expire after 31 days.

**Constraints**: *Maximum Length*: `64` | | `SubscriptionId` | `int?` | Optional | Id of Maxio Advanced Billing Subscription which is connected to this event.
Provide `subscription_id` if you configured `chargify.subscription_id` as Subscription Identifier in your Event Stream. | | `SubscriptionReference` | `string` | Optional | Reference of Maxio Advanced Billing Subscription which is connected to this event.
Provide `subscription_reference` if you configured `chargify.subscription_reference` as Subscription Identifier in your Event Stream. | diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index 22f5045a..20a52dcf 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -16,6 +16,10 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | `Interval` | `int?` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | | `IntervalUnit` | [`IntervalUnit?`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. | | `Prices` | [`List`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1 | +| `RenewPrepaidAllocation` | `bool?` | Optional | Applicable only to prepaid usage components. Controls whether the allocated quantity renews each period. | +| `RolloverPrepaidRemainder` | `bool?` | Optional | Applicable only to prepaid usage components. Controls whether remaining units roll over to the next period. | +| `ExpirationInterval` | `int?` | Optional | Applicable only when rollover is enabled. Number of `expiration_interval_unit`s after which rollover amounts expire. | +| `ExpirationIntervalUnit` | [`ExpirationIntervalUnit?`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only when rollover is enabled. Interval unit for rollover expiration (month or day). | ## Example (as JSON) @@ -31,7 +35,8 @@ Create or update custom pricing unique to the subscription. Used in place of `pr "tax_included": false, "pricing_scheme": "stairstep", "interval": 162, - "interval_unit": "day" + "interval_unit": "day", + "renew_prepaid_allocation": false } ``` diff --git a/doc/models/component.md b/doc/models/component.md index 34192fd9..7d0f5be2 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -21,7 +21,6 @@ | `PricePerUnitInCents` | `long?` | Optional | deprecated - use unit_price instead | | `Kind` | [`ComponentKind?`](../../doc/models/component-kind.md) | Optional | A handle for the component type | | `Archived` | `bool?` | Optional | Boolean flag describing whether a component is archived or not. | -| `Taxable` | `bool?` | Optional | Boolean flag describing whether a component is taxable or not. | | `Description` | `string` | Optional | The description of the component. | | `DefaultPricePointId` | `int?` | Optional | - | | `OveragePrices` | [`List`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | @@ -29,7 +28,8 @@ | `PricePointCount` | `int?` | Optional | Count for the number of price points associated with the component | | `PricePointsUrl` | `string` | Optional | URL that points to the location to read the existing price points via GET request | | `DefaultPricePointName` | `string` | Optional | - | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `Taxable` | `bool?` | Optional | Boolean flag describing whether a component is taxable or not. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `Recurring` | `bool?` | Optional | - | | `UpgradeCharge` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | | `DowngradeCredit` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | diff --git a/doc/models/containers/calendar-billing-snap-day.md b/doc/models/containers/calendar-billing-snap-day.md index ab6aa137..1230998b 100644 --- a/doc/models/containers/calendar-billing-snap-day.md +++ b/doc/models/containers/calendar-billing-snap-day.md @@ -10,5 +10,5 @@ | Type | Factory Method | | --- | --- | | `int` | CalendarBillingSnapDay.FromNumber(int number) | -| `string` | CalendarBillingSnapDay.FromString(string mString) | +| [`SnapDay`](../../../doc/models/snap-day.md) | CalendarBillingSnapDay.FromSnapDay(SnapDay snapDay) | diff --git a/doc/models/containers/subscription-snap-day.md b/doc/models/containers/subscription-snap-day.md new file mode 100644 index 00000000..1ebe31ea --- /dev/null +++ b/doc/models/containers/subscription-snap-day.md @@ -0,0 +1,14 @@ + +# Subscription Snap Day + +## Class Name + +`SubscriptionSnapDay` + +## Cases + +| Type | Factory Method | +| --- | --- | +| `int` | SubscriptionSnapDay.FromNumber(int number) | +| [`SnapDay`](../../../doc/models/snap-day.md) | SubscriptionSnapDay.FromSnapDay(SnapDay snapDay) | + diff --git a/doc/models/containers/update-subscription-snap-day.md b/doc/models/containers/update-subscription-snap-day.md index 145fc3f4..560d6aeb 100644 --- a/doc/models/containers/update-subscription-snap-day.md +++ b/doc/models/containers/update-subscription-snap-day.md @@ -9,6 +9,6 @@ | Type | Factory Method | | --- | --- | -| [`SnapDay`](../../../doc/models/snap-day.md) | UpdateSubscriptionSnapDay.FromSnapDay(SnapDay snapDay) | | `int` | UpdateSubscriptionSnapDay.FromNumber(int number) | +| [`SnapDay`](../../../doc/models/snap-day.md) | UpdateSubscriptionSnapDay.FromSnapDay(SnapDay snapDay) | diff --git a/doc/models/create-allocation.md b/doc/models/create-allocation.md index d8acb217..576a62aa 100644 --- a/doc/models/create-allocation.md +++ b/doc/models/create-allocation.md @@ -19,7 +19,7 @@ | `UpgradeCharge` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | | `InitiateDunning` | `bool?` | Optional | If set to true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. Defaults to false. | | `PricePointId` | [`CreateAllocationPricePointId`](../../doc/models/containers/create-allocation-price-point-id.md) | Optional | This is a container for one-of cases. | -| `BillingSchedule` | [`BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled | +| `BillingSchedule` | [`BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. | ## Example (as JSON) diff --git a/doc/models/create-invoice-coupon.md b/doc/models/create-invoice-coupon.md index 17f89d44..1b94012d 100644 --- a/doc/models/create-invoice-coupon.md +++ b/doc/models/create-invoice-coupon.md @@ -10,6 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `Code` | `string` | Optional | - | +| `Subcode` | `string` | Optional | - | | `Percentage` | [`CreateInvoiceCouponPercentage`](../../doc/models/containers/create-invoice-coupon-percentage.md) | Optional | This is a container for one-of cases. | | `Amount` | [`CreateInvoiceCouponAmount`](../../doc/models/containers/create-invoice-coupon-amount.md) | Optional | This is a container for one-of cases. | | `Description` | `string` | Optional | **Constraints**: *Maximum Length*: `255` | @@ -22,9 +23,9 @@ { "percentage": 50.0, "code": "code4", + "subcode": "subcode8", "amount": "String9", - "description": "description4", - "product_family_id": "String3" + "description": "description4" } ``` diff --git a/doc/models/create-invoice-item.md b/doc/models/create-invoice-item.md index 342e6e77..7d424a25 100644 --- a/doc/models/create-invoice-item.md +++ b/doc/models/create-invoice-item.md @@ -12,8 +12,8 @@ | `Title` | `string` | Optional | - | | `Quantity` | [`CreateInvoiceItemQuantity`](../../doc/models/containers/create-invoice-item-quantity.md) | Optional | This is a container for one-of cases. | | `UnitPrice` | [`CreateInvoiceItemUnitPrice`](../../doc/models/containers/create-invoice-item-unit-price.md) | Optional | This is a container for one-of cases. | -| `Taxable` | `bool?` | Optional | Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes.

If using Avalara, a tax_code parameter must also be sent. | -| `TaxCode` | `string` | Optional | - | +| `Taxable` | `bool?` | Optional | Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. If using AvaTax, a tax_code parameter must also be sent. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `PeriodRangeStart` | `string` | Optional | YYYY-MM-DD | | `PeriodRangeEnd` | `string` | Optional | YYYY-MM-DD | | `ProductId` | [`CreateInvoiceItemProductId`](../../doc/models/containers/create-invoice-item-product-id.md) | Optional | This is a container for one-of cases. | diff --git a/doc/models/create-metafield.md b/doc/models/create-metafield.md index d2c20b91..876bd68a 100644 --- a/doc/models/create-metafield.md +++ b/doc/models/create-metafield.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | | `Name` | `string` | Optional | - | | `Scope` | [`MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | -| `InputType` | [`MetafieldInput?`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' | +| `InputType` | [`MetafieldInput?`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | | `Enum` | `List` | Optional | Only applicable when input_type is radio or dropdown. Empty strings will not be submitted. | ## Example (as JSON) diff --git a/doc/models/create-or-update-product.md b/doc/models/create-or-update-product.md index 2d22ee50..dc771e43 100644 --- a/doc/models/create-or-update-product.md +++ b/doc/models/create-or-update-product.md @@ -13,18 +13,18 @@ | `Handle` | `string` | Optional | The product API handle | | `Description` | `string` | Required | The product description | | `AccountingCode` | `string` | Optional | E.g. Internal ID or SKU Number | -| `RequireCreditCard` | `bool?` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, please read this attribute from under the signup page. | +| `RequireCreditCard` | `bool?` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. | | `PriceInCents` | `long` | Required | The product price, in integer cents | | `Interval` | `int` | Required | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days | | `IntervalUnit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Required | A string representing the interval unit for this product, either month or day | | `TrialPriceInCents` | `long?` | Optional | The product trial price, in integer cents | | `TrialInterval` | `int?` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product trial would last 30 days. | | `TrialIntervalUnit` | [`IntervalUnit?`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product, either month or day | -| `TrialType` | `string` | Optional | - | +| `TrialType` | [`TrialType?`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `ExpirationInterval` | `int?` | Optional | The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product would expire after 30 days. | | `ExpirationIntervalUnit` | [`ExpirationIntervalUnit?`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this product, either month, day or never | | `AutoCreateSignupPage` | `bool?` | Optional | - | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.

**Constraints**: *Maximum Length*: `10` | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | ## Example (as JSON) diff --git a/doc/models/create-payment-profile.md b/doc/models/create-payment-profile.md index a462019d..0417174e 100644 --- a/doc/models/create-payment-profile.md +++ b/doc/models/create-payment-profile.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `ChargifyToken` | `string` | Optional | Token received after sending billing informations using chargify.js. | +| `ChargifyToken` | `string` | Optional | Token received after sending billing information using chargify.js. | | `Id` | `int?` | Optional | - | | `PaymentType` | [`PaymentType?`](../../doc/models/payment-type.md) | Optional | - | | `FirstName` | `string` | Optional | First name on card or bank account. If omitted, the first_name from customer attributes will be used. | @@ -23,7 +23,7 @@ | `BillingAddress2` | `string` | Optional | Second line of the customer’s billing address i.e. Apt. 100 | | `BillingCity` | `string` | Optional | The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | | `BillingState` | `string` | Optional | The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | -| `BillingCountry` | `string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | +| `BillingCountry` | `string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | | `BillingZip` | `string` | Optional | The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | | `CurrentVault` | [`AllVaults?`](../../doc/models/all-vaults.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. | | `VaultToken` | `string` | Optional | The “token” provided by your vault storage for an already stored payment profile | diff --git a/doc/models/create-product-price-point-request.md b/doc/models/create-product-price-point-request.md index 37b42654..73c1fbf1 100644 --- a/doc/models/create-product-price-point-request.md +++ b/doc/models/create-product-price-point-request.md @@ -25,7 +25,7 @@ "trial_price_in_cents": 108, "trial_interval": 202, "trial_interval_unit": "day", - "trial_type": "trial_type4" + "trial_type": "no_obligation" } } ``` diff --git a/doc/models/create-product-price-point.md b/doc/models/create-product-price-point.md index d4828983..6a70ffe4 100644 --- a/doc/models/create-product-price-point.md +++ b/doc/models/create-product-price-point.md @@ -17,7 +17,7 @@ | `TrialPriceInCents` | `long?` | Optional | The product price point trial price, in integer cents | | `TrialInterval` | `int?` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days. | | `TrialIntervalUnit` | [`IntervalUnit?`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product price point, either month or day | -| `TrialType` | `string` | Optional | - | +| `TrialType` | [`TrialType?`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `InitialChargeInCents` | `long?` | Optional | The product price point initial charge, in integer cents | | `InitialChargeAfterTrial` | `bool?` | Optional | - | | `ExpirationInterval` | `int?` | Optional | The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product price point would expire after 30 days. | @@ -37,7 +37,7 @@ "trial_price_in_cents": 48, "trial_interval": 102, "trial_interval_unit": "day", - "trial_type": "trial_type0" + "trial_type": "no_obligation" } ``` diff --git a/doc/models/create-usage-request.md b/doc/models/create-usage-request.md index c40b4011..cc2c2f8f 100644 --- a/doc/models/create-usage-request.md +++ b/doc/models/create-usage-request.md @@ -21,6 +21,25 @@ "memo": "memo2", "billing_schedule": { "initial_billing_at": "2016-03-13" + }, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "interval": 66, + "interval_unit": "day", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "renew_prepaid_allocation": false } } } diff --git a/doc/models/create-usage.md b/doc/models/create-usage.md index 10516a73..f734bf6a 100644 --- a/doc/models/create-usage.md +++ b/doc/models/create-usage.md @@ -12,7 +12,8 @@ | `Quantity` | `double?` | Optional | integer by default or decimal number if fractional quantities are enabled for the component | | `PricePointId` | `string` | Optional | - | | `Memo` | `string` | Optional | - | -| `BillingSchedule` | [`BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled | +| `BillingSchedule` | [`BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. | +| `CustomPrice` | [`ComponentCustomPrice`](../../doc/models/component-custom-price.md) | Optional | Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. | ## Example (as JSON) @@ -23,6 +24,25 @@ "memo": "memo2", "billing_schedule": { "initial_billing_at": "2016-03-13" + }, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "interval": 66, + "interval_unit": "day", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "renew_prepaid_allocation": false } } ``` diff --git a/doc/models/ebb-component.md b/doc/models/ebb-component.md index d1fabfab..ab4f1bdb 100644 --- a/doc/models/ebb-component.md +++ b/doc/models/ebb-component.md @@ -18,7 +18,7 @@ | `Prices` | [`List`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. | | `PricePoints` | [`List`](../../doc/models/component-price-point-item.md) | Optional | - | | `UnitPrice` | [`EBBComponentUnitPrice`](../../doc/models/containers/ebb-component-unit-price.md) | Optional | This is a container for one-of cases. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `HideDateRangeOnInvoice` | `bool?` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `EventBasedBillingMetricId` | `int` | Required | The ID of an event based billing metric that will be attached to this component. | | `Interval` | `int?` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/list-coupons-filter.md b/doc/models/list-coupons-filter.md index 7e1bbd0f..fe6ba2ea 100644 --- a/doc/models/list-coupons-filter.md +++ b/doc/models/list-coupons-filter.md @@ -16,7 +16,8 @@ | `EndDatetime` | `DateTimeOffset?` | Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns coupons with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. Use in query `filter[end_datetime]=2011-12-1T10:15:30+01:00`. | | `Ids` | `List` | Optional | Allows fetching coupons with matching id based on provided values. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | | `Codes` | `List` | Optional | Allows fetching coupons with matching codes based on provided values. Use in query `filter[codes]=free,free_trial`. | -| `UseSiteExchangeRate` | `bool?` | Optional | Allows fetching coupons with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. | +| `UseSiteExchangeRate` | `bool?` | Optional | If true, restricts the list to coupons whose pricing is recalculated from the site’s current exchange rates, so their currency_prices array contains on-the-fly conversions rather than stored price records. If false, restricts the list to coupons that have manually defined amounts for each currency, ensuring the response includes the saved currency_prices entries instead of exchange-rate-derived values. Use in query `filter[use_site_exchange_rate]=true`. | +| `IncludeArchived` | `bool?` | Optional | Controls returning archived coupons. | ## Example (as JSON) diff --git a/doc/models/metafield-input.md b/doc/models/metafield-input.md index 6bf74038..74bf0d5b 100644 --- a/doc/models/metafield-input.md +++ b/doc/models/metafield-input.md @@ -1,7 +1,7 @@ # Metafield Input -Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' +Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. ## Enumeration diff --git a/doc/models/metafield-scope.md b/doc/models/metafield-scope.md index 0a67e551..5b17e1f5 100644 --- a/doc/models/metafield-scope.md +++ b/doc/models/metafield-scope.md @@ -15,8 +15,8 @@ Warning: When updating a metafield's scope attribute, all scope attributes must | `Invoices` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from invoices. | | `Statements` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from statements. | | `Portal` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from the portal. | -| `PublicShow` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from being viewable by your ecosystem. | -| `PublicEdit` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from being edited by your ecosystem. | +| `PublicShow` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being viewable by your ecosystem. | +| `PublicEdit` | [`IncludeOption?`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being editable by your ecosystem. | | `Hosted` | `List` | Optional | - | ## Example (as JSON) diff --git a/doc/models/metafield.md b/doc/models/metafield.md index d8867c3f..1d786a51 100644 --- a/doc/models/metafield.md +++ b/doc/models/metafield.md @@ -12,8 +12,8 @@ | `Id` | `int?` | Optional | - | | `Name` | `string` | Optional | - | | `Scope` | [`MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | -| `DataCount` | `int?` | Optional | the amount of subscriptions this metafield has been applied to in Chargify | -| `InputType` | [`MetafieldInput?`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' | +| `DataCount` | `int?` | Optional | The amount of subscriptions this metafield has been applied to in Advanced Billing. | +| `InputType` | [`MetafieldInput?`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | | `Enum` | [`MetafieldEnum`](../../doc/models/containers/metafield-enum.md) | Optional | This is a container for one-of cases. | ## Example (as JSON) diff --git a/doc/models/metered-component.md b/doc/models/metered-component.md index f86f05e3..e66a236d 100644 --- a/doc/models/metered-component.md +++ b/doc/models/metered-component.md @@ -18,7 +18,7 @@ | `Prices` | [`List`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. | | `PricePoints` | [`List`](../../doc/models/component-price-point-item.md) | Optional | - | | `UnitPrice` | [`MeteredComponentUnitPrice`](../../doc/models/containers/metered-component-unit-price.md) | Optional | This is a container for one-of cases. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `HideDateRangeOnInvoice` | `bool?` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `DisplayOnHostedPage` | `bool?` | Optional | - | | `AllowFractionalQuantities` | `bool?` | Optional | - | diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index 9da3a2db..0120d105 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -17,7 +17,7 @@ | `DowngradeCredit` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | | `PricePoints` | [`List`](../../doc/models/component-price-point-item.md) | Optional | - | | `UnitPrice` | [`OnOffComponentUnitPrice`](../../doc/models/containers/on-off-component-unit-price.md) | Required | This is a container for one-of cases. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `HideDateRangeOnInvoice` | `bool?` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `DisplayOnHostedPage` | `bool?` | Optional | - | | `AllowFractionalQuantities` | `bool?` | Optional | - | diff --git a/doc/models/payment-profile-attributes.md b/doc/models/payment-profile-attributes.md index 2f4b2164..e4560986 100644 --- a/doc/models/payment-profile-attributes.md +++ b/doc/models/payment-profile-attributes.md @@ -25,7 +25,7 @@ alias to credit_card_attributes | `BillingAddress2` | `string` | Optional | (Optional) Second line of the customer’s billing address i.e. Apt. 100 | | `BillingCity` | `string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | | `BillingState` | `string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | -| `BillingCountry` | `string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | +| `BillingCountry` | `string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | | `BillingZip` | `string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | | `CurrentVault` | [`AllVaults?`](../../doc/models/all-vaults.md) | Optional | (Optional, used only for Subscription Import) The vault that stores the payment profile with the provided vault_token. | | `VaultToken` | `string` | Optional | (Optional, used only for Subscription Import) The “token” provided by your vault storage for an already stored payment profile | diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md index a755ddf7..7ce67c57 100644 --- a/doc/models/prepaid-usage-component.md +++ b/doc/models/prepaid-usage-component.md @@ -20,7 +20,7 @@ | `DowngradeCredit` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | | `PricePoints` | [`List`](../../doc/models/create-prepaid-usage-component-price-point.md) | Optional | - | | `UnitPrice` | [`PrepaidUsageComponentUnitPrice`](../../doc/models/containers/prepaid-usage-component-unit-price.md) | Optional | This is a container for one-of cases. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `HideDateRangeOnInvoice` | `bool?` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `OveragePricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Required | - | | `RolloverPrepaidRemainder` | `bool?` | Optional | Boolean which controls whether or not remaining units should be rolled over to the next period | diff --git a/doc/models/product-price-point.md b/doc/models/product-price-point.md index 66318dd5..db67d747 100644 --- a/doc/models/product-price-point.md +++ b/doc/models/product-price-point.md @@ -18,7 +18,7 @@ | `TrialPriceInCents` | `long?` | Optional | The product price point trial price, in integer cents | | `TrialInterval` | `int?` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days | | `TrialIntervalUnit` | [`IntervalUnit?`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product price point, either month or day | -| `TrialType` | `string` | Optional | - | +| `TrialType` | [`TrialType?`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `IntroductoryOffer` | `bool?` | Optional | reserved for future use | | `InitialChargeInCents` | `long?` | Optional | The product price point initial charge, in integer cents | | `InitialChargeAfterTrial` | `bool?` | Optional | - | diff --git a/doc/models/product.md b/doc/models/product.md index b847b6be..66dbe1bd 100644 --- a/doc/models/product.md +++ b/doc/models/product.md @@ -14,7 +14,7 @@ | `Handle` | `string` | Optional | The product API handle | | `Description` | `string` | Optional | The product description | | `AccountingCode` | `string` | Optional | E.g. Internal ID or SKU Number | -| `RequestCreditCard` | `bool?` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, please read this attribute from under the signup page. | +| `RequestCreditCard` | `bool?` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. | | `ExpirationInterval` | `int?` | Optional | A numerical interval for the length a subscription to this product will run before it expires. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval | | `ExpirationIntervalUnit` | [`ExpirationIntervalUnit?`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this product, either month, day or never | | `CreatedAt` | `DateTimeOffset?` | Optional | Timestamp indicating when this product was created | @@ -40,7 +40,7 @@ | `RequestBillingAddress` | `bool?` | Optional | A boolean indicating whether to request a billing address on any Self-Service Pages that are used by subscribers of this product. | | `RequireBillingAddress` | `bool?` | Optional | A boolean indicating whether a billing address is required to add a payment profile, especially at signup. | | `RequireShippingAddress` | `bool?` | Optional | A boolean indicating whether a shipping address is required for the customer, especially at signup. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `DefaultProductPricePointId` | `int?` | Optional | - | | `UseSiteExchangeRate` | `bool?` | Optional | - | | `ItemCategory` | `string` | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md index 2ef4b368..19230ed6 100644 --- a/doc/models/quantity-based-component.md +++ b/doc/models/quantity-based-component.md @@ -20,7 +20,7 @@ | `DowngradeCredit` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | | `PricePoints` | [`List`](../../doc/models/component-price-point-item.md) | Optional | - | | `UnitPrice` | [`QuantityBasedComponentUnitPrice`](../../doc/models/containers/quantity-based-component-unit-price.md) | Optional | This is a container for one-of cases. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `HideDateRangeOnInvoice` | `bool?` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `Recurring` | `bool?` | Optional | - | | `DisplayOnHostedPage` | `bool?` | Optional | - | diff --git a/doc/models/resume-options.md b/doc/models/resume-options.md index 145b2dc2..5ccc3c79 100644 --- a/doc/models/resume-options.md +++ b/doc/models/resume-options.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `RequireResume` | `bool?` | Optional | Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in it's current state. | +| `RequireResume` | `bool?` | Optional | Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in its current state. | | `ForgiveBalance` | `bool?` | Optional | Indicates whether or not Chargify should clear the subscription's existing balance before attempting to resume the subscription. If subscription cannot be resumed, the balance will remain as it was before the attempt to resume was made. | ## Example (as JSON) diff --git a/doc/models/snap-day.md b/doc/models/snap-day.md index 4015f173..92da90e2 100644 --- a/doc/models/snap-day.md +++ b/doc/models/snap-day.md @@ -1,8 +1,6 @@ # Snap Day -Use for subscriptions with product eligible for calendar billing only. Value can be 1-28 or 'end'. - ## Enumeration `SnapDay` diff --git a/doc/models/subscription-custom-price.md b/doc/models/subscription-custom-price.md index 7c2e0e3a..d92d766d 100644 --- a/doc/models/subscription-custom-price.md +++ b/doc/models/subscription-custom-price.md @@ -19,6 +19,7 @@ | `TrialPriceInCents` | [`SubscriptionCustomPriceTrialPriceInCents`](../../doc/models/containers/subscription-custom-price-trial-price-in-cents.md) | Optional | This is a container for one-of cases. | | `TrialInterval` | [`SubscriptionCustomPriceTrialInterval`](../../doc/models/containers/subscription-custom-price-trial-interval.md) | Optional | This is a container for one-of cases. | | `TrialIntervalUnit` | [`IntervalUnit?`](../../doc/models/interval-unit.md) | Optional | (Optional) | +| `TrialType` | [`TrialType?`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `InitialChargeInCents` | [`SubscriptionCustomPriceInitialChargeInCents`](../../doc/models/containers/subscription-custom-price-initial-charge-in-cents.md) | Optional | This is a container for one-of cases. | | `InitialChargeAfterTrial` | `bool?` | Optional | (Optional) | | `ExpirationInterval` | [`SubscriptionCustomPriceExpirationInterval`](../../doc/models/containers/subscription-custom-price-expiration-interval.md) | Optional | This is a container for one-of cases. | diff --git a/doc/models/subscription-group-component-custom-price.md b/doc/models/subscription-group-component-custom-price.md index 61dc0b34..4deb26b4 100644 --- a/doc/models/subscription-group-component-custom-price.md +++ b/doc/models/subscription-group-component-custom-price.md @@ -39,7 +39,8 @@ Used in place of `price_point_id` to define a custom price point unique to the s "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } ] } diff --git a/doc/models/subscription-group-signup-component.md b/doc/models/subscription-group-signup-component.md index 786edb59..116228b2 100644 --- a/doc/models/subscription-group-signup-component.md +++ b/doc/models/subscription-group-signup-component.md @@ -49,7 +49,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false }, { "tax_included": false, @@ -62,7 +63,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false }, { "tax_included": false, @@ -75,7 +77,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } ] } diff --git a/doc/models/subscription.md b/doc/models/subscription.md index cc6be77b..6573cf03 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -33,7 +33,7 @@ | `SignupRevenue` | `string` | Optional | The revenue, formatted as a string of decimal separated dollars and,cents, from the subscription signup ($50.00 would be formatted as,50.00) | | `DelayedCancelAt` | `DateTimeOffset?` | Optional | Timestamp for when the subscription is currently set to cancel. | | `CouponCode` | `string` | Optional | (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. | -| `SnapDay` | `string` | Optional | The day of the month that the subscription will charge according to calendar billing rules, if used. | +| `SnapDay` | [`SubscriptionSnapDay`](../../doc/models/containers/subscription-snap-day.md) | Optional | This is a container for one-of cases. | | `PaymentCollectionMethod` | [`CollectionMethod?`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`. | | `Customer` | [`Customer`](../../doc/models/customer.md) | Optional | - | | `Product` | [`Product`](../../doc/models/product.md) | Optional | - | @@ -51,7 +51,7 @@ | `CouponCodes` | `List` | Optional | An array for all the coupons attached to the subscription. | | `OfferId` | `int?` | Optional | The ID of the offer associated with the subscription. | | `PayerId` | `int?` | Optional | On Relationship Invoicing, the ID of the individual paying for the subscription. Defaults to the Customer ID unless the 'Customer Hierarchies & WhoPays' feature is enabled. | -| `CurrentBillingAmountInCents` | `long?` | Optional | The balance in cents plus the estimated renewal amount in cents. Returned ONLY for readSubscription operation as it's compute intensive operation. | +| `CurrentBillingAmountInCents` | `long?` | Optional | The balance in cents plus the estimated renewal amount in cents. Returned ONLY for the readSubscription operation as it's a compute intensive operation. | | `ProductPricePointId` | `int?` | Optional | The product price point currently subscribed to. | | `ProductPricePointType` | [`PricePointType?`](../../doc/models/price-point-type.md) | Optional | Price point type. We expose the following types:

1. **default**: a price point that is marked as a default price for a certain product.
2. **custom**: a custom price point.
3. **catalog**: a price point that is **not** marked as a default price for a certain product and is **not** a custom one. | | `NextProductPricePointId` | `int?` | Optional | If a delayed product change is scheduled, the ID of the product price point that the subscription will be changed to at the next renewal. | diff --git a/doc/models/trial-type.md b/doc/models/trial-type.md new file mode 100644 index 00000000..4807ad00 --- /dev/null +++ b/doc/models/trial-type.md @@ -0,0 +1,16 @@ + +# Trial Type + +Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. + +## Enumeration + +`TrialType` + +## Fields + +| Name | +| --- | +| `NoObligation` | +| `PaymentExpected` | + diff --git a/doc/models/update-component.md b/doc/models/update-component.md index 2b4856a1..c1ba0f97 100644 --- a/doc/models/update-component.md +++ b/doc/models/update-component.md @@ -14,7 +14,7 @@ | `Description` | `string` | Optional | The description of the component. | | `AccountingCode` | `string` | Optional | - | | `Taxable` | `bool?` | Optional | Boolean flag describing whether a component is taxable or not. | -| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `TaxCode` | `string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `ItemCategory` | [`ItemCategory?`](../../doc/models/item-category.md) | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | | `DisplayOnHostedPage` | `bool?` | Optional | - | | `UpgradeCharge` | [`CreditType?`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | diff --git a/doc/models/update-metafield.md b/doc/models/update-metafield.md index a2292b93..8b610b30 100644 --- a/doc/models/update-metafield.md +++ b/doc/models/update-metafield.md @@ -12,8 +12,8 @@ | `CurrentName` | `string` | Optional | - | | `Name` | `string` | Optional | - | | `Scope` | [`MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | -| `InputType` | [`MetafieldInput?`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' | -| `Enum` | `List` | Optional | Only applicable when input_type is radio or dropdown | +| `InputType` | [`MetafieldInput?`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | +| `Enum` | `List` | Optional | Only applicable when input_type is radio or dropdown. | ## Example (as JSON) diff --git a/doc/models/update-payment-profile.md b/doc/models/update-payment-profile.md index 1eaefeae..a6318e63 100644 --- a/doc/models/update-payment-profile.md +++ b/doc/models/update-payment-profile.md @@ -20,7 +20,7 @@ | `BillingCity` | `string` | Optional | The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | | `BillingState` | `string` | Optional | The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | | `BillingZip` | `string` | Optional | The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | -| `BillingCountry` | `string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | +| `BillingCountry` | `string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | | `BillingAddress2` | `string` | Optional | Second line of the customer’s billing address i.e. Apt. 100 | ## Example (as JSON) diff --git a/doc/models/update-subscription-component.md b/doc/models/update-subscription-component.md index 3fa4f72a..e110ab0c 100644 --- a/doc/models/update-subscription-component.md +++ b/doc/models/update-subscription-component.md @@ -33,7 +33,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } } ```