diff --git a/LICENSE b/LICENSE index b85cedd2..4771c25c 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ License: The MIT License (MIT) http://opensource.org/licenses/MIT -Copyright (c) 2014 - 2025 APIMATIC Limited +Copyright (c) 2014 - 2026 APIMATIC Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index a012b566..0abd96be 100644 --- a/README.md +++ b/README.md @@ -29,16 +29,16 @@ curl -u :x -H Accept:application/json -H Content-Type:application/json Install the gem from the command line: ```bash -gem install maxio-advanced-billing-sdk -v 8.0.0 +gem install maxio-advanced-billing-sdk -v 9.0.0 ``` Or add the gem to your Gemfile and run `bundle`: ```ruby -gem 'maxio-advanced-billing-sdk', '8.0.0' +gem 'maxio-advanced-billing-sdk', '9.0.0' ``` -For additional gem details, see the [RubyGems page for the maxio-advanced-billing-sdk gem](https://rubygems.org/gems/maxio-advanced-billing-sdk/versions/8.0.0). +For additional gem details, see the [RubyGems page for the maxio-advanced-billing-sdk gem](https://rubygems.org/gems/maxio-advanced-billing-sdk/versions/9.0.0). ## IRB Console Usage @@ -77,14 +77,14 @@ ruby bin/console ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/client.md) The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | site | `String` | The subdomain for your Advanced Billing site.
*Default*: `'subdomain'` | -| environment | `Environment` | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/README.md#environments) | The API environment.
**Default: `Environment.US`** | | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests | | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests | | timeout | `Float` | The value to use for connection timeout.
**Default: 120** | @@ -94,8 +94,8 @@ The following parameters are configurable for the API Client: | retry_statuses | `Array` | A list of HTTP statuses to retry.
**Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** | | retry_methods | `Array` | A list of HTTP methods to retry.
**Default: %i[get put]** | | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. | -| proxy_settings | [`ProxySettings`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. | -| basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/auth/basic-authentication.md) | The credential object for Basic Authentication | +| proxy_settings | [`ProxySettings`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. | +| basic_auth_credentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/auth/basic-authentication.md) | The credential object for Basic Authentication | The API client can be initialized as follows: @@ -125,7 +125,7 @@ include AdvancedBilling client = Client.from_env ``` -See the [`Environment-Based Client Initialization`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/environment-based-client-initialization.md) section for details. +See the [`Environment-Based Client Initialization`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/environment-based-client-initialization.md) section for details. ## Environments @@ -142,57 +142,58 @@ 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-ruby-sdk/tree/8.0.0/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/billing-portal.md) +* [Component Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/component-price-points.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-products.md) +* [Subscription Renewals](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-renewals.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/controllers/webhooks.md) ## SDK Infrastructure ### Configuration -* [ProxySettings](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/proxy-settings.md) -* [Environment-Based Client Initialization](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/environment-based-client-initialization.md) +* [ProxySettings](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/proxy-settings.md) +* [Environment-Based Client Initialization](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/environment-based-client-initialization.md) ### HTTP -* [HttpResponse](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/http-response.md) -* [HttpRequest](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/http-request.md) +* [HttpResponse](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/http-response.md) +* [HttpRequest](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/http-request.md) ### Utilities -* [ApiHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/api-helper.md) -* [DateTimeHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/date-time-helper.md) +* [ApiHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/api-helper.md) +* [DateTimeHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/9.0.0/doc/date-time-helper.md) diff --git a/advanced_billing.gemspec b/advanced_billing.gemspec index 9606da4a..6b29f57a 100644 --- a/advanced_billing.gemspec +++ b/advanced_billing.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'maxio-advanced-billing-sdk' - s.version = '8.0.0' + s.version = '9.0.0' s.summary = 'SDK for Maxio Advanced Billing' s.description = "Ultimate billing and pricing flexibility for B2B SaaS.\nMaxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments." s.authors = ['Maxio SDK'] diff --git a/doc/client.md b/doc/client.md index 98859e65..8cba54c4 100644 --- a/doc/client.md +++ b/doc/client.md @@ -6,7 +6,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | site | `String` | The subdomain for your Advanced Billing site.
*Default*: `'subdomain'` | -| environment | `Environment` | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](../README.md#environments) | The API environment.
**Default: `Environment.US`** | | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests | | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests | | timeout | `Float` | The value to use for connection timeout.
**Default: 120** | @@ -87,6 +87,7 @@ The gateway for the SDK. This class acts as a factory for the Controllers and al | subscription_invoice_account | Gets SubscriptionInvoiceAccountController | | subscription_notes | Gets SubscriptionNotesController | | subscription_products | Gets SubscriptionProductsController | +| subscription_renewals | Gets SubscriptionRenewalsController | | subscription_status | Gets SubscriptionStatusController | | webhooks | Gets WebhooksController | diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md index 1b1a947c..e8d57894 100644 --- a/doc/controllers/advance-invoice.md +++ b/doc/controllers/advance-invoice.md @@ -31,7 +31,7 @@ def issue_advance_invoice(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`IssueAdvanceInvoiceRequest`](../../doc/models/issue-advance-invoice-request.md) | Body, Optional | - | ## Response Type @@ -74,7 +74,7 @@ def read_advance_invoice(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -110,7 +110,7 @@ def void_advance_invoice(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`VoidInvoiceRequest`](../../doc/models/void-invoice-request.md) | Body, Optional | - | ## Response Type diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index 427f8fe7..c2a787cf 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -14,6 +14,7 @@ component_price_points_controller = client.component_price_points * [Create Component Price Point](../../doc/controllers/component-price-points.md#create-component-price-point) * [List Component Price Points](../../doc/controllers/component-price-points.md#list-component-price-points) * [Bulk Create Component Price Points](../../doc/controllers/component-price-points.md#bulk-create-component-price-points) +* [Clone Component Price Point](../../doc/controllers/component-price-points.md#clone-component-price-point) * [Update Component Price Point](../../doc/controllers/component-price-points.md#update-component-price-point) * [Read Component Price Point](../../doc/controllers/component-price-points.md#read-component-price-point) * [Archive Component Price Point](../../doc/controllers/component-price-points.md#archive-component-price-point) @@ -373,6 +374,137 @@ puts result | 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | +# Clone Component Price Point + +Clones a component price point. Custom price points (tied to a specific subscription) cannot be cloned. The following attributes are copied from the source price point: + +- Pricing scheme +- All price tiers (with starting/ending quantities and unit prices) +- Tax included setting +- Currency prices (if definitive pricing is set) +- Overage pricing (for prepaid usage components) +- Interval settings (if multi-frequency is enabled) +- Event-based billing segments (if applicable) + +```ruby +def clone_component_price_point(component_id, + price_point_id, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `component_id` | Integer \| String | Template, Required | This is a container for one-of cases. | +| `price_point_id` | Integer \| String | Template, Required | This is a container for one-of cases. | +| `body` | [`CloneComponentPricePointRequest`](../../doc/models/clone-component-price-point-request.md) | Body, Optional | - | + +## Response Type + +[`ComponentPricePointCurrencyOverageResponse`](../../doc/models/component-price-point-currency-overage-response.md) + +## Example Usage + +```ruby +component_id = 144 + +price_point_id = 188 + +body = CloneComponentPricePointRequest.new( + price_point: CloneComponentPricePoint.new( + name: 'Pro Usage Tiered Clone' + ) +) + +result = component_price_points_controller.clone_component_price_point( + component_id, + price_point_id, + body: body +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "price_point": { + "id": 9012, + "name": "Pro Usage Tiered Clone", + "type": "catalog", + "pricing_scheme": "tiered", + "component_id": 1234, + "handle": "pro-usage-tiered-clone", + "archived_at": null, + "created_at": "2024-05-01T12:34:56-04:00", + "updated_at": "2024-05-01T12:34:56-04:00", + "use_site_exchange_rate": false, + "currency_prices": [ + { + "id": 3001, + "currency": "EUR", + "price": "9.99", + "formatted_price": "€9.99", + "price_id": 4001, + "price_point_id": 9012 + } + ], + "currency_overage_prices": [ + { + "id": 3002, + "currency": "EUR", + "price": "2.50", + "formatted_price": "€2.50", + "price_id": 4002, + "price_point_id": 9012 + } + ], + "renew_prepaid_allocation": true, + "rollover_prepaid_remainder": false, + "expiration_interval": 1, + "expiration_interval_unit": "month", + "overage_pricing_scheme": "tiered", + "subscription_id": 4321, + "prices": [ + { + "id": 4001, + "component_id": 1234, + "starting_quantity": 1, + "ending_quantity": 100, + "unit_price": "9.99", + "price_point_id": 9012, + "formatted_unit_price": "$9.99", + "segment_id": null + } + ], + "overage_prices": [ + { + "id": 4002, + "component_id": 1234, + "starting_quantity": 101, + "ending_quantity": null, + "unit_price": "2.50", + "price_point_id": 9012, + "formatted_unit_price": "$2.50", + "segment_id": null + } + ], + "tax_included": false, + "interval": 1, + "interval_unit": "month" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | `APIException` | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + # Update Component Price Point When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. @@ -464,7 +596,7 @@ def read_component_price_point(component_id, ## Response Type -[`ComponentPricePointResponse`](../../doc/models/component-price-point-response.md) +[`ComponentPricePointCurrencyOverageResponse`](../../doc/models/component-price-point-currency-overage-response.md) ## Example Usage diff --git a/doc/controllers/events.md b/doc/controllers/events.md index 604dd78d..b9b0b0a2 100644 --- a/doc/controllers/events.md +++ b/doc/controllers/events.md @@ -213,7 +213,7 @@ def list_subscription_events(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `page` | `Integer` | 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` | | `per_page` | `Integer` | 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` | | `since_id` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified | diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 64dac0ea..24db06e9 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -1877,7 +1877,7 @@ def record_payment_for_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`RecordPaymentRequest`](../../doc/models/record-payment-request.md) | Body, Optional | - | ## Response Type @@ -2554,7 +2554,7 @@ def create_invoice(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Optional | - | ## Response Type @@ -2693,6 +2693,8 @@ puts result 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. +**File Attachments**: You can attach files to invoice emails using `attachment_urls[]` parameter by providing URLs to the files you want to attach. When using attachments, the request must use `multipart/form-data` content type. Max 10 files, 10MB per file. + 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. @@ -3060,7 +3062,7 @@ puts result # Issue Invoice -This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. +This endpoint allows you to issue an invoice that is in "pending" or "draft" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. You cannot issue a pending child invoice that was created for a member subscription in a group. diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 0f369d2f..8b3b1b89 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -510,7 +510,7 @@ payment_profiles_controller.delete_unused_payment_profile(payment_profile_id) # Delete Subscriptions Payment Profile -This will delete a payment profile belonging to the customer on the subscription. +Deletes a payment profile belonging to the customer on the subscription. + If the customer has multiple subscriptions, the payment profile will be removed from all of them. @@ -525,7 +525,7 @@ def delete_subscriptions_payment_profile(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `payment_profile_id` | `Integer` | Template, Required | The Chargify id of the payment profile | ## Response Type @@ -623,7 +623,7 @@ puts result # Delete Subscription Group Payment Profile -This will delete a Payment Profile belonging to a Subscription Group. +Deletes a Payment Profile belonging to a Subscription Group. **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them. @@ -672,7 +672,7 @@ def change_subscription_default_payment_profile(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `payment_profile_id` | `Integer` | Template, Required | The Chargify id of the payment profile | ## Response Type @@ -860,7 +860,7 @@ def send_request_update_payment_email(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md index 30e027cb..66793516 100644 --- a/doc/controllers/product-families.md +++ b/doc/controllers/product-families.md @@ -272,7 +272,8 @@ puts result "handle": "acme-projects", "accounting_code": null, "created_at": "2013-02-20T15:05:51-07:00", - "updated_at": "2013-02-20T15:05:51-07:00" + "updated_at": "2013-02-20T15:05:51-07:00", + "archived_at": null } }, { @@ -283,7 +284,8 @@ puts result "handle": "bat-family", "accounting_code": null, "created_at": "2014-04-16T12:41:13-06:00", - "updated_at": "2014-04-16T12:41:13-06:00" + "updated_at": "2014-04-16T12:41:13-06:00", + "archived_at": "2024-11-05T09:30:00-07:00" } } ] @@ -328,7 +330,8 @@ puts result "name": "Acme Projects", "description": "", "handle": "billing-plans", - "accounting_code": null + "accounting_code": null, + "archived_at": null } } ``` diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md index 3cc83ddb..75574a3f 100644 --- a/doc/controllers/proforma-invoices.md +++ b/doc/controllers/proforma-invoices.md @@ -15,6 +15,7 @@ proforma_invoices_controller = client.proforma_invoices * [Read Proforma Invoice](../../doc/controllers/proforma-invoices.md#read-proforma-invoice) * [Create Proforma Invoice](../../doc/controllers/proforma-invoices.md#create-proforma-invoice) * [List Proforma Invoices](../../doc/controllers/proforma-invoices.md#list-proforma-invoices) +* [Deliver Proforma Invoice](../../doc/controllers/proforma-invoices.md#deliver-proforma-invoice) * [Void Proforma Invoice](../../doc/controllers/proforma-invoices.md#void-proforma-invoice) * [Preview Proforma Invoice](../../doc/controllers/proforma-invoices.md#preview-proforma-invoice) * [Create Signup Proforma Invoice](../../doc/controllers/proforma-invoices.md#create-signup-proforma-invoice) @@ -166,7 +167,7 @@ def create_proforma_invoice(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -200,7 +201,7 @@ def list_proforma_invoices(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `start_date` | `String` | Query, Optional | The beginning date range for the invoice's Due Date, in the YYYY-MM-DD format. | | `end_date` | `String` | Query, Optional | The ending date range for the invoice's Due Date, in the YYYY-MM-DD format. | | `status` | [`ProformaInvoiceStatus`](../../doc/models/proforma-invoice-status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided | @@ -239,6 +240,63 @@ puts result ``` +# Deliver Proforma Invoice + +Allows for proforma invoices to be programmatically delivered via email. Supports email +delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. + +If `recipient_emails` is omitted, the system will fall back to the primary recipient derived from the invoice or +subscription. At least one recipient must be present, either via the request body or via this default behavior, so an +empty body may still succeed when defaults are available. + +```ruby +def deliver_proforma_invoice(proforma_invoice_uid, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `proforma_invoice_uid` | `String` | Template, Required | The uid of the proforma invoice | +| `body` | [`DeliverProformaInvoiceRequest`](../../doc/models/deliver-proforma-invoice-request.md) | Body, Optional | - | + +## Response Type + +[`ProformaInvoice`](../../doc/models/proforma-invoice.md) + +## Example Usage + +```ruby +proforma_invoice_uid = 'proforma_invoice_uid4' + +body = DeliverProformaInvoiceRequest.new( + recipient_emails: [ + 'user0@example.com' + ], + cc_recipient_emails: [ + 'user1@example.com' + ], + bcc_recipient_emails: [ + 'user2@example.com' + ] +) + +result = proforma_invoices_controller.deliver_proforma_invoice( + proforma_invoice_uid, + body: body +) +puts result +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | `APIException` | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + # Void Proforma Invoice This endpoint will void a proforma invoice that has the status "draft". @@ -302,7 +360,7 @@ def preview_proforma_invoice(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index d9e00639..f9ae1101 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -42,7 +42,7 @@ def read_subscription_component(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `component_id` | `Integer` | Template, Required | The Advanced Billing id of the component. Alternatively, the component's handle prefixed by `handle:` | ## Response Type @@ -105,7 +105,7 @@ def list_subscription_components(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `date_field` | [`SubscriptionListDateField`](../../doc/models/subscription-list-date-field.md) | Query, Optional | The type of filter you'd like to apply to your search. Use in query `date_field=updated_at`. | | `direction` | [`SortingDirection`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | | `filter` | [`ListSubscriptionComponentsFilter`](../../doc/models/list-subscription-components-filter.md) | Query, Optional | Filter to use for List Subscription Components operation | @@ -202,7 +202,7 @@ def bulk_update_subscription_components_price_points(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`BulkComponentsPricePointAssignment`](../../doc/models/bulk-components-price-point-assignment.md) | Body, Optional | - | ## Response Type @@ -276,7 +276,7 @@ def bulk_reset_subscription_components_price_points(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -394,41 +394,13 @@ puts result # Allocate Component -This endpoint creates a new allocation, setting the current allocated quantity for the Component and recording a memo. +Creates an allocation, sets the current allocated quantity for the component, and records a memo. Allocations can only be updated for Quantity, On/Off, and Prepaid Components. -**Notice**: Allocations can only be updated for Quantity, On/Off, and Prepaid Components. +When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. -## Allocations Documentation +> **Note:** These proration and accural fields are ignored for Prepaid Components since this component type always generate charges immediately without proration. -Full documentation on how to record Allocations in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview). It is focused on how allocations operate within the Advanced Billing UI.It goes into greater detail on how the user interface will react when recording allocations. - -This documentation also goes into greater detail on how proration is taken into consideration when applying component allocations. - -## Proration Schemes - -Changing the allocated quantity of a component mid-period can result in either a Charge or Credit being applied to the subscription. When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. - -**Notice:** These proration and accural fields will be ignored for Prepaid Components since this component type always generate charges immediately without proration. - -For background information on prorated components and upgrade/downgrade schemes, see [Setting Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration). -See the tables below for valid values. - -| upgrade_charge | Definition                                                        | -|----------------|-------------------------------------------------------------------| -| `full`         | A charge is added for the full price of the component.            | -| `prorated`     | A charge is added for the prorated price of the component change. | -| `none`         | No charge is added.                                               | - -| downgrade_credit | Definition                                        | -|------------------|---------------------------------------------------| -| `full`           | A full price credit is added for the amount owed. | -| `prorated`       | A prorated credit is added for the amount owed.   | -| `none`           | No charge is added.                               | - -| accrue_charge | Definition                                                                                               | -|---------------|------------------------------------------------------------------------------------------------------------| -| `true`        | Attempt to charge the customer at next renewal. | -| `false`       | Attempt to charge the customer right away. If it fails, the charge will be accrued until the next renewal. | +For information on prorated components and upgrade/downgrade schemes, see [Setting Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration) ### Order of Resolution for upgrade_charge and downgrade_credit @@ -442,7 +414,9 @@ See the tables below for valid values. 1. Allocation API call top level (outside of the `allocations` array) 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) -**NOTE: Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong.** +> **Note:** Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong. + +For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) product Documentation. ```ruby def allocate_component(subscription_id, @@ -454,7 +428,7 @@ def allocate_component(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `component_id` | `Integer` | Template, Required | The Advanced Billing id of the component | | `body` | [`CreateAllocationRequest`](../../doc/models/create-allocation-request.md) | Body, Optional | - | @@ -471,8 +445,44 @@ component_id = 222 body = CreateAllocationRequest.new( allocation: CreateAllocation.new( - quantity: 5, - memo: 'Recoding component purchase of Acme Support' + quantity: 10, + decimal_quantity: '10.0', + previous_quantity: 5, + decimal_previous_quantity: '5.0', + memo: 'Increase seats to 10', + proration_downgrade_scheme: 'prorate', + proration_upgrade_scheme: 'full-price-attempt-capture', + downgrade_credit: DowngradeCreditCreditType::PRORATED, + upgrade_charge: UpgradeChargeCreditType::FULL, + accrue_charge: false, + price_point_id: 789, + billing_schedule: BillingSchedule.new( + initial_billing_at: Date.iso8601('2025-02-28') + ), + custom_price: ComponentCustomPrice.new( + prices: [ + Price.new( + starting_quantity: 1, + unit_price: '49.00', + ending_quantity: 25 + ), + Price.new( + starting_quantity: 26, + unit_price: '39.00', + ending_quantity: nil + ) + ], + tax_included: false, + pricing_scheme: PricingScheme::PER_UNIT, + interval: 1, + interval_unit: IntervalUnit::MONTH, + list_price_point_id: 4321, + use_default_list_price: false, + renew_prepaid_allocation: false, + rollover_prepaid_remainder: false, + expiration_interval: 150, + expiration_interval_unit: ExpirationIntervalUnit::NEVER + ) ) ) @@ -527,21 +537,6 @@ This endpoint returns the 50 most recent Allocations, ordered by most recent fir When a subscription's on/off component has been toggled to on (`1`) or off (`0`), usage will be logged in this response. -## Querying data via Advanced Billing gem - -You can also query the current quantity via the [official Advanced Billing Gem.](http://github.com/chargify/chargify_api_ares) - -```# First way -component = Chargify::Subscription::Component.find(1, :params => {:subscription_id => 7}) -puts component.allocated_quantity -# => 23 - -# Second way -component = Chargify::Subscription.find(7).component(1) -puts component.allocated_quantity -# => 23 -``` - ```ruby def list_allocations(subscription_id, component_id, @@ -552,7 +547,7 @@ def list_allocations(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `component_id` | `Integer` | Template, Required | The Advanced Billing id of the component | | `page` | `Integer` | 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` | @@ -632,11 +627,25 @@ puts result # Allocate Components -Creates multiple allocations, setting the current allocated quantity for each of the components and recording a memo. The charges and/or credits that are created will be rolled up into a single total which is used to determine whether this is an upgrade or a downgrade. Be aware of the Order of Resolutions explained below in determining the proration scheme. +Creates multiple allocations, sets the current allocated quantity for each of the components, and recording a memo. A `component_id` is required for each allocation. + +The charges and/or credits that are created will be rolled up into a single total which is used to determine whether this is an upgrade or a downgrade. + +### Order of Resolution for upgrade_charge and downgrade_credit + +1. Per allocation in API call (within a single allocation of the `allocations` array) +2. [Component-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) +3. Allocation API call top level (outside of the `allocations` array) +4. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) + +### Order of Resolution for accrue charge + +1. Allocation API call top level (outside of the `allocations` array) +2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) -A `component_id` is required for each allocation. +> **Note:** Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong. -This endpoint only responds to JSON. It is not available for XML. +For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) product Documentation. ```ruby def allocate_components(subscription_id, @@ -647,7 +656,7 @@ def allocate_components(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`AllocateComponents`](../../doc/models/allocate-components.md) | Body, Optional | - | ## Response Type @@ -753,7 +762,7 @@ def preview_allocations(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`PreviewAllocationsRequest`](../../doc/models/preview-allocations-request.md) | Body, Optional | - | ## Response Type @@ -921,7 +930,7 @@ def update_prepaid_usage_allocation_expiration_date(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `component_id` | `Integer` | Template, Required | The Advanced Billing id of the component | | `allocation_id` | `Integer` | Template, Required | The Advanced Billing id of the allocation | | `body` | [`UpdateAllocationExpirationDate`](../../doc/models/update-allocation-expiration-date.md) | Body, Optional | - | @@ -984,7 +993,7 @@ def delete_prepaid_usage_allocation(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `component_id` | `Integer` | Template, Required | The Advanced Billing id of the component | | `allocation_id` | `Integer` | Template, Required | The Advanced Billing id of the allocation | | `body` | [`CreditSchemeRequest`](../../doc/models/credit-scheme-request.md) | Body, Optional | - | diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md index b64f6145..515f3a8a 100644 --- a/doc/controllers/subscription-groups.md +++ b/doc/controllers/subscription-groups.md @@ -123,6 +123,7 @@ puts result ```json { "subscription_group": { + "uid": "grp_952mvqcnk53wq", "customer_id": 1, "payment_profile": { "id": 1, @@ -381,8 +382,8 @@ puts result # Delete Subscription Group -Use this endpoint to delete subscription group. -Only groups without members can be deleted +Deletes a subscription group. +Only groups without members can be deleted. ```ruby def delete_subscription_group(uid) @@ -526,7 +527,7 @@ def add_subscription_to_group(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`AddSubscriptionToAGroup`](../../doc/models/add-subscription-to-a-group.md) | Body, Optional | - | ## Response Type @@ -594,7 +595,7 @@ def remove_subscription_from_group(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type diff --git a/doc/controllers/subscription-invoice-account.md b/doc/controllers/subscription-invoice-account.md index 219d3329..534a8580 100644 --- a/doc/controllers/subscription-invoice-account.md +++ b/doc/controllers/subscription-invoice-account.md @@ -31,7 +31,7 @@ def read_account_balances(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -66,7 +66,7 @@ def create_prepayment(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`CreatePrepaymentRequest`](../../doc/models/create-prepayment-request.md) | Body, Optional | - | ## Response Type @@ -129,7 +129,7 @@ def list_prepayments(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `page` | `Integer` | 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` | | `per_page` | `Integer` | 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` | | `filter` | [`ListPrepaymentsFilter`](../../doc/models/list-prepayments-filter.md) | Query, Optional | Filter to use for List Prepayments operations | @@ -197,7 +197,7 @@ def issue_service_credit(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`IssueServiceCreditRequest`](../../doc/models/issue-service-credit-request.md) | Body, Optional | - | ## Response Type @@ -254,7 +254,7 @@ def deduct_service_credit(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`DeductServiceCreditRequest`](../../doc/models/deduct-service-credit-request.md) | Body, Optional | - | ## Response Type @@ -301,7 +301,7 @@ def list_service_credits(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `page` | `Integer` | 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` | | `per_page` | `Integer` | 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`. | @@ -380,7 +380,7 @@ def refund_prepayment(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `prepayment_id` | `Integer` | Template, Required | id of prepayment | | `body` | [`RefundPrepaymentRequest`](../../doc/models/refund-prepayment-request.md) | Body, Optional | - | diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md index ea70da7d..42270788 100644 --- a/doc/controllers/subscription-notes.md +++ b/doc/controllers/subscription-notes.md @@ -38,7 +38,7 @@ def create_subscription_note(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`UpdateSubscriptionNoteRequest`](../../doc/models/update-subscription-note-request.md) | Body, Optional | Updatable fields for Subscription Note | ## Response Type @@ -83,7 +83,7 @@ def list_subscription_notes(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `page` | `Integer` | 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` | | `per_page` | `Integer` | 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` | @@ -151,7 +151,7 @@ def read_subscription_note(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `note_id` | `Integer` | Template, Required | The Advanced Billing id of the note | ## Response Type @@ -202,7 +202,7 @@ def update_subscription_note(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `note_id` | `Integer` | Template, Required | The Advanced Billing id of the note | | `body` | [`UpdateSubscriptionNoteRequest`](../../doc/models/update-subscription-note-request.md) | Body, Optional | Updatable fields for Subscription Note | @@ -241,7 +241,7 @@ puts result # Delete Subscription Note -Use the following method to delete a note for a Subscription. +Deletes a note for a Subscription. ```ruby def delete_subscription_note(subscription_id, @@ -252,7 +252,7 @@ def delete_subscription_note(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `note_id` | `Integer` | Template, Required | The Advanced Billing id of the note | ## Response Type diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md index 16e73251..bf3adbae 100644 --- a/doc/controllers/subscription-products.md +++ b/doc/controllers/subscription-products.md @@ -82,7 +82,7 @@ def migrate_subscription_product(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`SubscriptionProductMigrationRequest`](../../doc/models/subscription-product-migration-request.md) | Body, Optional | - | ## Response Type @@ -259,7 +259,7 @@ def preview_subscription_product_migration(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`SubscriptionMigrationPreviewRequest`](../../doc/models/subscription-migration-preview-request.md) | Body, Optional | - | ## Response Type diff --git a/doc/controllers/subscription-renewals.md b/doc/controllers/subscription-renewals.md new file mode 100644 index 00000000..fbcb4feb --- /dev/null +++ b/doc/controllers/subscription-renewals.md @@ -0,0 +1,901 @@ +# Subscription Renewals + +```ruby +subscription_renewals_controller = client.subscription_renewals +``` + +## Class Name + +`SubscriptionRenewalsController` + +## Methods + +* [Create Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#create-scheduled-renewal-configuration) +* [List Scheduled Renewal Configurations](../../doc/controllers/subscription-renewals.md#list-scheduled-renewal-configurations) +* [Read Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#read-scheduled-renewal-configuration) +* [Update Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#update-scheduled-renewal-configuration) +* [Schedule Scheduled Renewal Lock In](../../doc/controllers/subscription-renewals.md#schedule-scheduled-renewal-lock-in) +* [Lock in Scheduled Renewal Immediately](../../doc/controllers/subscription-renewals.md#lock-in-scheduled-renewal-immediately) +* [Unpublish Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#unpublish-scheduled-renewal-configuration) +* [Cancel Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#cancel-scheduled-renewal-configuration) +* [Create Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#create-scheduled-renewal-configuration-item) +* [Update Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#update-scheduled-renewal-configuration-item) +* [Delete Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#delete-scheduled-renewal-configuration-item) + + +# Create Scheduled Renewal Configuration + +Creates a scheduled renewal configuration for a subscription. The scheduled renewal is based on the subscription’s current product and component setup. + +```ruby +def create_scheduled_renewal_configuration(subscription_id, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `body` | [`ScheduledRenewalConfigurationRequest`](../../doc/models/scheduled-renewal-configuration-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +body = ScheduledRenewalConfigurationRequest.new( + renewal_configuration: ScheduledRenewalConfigurationRequestBody.new( + starts_at: DateTimeHelper.from_rfc3339('2024-12-01T00:00:00Z'), + ends_at: DateTimeHelper.from_rfc3339('2025-12-01T00:00:00Z'), + lock_in_at: DateTimeHelper.from_rfc3339('2024-11-15T00:00:00Z'), + contract_id: 222 + ) +) + +result = subscription_renewals_controller.create_scheduled_renewal_configuration( + subscription_id, + body: body +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio_id-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# List Scheduled Renewal Configurations + +Lists scheduled renewal configurations for the subscription and permits an optional status query filter. + +```ruby +def list_scheduled_renewal_configurations(subscription_id, + status: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `status` | [`Status`](../../doc/models/status.md) | Query, Optional | (Optional) Status filter for scheduled renewal configurations. | + +## Response Type + +[`ScheduledRenewalConfigurationsResponse`](../../doc/models/scheduled-renewal-configurations-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +result = subscription_renewals_controller.list_scheduled_renewal_configurations(subscription_id) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configurations": [ + { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } + ] +} +``` + + +# Read Scheduled Renewal Configuration + +Retrieves the configuration settings for the scheduled renewal. + +```ruby +def read_scheduled_renewal_configuration(subscription_id, + id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `id` | `Integer` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +id = 112 + +result = subscription_renewals_controller.read_scheduled_renewal_configuration( + subscription_id, + id +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + + +# Update Scheduled Renewal Configuration + +Updates an existing configuration. + +```ruby +def update_scheduled_renewal_configuration(subscription_id, + id, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `id` | `Integer` | Template, Required | The renewal id. | +| `body` | [`ScheduledRenewalConfigurationRequest`](../../doc/models/scheduled-renewal-configuration-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +id = 112 + +body = ScheduledRenewalConfigurationRequest.new( + renewal_configuration: ScheduledRenewalConfigurationRequestBody.new( + starts_at: DateTimeHelper.from_rfc3339('2025-12-01T00:00:00Z'), + ends_at: DateTimeHelper.from_rfc3339('2026-12-01T00:00:00Z'), + lock_in_at: DateTimeHelper.from_rfc3339('2025-11-15T00:00:00Z') + ) +) + +result = subscription_renewals_controller.update_scheduled_renewal_configuration( + subscription_id, + id, + body: body +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Schedule Scheduled Renewal Lock In + +Schedules a future lock-in date for the renewal. + +```ruby +def schedule_scheduled_renewal_lock_in(subscription_id, + id, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `id` | `Integer` | Template, Required | The renewal id. | +| `body` | [`ScheduledRenewalLockInRequest`](../../doc/models/scheduled-renewal-lock-in-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +id = 112 + +body = ScheduledRenewalLockInRequest.new( + lock_in_at: Date.iso8601('2025-11-15') +) + +result = subscription_renewals_controller.schedule_scheduled_renewal_lock_in( + subscription_id, + id, + body: body +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Lock in Scheduled Renewal Immediately + +Locks in the renewal immediately. + +```ruby +def lock_in_scheduled_renewal_immediately(subscription_id, + id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `id` | `Integer` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +id = 112 + +result = subscription_renewals_controller.lock_in_scheduled_renewal_immediately( + subscription_id, + id +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Unpublish Scheduled Renewal Configuration + +Returns a scheduled renewal configuration to an editable state. + +```ruby +def unpublish_scheduled_renewal_configuration(subscription_id, + id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `id` | `Integer` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +id = 112 + +result = subscription_renewals_controller.unpublish_scheduled_renewal_configuration( + subscription_id, + id +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "draft", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222 + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Cancel Scheduled Renewal Configuration + +Cancels a scheduled renewal configuration. + +```ruby +def cancel_scheduled_renewal_configuration(subscription_id, + id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `id` | `Integer` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +id = 112 + +result = subscription_renewals_controller.cancel_scheduled_renewal_configuration( + subscription_id, + id +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "canceled", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222 + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Create Scheduled Renewal Configuration Item + +Adds product and component line items to the scheduled renewal. + +```ruby +def create_scheduled_renewal_configuration_item(subscription_id, + scheduled_renewals_configuration_id, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `scheduled_renewals_configuration_id` | `Integer` | Template, Required | The scheduled renewal configuration id. | +| `body` | [`ScheduledRenewalConfigurationItemRequest`](../../doc/models/scheduled-renewal-configuration-item-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationItemResponse`](../../doc/models/scheduled-renewal-configuration-item-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +scheduled_renewals_configuration_id = 250 + +body = ScheduledRenewalConfigurationItemRequest.new( + renewal_configuration_item: ScheduledRenewalItemRequestBodyComponent.new( + item_type: 'Component', + item_id: 57, + quantity: 1, + custom_price: ScheduledRenewalComponentCustomPrice.new( + pricing_scheme: PricingScheme::STAIRSTEP, + prices: [ + Price.new( + starting_quantity: 1, + unit_price: 5, + ending_quantity: nil + ) + ] + ) + ) +) + +result = subscription_renewals_controller.create_scheduled_renewal_configuration_item( + subscription_id, + scheduled_renewals_configuration_id, + body: body +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "item_subclass": "SubscriptionProduct", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Update Scheduled Renewal Configuration Item + +Updates an existing configuration item’s pricing and quantity. + +```ruby +def update_scheduled_renewal_configuration_item(subscription_id, + scheduled_renewals_configuration_id, + id, + body: nil) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `scheduled_renewals_configuration_id` | `Integer` | Template, Required | The scheduled renewal configuration id. | +| `id` | `Integer` | Template, Required | The scheduled renewal configuration item id. | +| `body` | [`ScheduledRenewalUpdateRequest`](../../doc/models/scheduled-renewal-update-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationItemResponse`](../../doc/models/scheduled-renewal-configuration-item-response.md) + +## Example Usage + +```ruby +subscription_id = 222 + +scheduled_renewals_configuration_id = 250 + +id = 112 + +body = ScheduledRenewalUpdateRequest.new( + renewal_configuration_item: ScheduledRenewalItemRequestBodyComponent.new( + item_type: 'Component', + item_id: 57, + quantity: 2, + custom_price: ScheduledRenewalComponentCustomPrice.new( + pricing_scheme: PricingScheme::STAIRSTEP, + prices: [ + Price.new( + starting_quantity: 1, + unit_price: 5, + ending_quantity: nil + ) + ] + ) + ) +) + +result = subscription_renewals_controller.update_scheduled_renewal_configuration_item( + subscription_id, + scheduled_renewals_configuration_id, + id, + body: body +) +puts result +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Component", + "item_subclass": "SubscriptionComponent", + "price_point_id": 73, + "price_point_type": "ComponentPricePoint", + "quantity": 3, + "decimal_quantity": "3.0", + "created_at": "2025-09-01T12:00:00Z" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Delete Scheduled Renewal Configuration Item + +Removes an item from the pending renewal configuration. + +```ruby +def delete_scheduled_renewal_configuration_item(subscription_id, + scheduled_renewals_configuration_id, + id) +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `scheduled_renewals_configuration_id` | `Integer` | Template, Required | The scheduled renewal configuration id. | +| `id` | `Integer` | Template, Required | The scheduled renewal configuration item id. | + +## Response Type + +`void` + +## Example Usage + +```ruby +subscription_id = 222 + +scheduled_renewals_configuration_id = 250 + +id = 112 + +subscription_renewals_controller.delete_scheduled_renewal_configuration_item( + subscription_id, + scheduled_renewals_configuration_id, + id +) +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 6f9722e6..77905799 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -42,7 +42,7 @@ def retry_subscription(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -202,7 +202,8 @@ puts result # Cancel Subscription -The DELETE action causes the cancellation of the Subscription. This means, the method sets the Subscription state to "canceled". +Cancels the Subscription. The Delete method sets the Subscription state to `canceled`. +To cancel the subscription immediately, omit any schedule parameters from the request. To use the schedule options, the Schedule Subscription Cancellation feature must be enabled on your site. ```ruby def cancel_subscription(subscription_id, @@ -213,7 +214,7 @@ def cancel_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`CancellationRequest`](../../doc/models/cancellation-request.md) | Body, Optional | - | ## Response Type @@ -386,8 +387,8 @@ def resume_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | -| `calendar_billing_resumption_charge` | [`ResumptionCharge`](../../doc/models/resumption-charge.md) | Query, Optional | (For calendar billing subscriptions only) The way that the resumed subscription's charge should be handled

**Default**: `ResumptionCharge::PRORATED` | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | +| `calendar_billing_resumption_charge` | [`ResumptionCharge`](../../doc/models/resumption-charge.md) | Query, Optional | (For calendar billing subscriptions only) The way that the resumed subscription's charge should be handled.

**Default**: `ResumptionCharge::PRORATED` | ## Response Type @@ -535,7 +536,7 @@ def pause_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | ## Response Type @@ -695,7 +696,7 @@ def update_automatic_subscription_resumption(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | ## Response Type @@ -849,7 +850,7 @@ puts result # Reactivate Subscription -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). +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). **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.** @@ -870,6 +871,8 @@ If a reactivation with `resume: true` were attempted _before_ what would have be If a reactivation with `resume: true` were attempted _after_ what would have been the next billing date of July 1st, then Advanced Billing would not resume the subscription, and instead it would be reactivated with a new billing period. +If a reactivation with `resume: false`, or where 'resume" is omited were attempted, then Advanced Billing would reactivate the subscription with a new billing period regardless of whether or not resuming the previous billing period were possible. + | Canceled | Reactivation | Resumable? | |---|---|---| | Jun 15 | June 28 | Yes | @@ -1017,7 +1020,7 @@ def reactivate_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`ReactivateSubscriptionRequest`](../../doc/models/reactivate-subscription-request.md) | Body, Optional | - | ## Response Type @@ -1166,11 +1169,7 @@ puts result # Initiate Delayed Cancellation -Advanced Billing offers the ability to cancel a subscription at the end of the current billing period. This period is set by its current product. - -Requesting to cancel the subscription at the end of the period sets the `cancel_at_end_of_period` flag to true. - -Note that you cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription is past due. +Cancels a subscription at the end of the current billing period based on the subscription's current product. You cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription is past due. ```ruby def initiate_delayed_cancellation(subscription_id, @@ -1181,7 +1180,7 @@ def initiate_delayed_cancellation(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`CancellationRequest`](../../doc/models/cancellation-request.md) | Body, Optional | - | ## Response Type @@ -1219,7 +1218,7 @@ def cancel_delayed_cancellation(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -1261,7 +1260,7 @@ def cancel_dunning(subscription_id) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -1306,7 +1305,7 @@ Optionally, **you may provide your own custom quantities** for any component to ## Subscription Side Effects -You can request a `POST` to obtain this data from the endpoint without any side effects. Plain and simple, this will preview data, not log any changes against a subscription. +You can request a `POST` to obtain this data from the endpoint without any side effects. This method allows you to preview data, but does not log any changes against a subscription. ```ruby def preview_renewal(subscription_id, @@ -1317,7 +1316,7 @@ def preview_renewal(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`RenewalPreviewRequest`](../../doc/models/renewal-preview-request.md) | Body, Optional | - | ## Response Type diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index c30f7916..4a8883cb 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -232,7 +232,7 @@ puts result # List Subscriptions -This method will return an array of subscriptions from a Site. Pay close attention to query string filters and pagination in order to control responses from the server. +returns an array of subscriptions from a Site. Pay close attention to query string filters and pagination in order to control responses from the server. ## Search for a subscription @@ -353,7 +353,7 @@ def update_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`UpdateSubscriptionRequest`](../../doc/models/update-subscription-request.md) | Body, Optional | - | ## Response Type @@ -498,7 +498,7 @@ puts result # Read Subscription -Use this endpoint to find subscription details. +Retrieves subscription details. ## Self-Service Page token @@ -513,7 +513,7 @@ def read_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `include` | [`Array[SubscriptionInclude]`](../../doc/models/subscription-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=coupons&include[]=self_service_page_token`. | ## Response Type @@ -708,7 +708,7 @@ def override_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`OverrideSubscriptionRequest`](../../doc/models/override-subscription-request.md) | Body, Optional | Only these fields are available to be set. | ## Response Type @@ -796,7 +796,7 @@ def purge_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `ack` | `Integer` | Query, Required | id of the customer. | | `cascade` | [`Array[SubscriptionPurgeType]`](../../doc/models/subscription-purge-type.md) | Query, Optional | Options are "customer" or "payment_profile".
Use in query: `cascade[]=customer&cascade[]=payment_profile`. | @@ -844,7 +844,7 @@ def update_prepaid_subscription_configuration(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`UpsertPrepaidConfigurationRequest`](../../doc/models/upsert-prepaid-configuration-request.md) | Body, Optional | - | ## Response Type @@ -1089,7 +1089,7 @@ def apply_coupons_to_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `code` | `String` | Query, Optional | A code for the coupon that would be applied to a subscription | | `body` | [`AddCouponsRequest`](../../doc/models/add-coupons-request.md) | Body, Optional | - | @@ -1288,7 +1288,7 @@ def remove_coupon_from_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `coupon_code` | `String` | Query, Optional | The coupon code | ## Response Type @@ -1372,7 +1372,7 @@ def activate_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | +| `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription. | | `body` | [`ActivateSubscriptionRequest`](../../doc/models/activate-subscription-request.md) | Body, Optional | - | ## Response Type diff --git a/doc/models/activate-event-based-component.md b/doc/models/activate-event-based-component.md index 143bc7ea..ba7bd021 100644 --- a/doc/models/activate-event-based-component.md +++ b/doc/models/activate-event-based-component.md @@ -26,6 +26,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -37,8 +38,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/allocate-components.md b/doc/models/allocate-components.md index f2afbea0..0cbfc61c 100644 --- a/doc/models/allocate-components.md +++ b/doc/models/allocate-components.md @@ -13,8 +13,8 @@ | `proration_downgrade_scheme` | `String` | Optional | - | | `allocations` | [`Array[CreateAllocation]`](../../doc/models/create-allocation.md) | Optional | - | | `accrue_charge` | `TrueClass \| FalseClass` | Optional | - | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `payment_collection_method` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | (Optional) If not passed, the allocation(s) will use the payment collection method on the subscription | | `initiate_dunning` | `TrueClass \| FalseClass` | Optional | If true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. | @@ -27,19 +27,19 @@ "allocations": [ { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" }, { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" } ], "accrue_charge": false, diff --git a/doc/models/allocation-preview-item.md b/doc/models/allocation-preview-item.md index bc5133ef..348e5622 100644 --- a/doc/models/allocation-preview-item.md +++ b/doc/models/allocation-preview-item.md @@ -18,8 +18,8 @@ | `proration_upgrade_scheme` | `String` | Optional | - | | `proration_downgrade_scheme` | `String` | Optional | - | | `accrue_charge` | `TrueClass \| FalseClass` | Optional | - | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `price_point_id` | `Integer` | Optional | - | | `interval` | `Integer` | 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. | | `interval_unit` | [`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. | diff --git a/doc/models/allocation-settings.md b/doc/models/allocation-settings.md index 8bc0d9c5..d056e348 100644 --- a/doc/models/allocation-settings.md +++ b/doc/models/allocation-settings.md @@ -9,8 +9,8 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `accrue_charge` | `String` | Optional | Either "true" or "false". | ## Example (as JSON) diff --git a/doc/models/allocation.md b/doc/models/allocation.md index 65ab839c..8f160861 100644 --- a/doc/models/allocation.md +++ b/doc/models/allocation.md @@ -28,8 +28,8 @@ | `previous_price_point_id` | `Integer` | Optional | - | | `accrue_charge` | `TrueClass \| FalseClass` | Optional | If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. | | `initiate_dunning` | `TrueClass \| FalseClass` | Optional | If true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `payment` | [`PaymentForAllocation`](../../doc/models/payment-for-allocation.md) | Optional | - | | `expires_at` | `DateTime` | Optional | - | | `used_quantity` | `Integer` | Optional | - | diff --git a/doc/models/available-actions.md b/doc/models/available-actions.md new file mode 100644 index 00000000..29da049d --- /dev/null +++ b/doc/models/available-actions.md @@ -0,0 +1,24 @@ + +# Available Actions + +## Structure + +`AvailableActions` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `send_email` | [`SendEmail`](../../doc/models/send-email.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "send_email": { + "can_execute": false, + "url": "url0" + } +} +``` + diff --git a/doc/models/calendar-billing.md b/doc/models/calendar-billing.md index fa3fce8e..8b8ff4b6 100644 --- a/doc/models/calendar-billing.md +++ b/doc/models/calendar-billing.md @@ -11,14 +11,14 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `snap_day` | Integer \| [SnapDay](../../doc/models/snap-day.md) \| nil | Optional | This is a container for one-of cases. | +| `snap_day` | Integer \| String \| nil | Optional | This is a container for one-of cases. | | `calendar_billing_first_charge` | [`FirstChargeType`](../../doc/models/first-charge-type.md) | Optional | - | ## Example (as JSON) ```json { - "snap_day": 28, + "snap_day": 210, "calendar_billing_first_charge": "prorated" } ``` diff --git a/doc/models/cancellation-options.md b/doc/models/cancellation-options.md index b4ab649d..264b1446 100644 --- a/doc/models/cancellation-options.md +++ b/doc/models/cancellation-options.md @@ -9,15 +9,21 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `cancellation_message` | `String` | Optional | For your internal use. An indication as to why the subscription is being canceled. | -| `reason_code` | `String` | Optional | The reason code associated with the cancellation. See the list of reason codes associated with your site. | +| `cancellation_message` | `String` | Optional | An indication as to why the subscription is being canceled. For your internal use. | +| `reason_code` | `String` | Optional | The reason code associated with the cancellation. Use the [List Reason Codes](../../doc/controllers/reason-codes.md#list-reason-codes) endpoint to retrieve the reason codes associated with your site. | +| `cancel_at_end_of_period` | `TrueClass \| FalseClass` | Optional | When true, the subscription is cancelled at the current period end instead of immediately. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | +| `scheduled_cancellation_at` | `DateTime` | Optional | Schedules the cancellation on the provided date. This is option is not applicable for prepaid subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | +| `refund_prepayment_account_balance` | `TrueClass \| FalseClass` | Optional | Applies to prepaid subscriptions. When true, which is the default, the remaining prepaid balance is refunded as part of cancellation processing. When false, prepaid balance is not refunded as part of cancellation processing. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | ## Example (as JSON) ```json { "cancellation_message": "cancellation_message0", - "reason_code": "reason_code6" + "reason_code": "reason_code6", + "cancel_at_end_of_period": false, + "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", + "refund_prepayment_account_balance": false } ``` diff --git a/doc/models/cancellation-request.md b/doc/models/cancellation-request.md index 0599f69e..7b229041 100644 --- a/doc/models/cancellation-request.md +++ b/doc/models/cancellation-request.md @@ -17,7 +17,10 @@ { "subscription": { "cancellation_message": "cancellation_message2", - "reason_code": "reason_code8" + "reason_code": "reason_code8", + "cancel_at_end_of_period": false, + "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", + "refund_prepayment_account_balance": false } } ``` diff --git a/doc/models/clone-component-price-point-request.md b/doc/models/clone-component-price-point-request.md new file mode 100644 index 00000000..25aa3aef --- /dev/null +++ b/doc/models/clone-component-price-point-request.md @@ -0,0 +1,24 @@ + +# Clone Component Price Point Request + +## Structure + +`CloneComponentPricePointRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `price_point` | [`CloneComponentPricePoint`](../../doc/models/clone-component-price-point.md) | Required | - | + +## Example (as JSON) + +```json +{ + "price_point": { + "name": "name0", + "handle": "handle6" + } +} +``` + diff --git a/doc/models/clone-component-price-point.md b/doc/models/clone-component-price-point.md new file mode 100644 index 00000000..ad540de8 --- /dev/null +++ b/doc/models/clone-component-price-point.md @@ -0,0 +1,23 @@ + +# Clone Component Price Point + +## Structure + +`CloneComponentPricePoint` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `name` | `String` | Required | - | +| `handle` | `String` | Optional | - | + +## Example (as JSON) + +```json +{ + "name": "name2", + "handle": "handle8" +} +``` + diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index da84a323..ec990eda 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -15,7 +15,9 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | `pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | Omit for On/Off components | | `interval` | `Integer` | 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. | | `interval_unit` | [`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` | [`Array[Price]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1 | +| `list_price_point_id` | `Integer` | Optional | Optional id of the price point to use for list price calculations when
overriding the customer price. | +| `use_default_list_price` | `TrueClass \| FalseClass` | Optional | When true, list price calculations will continue to use the default price point even when a `custom_price` is supplied. | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1. | | `renew_prepaid_allocation` | `TrueClass \| FalseClass` | Optional | Applicable only to prepaid usage components. Controls whether the allocated quantity renews each period. | | `rollover_prepaid_remainder` | `TrueClass \| FalseClass` | Optional | Applicable only to prepaid usage components. Controls whether remaining units roll over to the next period. | | `expiration_interval` | `Integer` | Optional | Applicable only when rollover is enabled. Number of `expiration_interval_unit`s after which rollover amounts expire. | @@ -36,7 +38,7 @@ Create or update custom pricing unique to the subscription. Used in place of `pr "pricing_scheme": "stairstep", "interval": 162, "interval_unit": "day", - "renew_prepaid_allocation": false + "list_price_point_id": 146 } ``` diff --git a/doc/models/component-price-point-currency-overage-response.md b/doc/models/component-price-point-currency-overage-response.md new file mode 100644 index 00000000..0721f1f9 --- /dev/null +++ b/doc/models/component-price-point-currency-overage-response.md @@ -0,0 +1,27 @@ + +# Component Price Point Currency Overage Response + +## Structure + +`ComponentPricePointCurrencyOverageResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `price_point` | [`CurrencyOveragePrices`](../../doc/models/currency-overage-prices.md) | Required | Extends a component price point with currency overage prices. | + +## Example (as JSON) + +```json +{ + "price_point": { + "id": 248, + "type": "default", + "default": false, + "name": "name0", + "pricing_scheme": "per_unit" + } +} +``` + diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md index b9739951..452cf4cd 100644 --- a/doc/models/component-price-point.md +++ b/doc/models/component-price-point.md @@ -25,7 +25,7 @@ | `tax_included` | `TrueClass \| FalseClass` | Optional | - | | `interval` | `Integer` | 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. | | `interval_unit` | [`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. | -| `currency_prices` | [`Array[ComponentCurrencyPrice]`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. | +| `currency_prices` | [`Array[ComponentCurrencyPrice]`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. | | `overage_prices` | [`Array[ComponentPrice]`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | | `overage_pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. | | `renew_prepaid_allocation` | `TrueClass \| FalseClass` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. | diff --git a/doc/models/component.md b/doc/models/component.md index fae88d9c..8e3edf3e 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -31,8 +31,8 @@ | `taxable` | `TrueClass \| FalseClass` | Optional | Boolean flag describing whether a component is taxable or not. | | `tax_code` | `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` | `TrueClass \| FalseClass` | Optional | - | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `created_at` | `DateTime` | Optional | Timestamp indicating when this component was created | | `updated_at` | `DateTime` | Optional | Timestamp indicating when this component was updated | | `archived_at` | `DateTime` | Optional | Timestamp indicating when this component was archived | diff --git a/doc/models/containers/calendar-billing-snap-day.md b/doc/models/containers/calendar-billing-snap-day.md index c36a3be2..6e04756e 100644 --- a/doc/models/containers/calendar-billing-snap-day.md +++ b/doc/models/containers/calendar-billing-snap-day.md @@ -3,12 +3,12 @@ ## Data Type -`Integer | SnapDay` +`Integer | String` ## Cases | Type | | --- | | `Integer` | -| [`SnapDay`](../../../doc/models/snap-day.md) | +| `String` | diff --git a/doc/models/containers/clone-component-price-point-component-id.md b/doc/models/containers/clone-component-price-point-component-id.md new file mode 100644 index 00000000..a7ef7ac4 --- /dev/null +++ b/doc/models/containers/clone-component-price-point-component-id.md @@ -0,0 +1,14 @@ + +# Clone Component Price Point Component Id + +## Data Type + +`Integer | String` + +## Cases + +| Type | +| --- | +| `Integer` | +| `String` | + diff --git a/doc/models/containers/clone-component-price-point-price-point-id.md b/doc/models/containers/clone-component-price-point-price-point-id.md new file mode 100644 index 00000000..31804e8c --- /dev/null +++ b/doc/models/containers/clone-component-price-point-price-point-id.md @@ -0,0 +1,14 @@ + +# Clone Component Price Point Price Point Id + +## Data Type + +`Integer | String` + +## Cases + +| Type | +| --- | +| `Integer` | +| `String` | + diff --git a/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md b/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md new file mode 100644 index 00000000..88108485 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Configuration Item Request Renewal Configuration Item + +## Data Type + +`ScheduledRenewalItemRequestBodyComponent | ScheduledRenewalItemRequestBodyProduct` + +## Cases + +| Type | +| --- | +| [`ScheduledRenewalItemRequestBodyComponent`](../../../doc/models/scheduled-renewal-item-request-body-component.md) | +| [`ScheduledRenewalItemRequestBodyProduct`](../../../doc/models/scheduled-renewal-item-request-body-product.md) | + diff --git a/doc/models/containers/scheduled-renewal-product-price-point-interval.md b/doc/models/containers/scheduled-renewal-product-price-point-interval.md new file mode 100644 index 00000000..a067375d --- /dev/null +++ b/doc/models/containers/scheduled-renewal-product-price-point-interval.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Product Price Point Interval + +## Data Type + +`String | Integer` + +## Cases + +| Type | +| --- | +| `String` | +| `Integer` | + diff --git a/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md b/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md new file mode 100644 index 00000000..59a01566 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Product Price Point Price in Cents + +## Data Type + +`String | Integer` + +## Cases + +| Type | +| --- | +| `String` | +| `Integer` | + diff --git a/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md b/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md new file mode 100644 index 00000000..b6d6cce8 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Update Request Renewal Configuration Item + +## Data Type + +`ScheduledRenewalItemRequestBodyComponent | ScheduledRenewalItemRequestBodyProduct` + +## Cases + +| Type | +| --- | +| [`ScheduledRenewalItemRequestBodyComponent`](../../../doc/models/scheduled-renewal-item-request-body-component.md) | +| [`ScheduledRenewalItemRequestBodyProduct`](../../../doc/models/scheduled-renewal-item-request-body-product.md) | + diff --git a/doc/models/containers/subscription-snap-day.md b/doc/models/containers/subscription-snap-day.md deleted file mode 100644 index 9fd992fc..00000000 --- a/doc/models/containers/subscription-snap-day.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Subscription Snap Day - -## Data Type - -`Integer | SnapDay` - -## Cases - -| Type | -| --- | -| `Integer` | -| [`SnapDay`](../../../doc/models/snap-day.md) | - diff --git a/doc/models/containers/update-subscription-snap-day.md b/doc/models/containers/update-subscription-snap-day.md index d7dd7ede..dd4d7fd5 100644 --- a/doc/models/containers/update-subscription-snap-day.md +++ b/doc/models/containers/update-subscription-snap-day.md @@ -3,12 +3,12 @@ ## Data Type -`Integer | SnapDay` +`String | Integer` ## Cases | Type | | --- | +| `String` | | `Integer` | -| [`SnapDay`](../../../doc/models/snap-day.md) | diff --git a/doc/models/contract.md b/doc/models/contract.md new file mode 100644 index 00000000..6e12ab3d --- /dev/null +++ b/doc/models/contract.md @@ -0,0 +1,34 @@ + +# Contract + +Contract linked to the scheduled renewal configuration. + +## Structure + +`Contract` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `Integer` | Optional | - | +| `maxio_id` | `String` | Optional | - | +| `number` | `String` | Optional | - | +| `register` | [`Register`](../../doc/models/register.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "id": 136, + "maxio_id": "maxio_id8", + "number": "number6", + "register": { + "id": 54, + "maxio_id": "maxio_id4", + "name": "name2", + "currency_code": "currency_code2" + } +} +``` + diff --git a/doc/models/create-allocation-request.md b/doc/models/create-allocation-request.md index c76650cf..e94dd765 100644 --- a/doc/models/create-allocation-request.md +++ b/doc/models/create-allocation-request.md @@ -17,11 +17,11 @@ { "allocation": { "quantity": 228.94, + "decimal_quantity": "decimal_quantity6", + "previous_quantity": 254.04, + "decimal_previous_quantity": "decimal_previous_quantity8", "component_id": 8, - "memo": "memo2", - "proration_downgrade_scheme": "proration_downgrade_scheme4", - "proration_upgrade_scheme": "proration_upgrade_scheme6", - "accrue_charge": false + "memo": "memo2" } } ``` diff --git a/doc/models/create-allocation.md b/doc/models/create-allocation.md index 57f4e429..d386fb21 100644 --- a/doc/models/create-allocation.md +++ b/doc/models/create-allocation.md @@ -10,27 +10,31 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `quantity` | `Float` | Required | The allocated quantity to which to set the line-items allocated quantity. By default, this is an integer. If decimal allocations are enabled for the component, it will be a decimal number. For On/Off components, use 1for on and 0 for off. | -| `component_id` | `Integer` | Optional | (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made | -| `memo` | `String` | Optional | A memo to record along with the allocation | +| `decimal_quantity` | `String` | Optional | Decimal representation of the allocated quantity. Only valid when decimal
allocations are enabled for the component. | +| `previous_quantity` | `Float` | Optional | The quantity that was in effect before this allocation. Responses always
include this value; it may be supplied on preview requests to ensure the
expected change is evaluated. | +| `decimal_previous_quantity` | `String` | Optional | Decimal representation of `previous_quantity`. Only valid when decimal
allocations are enabled for the component. | +| `component_id` | `Integer` | Optional | (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made. | +| `memo` | `String` | Optional | A memo to record along with the allocation. | | `proration_downgrade_scheme` | `String` | Optional | The scheme used if the proration is a downgrade. Defaults to the site setting if one is not provided. | | `proration_upgrade_scheme` | `String` | Optional | The scheme used if the proration is an upgrade. Defaults to the site setting if one is not provided. | -| `accrue_charge` | `TrueClass \| FalseClass` | Optional | If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. Defaults to the site setting if one is not provided. | -| `downgrade_credit` | [`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`. | -| `upgrade_charge` | [`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`. | +| `downgrade_credit` | [`DowngradeCreditCreditType`](../../doc/models/downgrade-credit-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. Values are:

`full` - A full price credit is added for the amount owed.

`prorated` - A prorated credit is added for the amount owed.

`none` - No charge is added. | +| `upgrade_charge` | [`UpgradeChargeCreditType`](../../doc/models/upgrade-charge-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. Values are:

`full` - A charge is added for the full price of the component.

`prorated` - A charge is added for the prorated price of the component change.

`none` - No charge is added. | +| `accrue_charge` | `TrueClass \| FalseClass` | Optional | "If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately.

`true` - Attempt to charge the customer at the next renewal.

`false` - Attempt to charge the customer right away. If it fails, the charge will be accrued until the next renewal.

Defaults to the site setting if unspecified in the request. | | `initiate_dunning` | `TrueClass \| FalseClass` | 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. | | `price_point_id` | String \| Integer \| nil | Optional | This is a container for one-of cases. | | `billing_schedule` | [`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. | +| `custom_price` | [`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) ```json { "quantity": 8.06, + "decimal_quantity": "decimal_quantity4", + "previous_quantity": 218.92, + "decimal_previous_quantity": "decimal_previous_quantity0", "component_id": 192, - "memo": "memo4", - "proration_downgrade_scheme": "proration_downgrade_scheme2", - "proration_upgrade_scheme": "proration_upgrade_scheme4", - "accrue_charge": false + "memo": "memo4" } ``` diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md index e4bf5adf..1cce19e0 100644 --- a/doc/models/create-subscription.md +++ b/doc/models/create-subscription.md @@ -13,7 +13,7 @@ | `product_id` | `Integer` | Optional | The Product ID of the product for which you are creating a subscription. The product ID is not currently published, so we recommend using the API Handle instead. | | `product_price_point_handle` | `String` | Optional | The user-friendly API handle of a product's particular price point. | | `product_price_point_id` | `Integer` | Optional | The ID of the particular price point on the product. | -| `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | +| `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | | `coupon_code` | `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. | | `coupon_codes` | `Array[String]` | Optional | An array for all the coupons attached to the subscription. | | `payment_collection_method` | [`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`. | diff --git a/doc/models/create-usage-request.md b/doc/models/create-usage-request.md index d94b5821..1a754cbc 100644 --- a/doc/models/create-usage-request.md +++ b/doc/models/create-usage-request.md @@ -27,6 +27,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -38,8 +39,7 @@ "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 8b518ca0..49584174 100644 --- a/doc/models/create-usage.md +++ b/doc/models/create-usage.md @@ -30,6 +30,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -41,8 +42,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/credit-type.md b/doc/models/credit-type.md index b92ca7b7..f7d2a090 100644 --- a/doc/models/credit-type.md +++ b/doc/models/credit-type.md @@ -2,7 +2,6 @@ # Credit Type 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`. ## Enumeration diff --git a/doc/models/currency-overage-prices.md b/doc/models/currency-overage-prices.md new file mode 100644 index 00000000..695688bd --- /dev/null +++ b/doc/models/currency-overage-prices.md @@ -0,0 +1,50 @@ + +# Currency Overage Prices + +Extends a component price point with currency overage prices. + +## Structure + +`CurrencyOveragePrices` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `Integer` | Optional | - | +| `type` | [`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. | +| `default` | `TrueClass \| FalseClass` | Optional | Note: Refer to type attribute instead | +| `name` | `String` | Optional | - | +| `pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | +| `component_id` | `Integer` | Optional | - | +| `handle` | `String` | Optional | - | +| `archived_at` | `DateTime` | Optional | - | +| `created_at` | `DateTime` | Optional | - | +| `updated_at` | `DateTime` | Optional | - | +| `prices` | [`Array[ComponentPrice]`](../../doc/models/component-price.md) | Optional | - | +| `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site. Defaults to true during creation. | +| `subscription_id` | `Integer` | Optional | (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the subscription that the custom price point is for. | +| `tax_included` | `TrueClass \| FalseClass` | Optional | - | +| `interval` | `Integer` | 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. | +| `interval_unit` | [`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. | +| `currency_prices` | [`Array[ComponentCurrencyPrice]`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. | +| `overage_prices` | [`Array[ComponentPrice]`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | +| `overage_pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. | +| `renew_prepaid_allocation` | `TrueClass \| FalseClass` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. | +| `rollover_prepaid_remainder` | `TrueClass \| FalseClass` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not remaining units should be rolled over to the next period. | +| `expiration_interval` | `Integer` | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of `expiration_interval_unit`s after which rollover amounts should expire. | +| `expiration_interval_unit` | [`ExpirationIntervalUnit`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string representing the expiration interval unit for this component, either month or day. | +| `currency_overage_prices` | [`Array[ComponentCurrencyPrice]`](../../doc/models/component-currency-price.md) | Optional | Applicable only to prepaid usage components. An array of currency pricing data for overage prices. | + +## Example (as JSON) + +```json +{ + "id": 50, + "type": "catalog", + "default": false, + "name": "name8", + "pricing_scheme": "stairstep" +} +``` + diff --git a/doc/models/deliver-proforma-invoice-request.md b/doc/models/deliver-proforma-invoice-request.md new file mode 100644 index 00000000..52546246 --- /dev/null +++ b/doc/models/deliver-proforma-invoice-request.md @@ -0,0 +1,33 @@ + +# Deliver Proforma Invoice Request + +## Structure + +`DeliverProformaInvoiceRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `recipient_emails` | `Array[String]` | Optional | - | +| `cc_recipient_emails` | `Array[String]` | Optional | - | +| `bcc_recipient_emails` | `Array[String]` | Optional | - | + +## Example (as JSON) + +```json +{ + "recipient_emails": [ + "recipient_emails9" + ], + "cc_recipient_emails": [ + "cc_recipient_emails8" + ], + "bcc_recipient_emails": [ + "bcc_recipient_emails2", + "bcc_recipient_emails3", + "bcc_recipient_emails4" + ] +} +``` + diff --git a/doc/models/downgrade-credit-credit-type.md b/doc/models/downgrade-credit-credit-type.md new file mode 100644 index 00000000..50858a3b --- /dev/null +++ b/doc/models/downgrade-credit-credit-type.md @@ -0,0 +1,23 @@ + +# Downgrade Credit Credit Type + +The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + +`full` - A full price credit is added for the amount owed. + +`prorated` - A prorated credit is added for the amount owed. + +`none` - No charge is added. + +## Enumeration + +`DowngradeCreditCreditType` + +## Fields + +| Name | +| --- | +| `FULL` | +| `PRORATED` | +| `NONE` | + diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index 667d4327..b83794a3 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -13,8 +13,8 @@ | `description` | `String` | Optional | A description for the component that will be displayed to the user on the hosted signup page. | | `handle` | `String` | Optional | A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.

**Constraints**: *Pattern*: `^[a-z0-9][a-z0-9\-_:.]*$` | | `taxable` | `TrueClass \| FalseClass` | Optional | Boolean flag describing whether a component is taxable or not. | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `price_points` | [`Array[ComponentPricePointItem]`](../../doc/models/component-price-point-item.md) | Optional | - | | `unit_price` | String \| Float | Required | This is a container for one-of cases. | | `tax_code` | `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. | diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md index d1ed2e99..57cd75b0 100644 --- a/doc/models/prepaid-usage-component.md +++ b/doc/models/prepaid-usage-component.md @@ -16,8 +16,8 @@ | `taxable` | `TrueClass \| FalseClass` | Optional | Boolean flag describing whether a component is taxable or not. | | `pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | | `prices` | [`Array[Price]`](../../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. | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `price_points` | [`Array[CreatePrepaidUsageComponentPricePoint]`](../../doc/models/create-prepaid-usage-component-price-point.md) | Optional | - | | `unit_price` | String \| Float \| nil | Optional | This is a container for one-of cases. | | `tax_code` | `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. | diff --git a/doc/models/preview-allocations-request.md b/doc/models/preview-allocations-request.md index a87126f4..3aec22f4 100644 --- a/doc/models/preview-allocations-request.md +++ b/doc/models/preview-allocations-request.md @@ -11,8 +11,8 @@ | --- | --- | --- | --- | | `allocations` | [`Array[CreateAllocation]`](../../doc/models/create-allocation.md) | Required | - | | `effective_proration_date` | `Date` | Optional | To calculate proration amounts for a future time. Only within a current subscription period. Only ISO8601 format is supported. | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | ## Example (as JSON) @@ -21,11 +21,11 @@ "allocations": [ { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" } ], "effective_proration_date": "2023-12-01", diff --git a/doc/models/product-family.md b/doc/models/product-family.md index 8265aeb6..e04a0b05 100644 --- a/doc/models/product-family.md +++ b/doc/models/product-family.md @@ -16,6 +16,7 @@ | `description` | `String` | Optional | - | | `created_at` | `DateTime` | Optional | - | | `updated_at` | `DateTime` | Optional | - | +| `archived_at` | `DateTime` | Optional | Timestamp indicating when this product family was archived. `null` if the product family is not archived. | ## Example (as JSON) diff --git a/doc/models/proforma-invoice.md b/doc/models/proforma-invoice.md index 1900554a..33850164 100644 --- a/doc/models/proforma-invoice.md +++ b/doc/models/proforma-invoice.md @@ -45,6 +45,7 @@ | `payments` | [`Array[ProformaInvoicePayment]`](../../doc/models/proforma-invoice-payment.md) | Optional | - | | `custom_fields` | [`Array[InvoiceCustomField]`](../../doc/models/invoice-custom-field.md) | Optional | - | | `public_url` | `String` | Optional | - | +| `available_actions` | [`AvailableActions`](../../doc/models/available-actions.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md index 6f3893c7..f9fd4ca8 100644 --- a/doc/models/quantity-based-component.md +++ b/doc/models/quantity-based-component.md @@ -16,8 +16,8 @@ | `taxable` | `TrueClass \| FalseClass` | Optional | Boolean flag describing whether a component is taxable or not. | | `pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | | `prices` | [`Array[Price]`](../../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. | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `price_points` | [`Array[ComponentPricePointItem]`](../../doc/models/component-price-point-item.md) | Optional | - | | `unit_price` | String \| Float \| nil | Optional | This is a container for one-of cases. | | `tax_code` | `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. | diff --git a/doc/models/reactivate-subscription-request.md b/doc/models/reactivate-subscription-request.md index dc4f6b6d..f07490c9 100644 --- a/doc/models/reactivate-subscription-request.md +++ b/doc/models/reactivate-subscription-request.md @@ -13,7 +13,7 @@ | `include_trial` | `TrueClass \| FalseClass` | Optional | If `true` is sent, the reactivated Subscription will include a trial if one is available. If `false` is sent, the trial period will be ignored. | | `preserve_balance` | `TrueClass \| FalseClass` | Optional | If `true` is passed, the existing subscription balance will NOT be cleared/reset before adding the additional reactivation charges. | | `coupon_code` | `String` | Optional | The coupon code to be applied during reactivation. | -| `use_credits_and_prepayments` | `TrueClass \| FalseClass` | Optional | If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. | +| `use_credits_and_prepayments` | `TrueClass \| FalseClass` | Optional | If true is sent, Advanced Billing will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. | | `resume` | TrueClass \| FalseClass \| [Resume Options](../../doc/models/resume-options.md) \| nil | Optional | This is a container for one-of cases. | ## Example (as JSON) diff --git a/doc/models/register.md b/doc/models/register.md new file mode 100644 index 00000000..e7e9592f --- /dev/null +++ b/doc/models/register.md @@ -0,0 +1,27 @@ + +# Register + +## Structure + +`Register` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `Integer` | Optional | - | +| `maxio_id` | `String` | Optional | - | +| `name` | `String` | Optional | - | +| `currency_code` | `String` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | + +## Example (as JSON) + +```json +{ + "id": 90, + "maxio_id": "maxio_id0", + "name": "name6", + "currency_code": "currency_code2" +} +``` + diff --git a/doc/models/scheduled-renewal-component-custom-price.md b/doc/models/scheduled-renewal-component-custom-price.md new file mode 100644 index 00000000..9f1bf922 --- /dev/null +++ b/doc/models/scheduled-renewal-component-custom-price.md @@ -0,0 +1,33 @@ + +# Scheduled Renewal Component Custom Price + +Custom pricing for a component within a scheduled renewal. + +## Structure + +`ScheduledRenewalComponentCustomPrice` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `tax_included` | `TrueClass \| FalseClass` | Optional | Whether or not the price point includes tax | +| `pricing_scheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | Omit for On/Off components | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1. | + +## Example (as JSON) + +```json +{ + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "tax_included": false +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item-request.md b/doc/models/scheduled-renewal-configuration-item-request.md new file mode 100644 index 00000000..1c50749a --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item-request.md @@ -0,0 +1,42 @@ + +# Scheduled Renewal Configuration Item Request + +## Structure + +`ScheduledRenewalConfigurationItemRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `renewal_configuration_item` | [Scheduled Renewal Item Request Body Component](../../doc/models/scheduled-renewal-item-request-body-component.md) \| [Scheduled Renewal Item Request Body Product](../../doc/models/scheduled-renewal-item-request-body-product.md) | Required | This is a container for one-of cases. | + +## Example (as JSON) + +```json +{ + "renewal_configuration_item": { + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item-response.md b/doc/models/scheduled-renewal-configuration-item-response.md new file mode 100644 index 00000000..ec6dbeda --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item-response.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Item Response + +## Structure + +`ScheduledRenewalConfigurationItemResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `scheduled_renewal_configuration_item` | [`ScheduledRenewalConfigurationItem`](../../doc/models/scheduled-renewal-configuration-item.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 98, + "subscription_id": 208, + "subscription_renewal_configuration_id": 108, + "item_id": 246, + "item_type": "item_type2" + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item.md b/doc/models/scheduled-renewal-configuration-item.md new file mode 100644 index 00000000..f575e91c --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item.md @@ -0,0 +1,35 @@ + +# Scheduled Renewal Configuration Item + +## Structure + +`ScheduledRenewalConfigurationItem` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `Integer` | Optional | - | +| `subscription_id` | `Integer` | Optional | - | +| `subscription_renewal_configuration_id` | `Integer` | Optional | - | +| `item_id` | `Integer` | Optional | - | +| `item_type` | `String` | Optional | - | +| `item_subclass` | `String` | Optional | - | +| `price_point_id` | `Integer` | Optional | - | +| `price_point_type` | `String` | Optional | - | +| `quantity` | `Integer` | Optional | - | +| `decimal_quantity` | `String` | Optional | - | +| `created_at` | `DateTime` | Optional | - | + +## Example (as JSON) + +```json +{ + "id": 146, + "subscription_id": 0, + "subscription_renewal_configuration_id": 156, + "item_id": 38, + "item_type": "item_type4" +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-request-body.md b/doc/models/scheduled-renewal-configuration-request-body.md new file mode 100644 index 00000000..e5f82598 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-request-body.md @@ -0,0 +1,29 @@ + +# Scheduled Renewal Configuration Request Body + +## Structure + +`ScheduledRenewalConfigurationRequestBody` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `starts_at` | `DateTime` | Optional | (Optional) Start of the renewal term. | +| `ends_at` | `DateTime` | Optional | (Optional) End of the renewal term. | +| `lock_in_at` | `DateTime` | Optional | (Optional) Lock-in date for the renewal. | +| `contract_id` | `Integer` | Optional | (Optional) Existing contract to associate with the scheduled renewal. Contracts must be enabled for your site. | +| `create_new_contract` | `TrueClass \| FalseClass` | Optional | (Optional) Set to true to create a new contract when contracts are enabled. Contracts must be enabled for your site. | + +## Example (as JSON) + +```json +{ + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z", + "lock_in_at": "2016-03-13T12:52:32.123Z", + "contract_id": 110, + "create_new_contract": false +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-request.md b/doc/models/scheduled-renewal-configuration-request.md new file mode 100644 index 00000000..a3e40f78 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-request.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Request + +## Structure + +`ScheduledRenewalConfigurationRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `renewal_configuration` | [`ScheduledRenewalConfigurationRequestBody`](../../doc/models/scheduled-renewal-configuration-request-body.md) | Required | - | + +## Example (as JSON) + +```json +{ + "renewal_configuration": { + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z", + "lock_in_at": "2016-03-13T12:52:32.123Z", + "contract_id": 244, + "create_new_contract": false + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-response.md b/doc/models/scheduled-renewal-configuration-response.md new file mode 100644 index 00000000..8869eaba --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-response.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Response + +## Structure + +`ScheduledRenewalConfigurationResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `scheduled_renewal_configuration` | [`ScheduledRenewalConfiguration`](../../doc/models/scheduled-renewal-configuration.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configuration": { + "id": 134, + "site_id": 60, + "subscription_id": 244, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration.md b/doc/models/scheduled-renewal-configuration.md new file mode 100644 index 00000000..422d42d6 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration.md @@ -0,0 +1,34 @@ + +# Scheduled Renewal Configuration + +## Structure + +`ScheduledRenewalConfiguration` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `id` | `Integer` | Optional | ID of the renewal. | +| `site_id` | `Integer` | Optional | ID of the site to which the renewal belongs. | +| `subscription_id` | `Integer` | Optional | The id of the subscription. | +| `starts_at` | `DateTime` | Optional | - | +| `ends_at` | `DateTime` | Optional | - | +| `lock_in_at` | `DateTime` | Optional | - | +| `created_at` | `DateTime` | Optional | - | +| `status` | `String` | Optional | - | +| `scheduled_renewal_configuration_items` | [`Array[ScheduledRenewalConfigurationItem]`](../../doc/models/scheduled-renewal-configuration-item.md) | Optional | - | +| `contract` | [`Contract`](../../doc/models/contract.md) | Optional | Contract linked to the scheduled renewal configuration. | + +## Example (as JSON) + +```json +{ + "id": 152, + "site_id": 78, + "subscription_id": 6, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" +} +``` + diff --git a/doc/models/scheduled-renewal-configurations-response.md b/doc/models/scheduled-renewal-configurations-response.md new file mode 100644 index 00000000..5fd02f6d --- /dev/null +++ b/doc/models/scheduled-renewal-configurations-response.md @@ -0,0 +1,43 @@ + +# Scheduled Renewal Configurations Response + +## Structure + +`ScheduledRenewalConfigurationsResponse` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `scheduled_renewal_configurations` | [`Array[ScheduledRenewalConfiguration]`](../../doc/models/scheduled-renewal-configuration.md) | Optional | - | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configurations": [ + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + }, + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + }, + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + } + ] +} +``` + diff --git a/doc/models/scheduled-renewal-item-request-body-component.md b/doc/models/scheduled-renewal-item-request-body-component.md new file mode 100644 index 00000000..5ed650ea --- /dev/null +++ b/doc/models/scheduled-renewal-item-request-body-component.md @@ -0,0 +1,44 @@ + +# Scheduled Renewal Item Request Body Component + +## Structure + +`ScheduledRenewalItemRequestBodyComponent` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `item_type` | `String` | Required, Constant | Item type to add. Either Product or Component.

**Value**: `'Component'` | +| `item_id` | `Integer` | Required | Product or component identifier. | +| `price_point_id` | `Integer` | Optional | Price point identifier. | +| `quantity` | `Integer` | Optional | Optional quantity for the item. | +| `custom_price` | [`ScheduledRenewalComponentCustomPrice`](../../doc/models/scheduled-renewal-component-custom-price.md) | Optional | Custom pricing for a component within a scheduled renewal. | + +## Example (as JSON) + +```json +{ + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } +} +``` + diff --git a/doc/models/scheduled-renewal-item-request-body-product.md b/doc/models/scheduled-renewal-item-request-body-product.md new file mode 100644 index 00000000..da25a6c6 --- /dev/null +++ b/doc/models/scheduled-renewal-item-request-body-product.md @@ -0,0 +1,38 @@ + +# Scheduled Renewal Item Request Body Product + +## Structure + +`ScheduledRenewalItemRequestBodyProduct` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `item_type` | `String` | Required, Constant | Item type to add. Either Product or Component.

**Value**: `'Product'` | +| `item_id` | `Integer` | Required | Product or component identifier. | +| `price_point_id` | `Integer` | Optional | Price point identifier. | +| `quantity` | `Integer` | Optional | Optional quantity for the item. | +| `custom_price` | [`ScheduledRenewalProductPricePoint`](../../doc/models/scheduled-renewal-product-price-point.md) | Optional | Custom pricing for a product within a scheduled renewal. | + +## Example (as JSON) + +```json +{ + "item_type": "Product", + "item_id": 32, + "price_point_id": 18, + "quantity": 96, + "custom_price": { + "name": "name4", + "handle": "handle0", + "price_in_cents": "String3", + "interval": "String3", + "interval_unit": "day", + "tax_included": false, + "initial_charge_in_cents": 30, + "expiration_interval": 52 + } +} +``` + diff --git a/doc/models/scheduled-renewal-lock-in-request.md b/doc/models/scheduled-renewal-lock-in-request.md new file mode 100644 index 00000000..4a2fcaf5 --- /dev/null +++ b/doc/models/scheduled-renewal-lock-in-request.md @@ -0,0 +1,21 @@ + +# Scheduled Renewal Lock in Request + +## Structure + +`ScheduledRenewalLockInRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `lock_in_at` | `Date` | Required | Date to lock in the renewal. | + +## Example (as JSON) + +```json +{ + "lock_in_at": "2016-03-13" +} +``` + diff --git a/doc/models/scheduled-renewal-product-price-point.md b/doc/models/scheduled-renewal-product-price-point.md new file mode 100644 index 00000000..22fc2eb4 --- /dev/null +++ b/doc/models/scheduled-renewal-product-price-point.md @@ -0,0 +1,38 @@ + +# Scheduled Renewal Product Price Point + +Custom pricing for a product within a scheduled renewal. + +## Structure + +`ScheduledRenewalProductPricePoint` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `name` | `String` | Optional | (Optional) | +| `handle` | `String` | Optional | (Optional) | +| `price_in_cents` | String \| Integer | Required | This is a container for one-of cases. | +| `interval` | String \| Integer | Required | This is a container for one-of cases. | +| `interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Required | Required if using `custom_price` attribute. | +| `tax_included` | `TrueClass \| FalseClass` | Optional | (Optional) | +| `initial_charge_in_cents` | `Integer` | Optional | The product price point initial charge, in integer cents. | +| `expiration_interval` | `Integer` | 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. | +| `expiration_interval_unit` | [`ExpirationIntervalUnit`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this product price point, either month, day or never | + +## Example (as JSON) + +```json +{ + "name": "name4", + "handle": "handle0", + "price_in_cents": "String3", + "interval": "String9", + "interval_unit": "day", + "tax_included": false, + "initial_charge_in_cents": 86, + "expiration_interval": 108 +} +``` + diff --git a/doc/models/scheduled-renewal-update-request.md b/doc/models/scheduled-renewal-update-request.md new file mode 100644 index 00000000..01fa85c0 --- /dev/null +++ b/doc/models/scheduled-renewal-update-request.md @@ -0,0 +1,42 @@ + +# Scheduled Renewal Update Request + +## Structure + +`ScheduledRenewalUpdateRequest` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `renewal_configuration_item` | [Scheduled Renewal Item Request Body Component](../../doc/models/scheduled-renewal-item-request-body-component.md) \| [Scheduled Renewal Item Request Body Product](../../doc/models/scheduled-renewal-item-request-body-product.md) | Required | This is a container for one-of cases. | + +## Example (as JSON) + +```json +{ + "renewal_configuration_item": { + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } + } +} +``` + diff --git a/doc/models/send-email.md b/doc/models/send-email.md new file mode 100644 index 00000000..a49726ae --- /dev/null +++ b/doc/models/send-email.md @@ -0,0 +1,23 @@ + +# Send Email + +## Structure + +`SendEmail` + +## Fields + +| Name | Type | Tags | Description | +| --- | --- | --- | --- | +| `can_execute` | `TrueClass \| FalseClass` | Required | - | +| `url` | `String` | Required | - | + +## Example (as JSON) + +```json +{ + "can_execute": false, + "url": "url2" +} +``` + diff --git a/doc/models/send-invoice-request.md b/doc/models/send-invoice-request.md index 6bb425d5..d1e4356b 100644 --- a/doc/models/send-invoice-request.md +++ b/doc/models/send-invoice-request.md @@ -12,6 +12,7 @@ | `recipient_emails` | `Array[String]` | Optional | **Constraints**: *Maximum Items*: `5` | | `cc_recipient_emails` | `Array[String]` | Optional | **Constraints**: *Maximum Items*: `5` | | `bcc_recipient_emails` | `Array[String]` | Optional | **Constraints**: *Maximum Items*: `5` | +| `attachment_urls` | `Array[String]` | Optional | Array of URLs to files to attach to the invoice email. Max 10 files, 10MB each.

**Constraints**: *Maximum Items*: `10` | ## Example (as JSON) @@ -27,6 +28,10 @@ ], "bcc_recipient_emails": [ "bcc_recipient_emails6" + ], + "attachment_urls": [ + "attachment_urls0", + "attachment_urls1" ] } ``` diff --git a/doc/models/snap-day.md b/doc/models/snap-day.md deleted file mode 100644 index 80c32f22..00000000 --- a/doc/models/snap-day.md +++ /dev/null @@ -1,13 +0,0 @@ - -# Snap Day - -## Enumeration - -`SnapDay` - -## Fields - -| Name | -| --- | -| `ENUM_END` | - diff --git a/doc/models/status.md b/doc/models/status.md new file mode 100644 index 00000000..3531d2ce --- /dev/null +++ b/doc/models/status.md @@ -0,0 +1,18 @@ + +# Status + +## Enumeration + +`Status` + +## Fields + +| Name | +| --- | +| `DRAFT` | +| `SCHEDULED` | +| `PENDING` | +| `CANCELED` | +| `ACTIVE` | +| `FULFILLED` | + diff --git a/doc/models/subscription-component.md b/doc/models/subscription-component.md index b162ce1d..354c45c6 100644 --- a/doc/models/subscription-component.md +++ b/doc/models/subscription-component.md @@ -22,8 +22,8 @@ | `component_handle` | `String` | Optional | - | | `subscription_id` | `Integer` | Optional | - | | `recurring` | `TrueClass \| FalseClass` | Optional | - | -| `upgrade_charge` | [`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`. | -| `downgrade_credit` | [`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`. | +| `upgrade_charge` | [`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. | +| `downgrade_credit` | [`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. | | `archived_at` | `DateTime` | Optional | - | | `price_point_id` | `Integer` | Optional | - | | `price_point_handle` | `String` | Optional | - | diff --git a/doc/models/subscription-custom-price.md b/doc/models/subscription-custom-price.md index d0acbd9c..895eea6c 100644 --- a/doc/models/subscription-custom-price.md +++ b/doc/models/subscription-custom-price.md @@ -1,7 +1,7 @@ # Subscription Custom Price -(Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription +(Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. ## Structure diff --git a/doc/models/subscription-group-component-custom-price.md b/doc/models/subscription-group-component-custom-price.md index 1185f36a..745aaa61 100644 --- a/doc/models/subscription-group-component-custom-price.md +++ b/doc/models/subscription-group-component-custom-price.md @@ -33,14 +33,14 @@ Used in place of `price_point_id` to define a custom price point unique to the s "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } ] } diff --git a/doc/models/subscription-group-response.md b/doc/models/subscription-group-response.md index 7a1b1923..34401973 100644 --- a/doc/models/subscription-group-response.md +++ b/doc/models/subscription-group-response.md @@ -16,6 +16,7 @@ ```json { "subscription_group": { + "uid": "uid8", "customer_id": 220, "payment_profile": { "id": 44, @@ -27,8 +28,7 @@ "subscription_ids": [ 74, 75 - ], - "created_at": "2016-03-13T12:52:32.123Z" + ] } } ``` diff --git a/doc/models/subscription-group-signup-component.md b/doc/models/subscription-group-signup-component.md index 092dcbce..38fbdb0d 100644 --- a/doc/models/subscription-group-signup-component.md +++ b/doc/models/subscription-group-signup-component.md @@ -43,42 +43,42 @@ "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] }, { "tax_included": false, "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] }, { "tax_included": false, "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } ] } diff --git a/doc/models/subscription-group-signup-item.md b/doc/models/subscription-group-signup-item.md index 90dbd42d..4a810245 100644 --- a/doc/models/subscription-group-signup-item.md +++ b/doc/models/subscription-group-signup-item.md @@ -19,7 +19,7 @@ | `currency` | `String` | Optional | (Optional) If Multi-Currency is enabled and the currency is configured in Chargify, pass it at signup to create a subscription on a non-default currency. Note that you cannot update the currency of an existing subscription. | | `coupon_codes` | `Array[String]` | Optional | An array for all the coupons attached to the subscription. | | `components` | [`Array[SubscriptionGroupSignupComponent]`](../../doc/models/subscription-group-signup-component.md) | Optional | - | -| `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | +| `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | | `calendar_billing` | [`CalendarBilling`](../../doc/models/calendar-billing.md) | Optional | (Optional). Cannot be used when also specifying next_billing_at | | `metafields` | `Hash[String, String]` | Optional | (Optional) A set of key/value pairs representing custom fields and their values. Metafields will be created “on-the-fly” in your site for a given key, if they have not been created yet. | diff --git a/doc/models/subscription-group.md b/doc/models/subscription-group.md index 33566850..cf6ea592 100644 --- a/doc/models/subscription-group.md +++ b/doc/models/subscription-group.md @@ -9,6 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | +| `uid` | `String` | Optional | - | | `customer_id` | `Integer` | Optional | - | | `payment_profile` | [`SubscriptionGroupPaymentProfile`](../../doc/models/subscription-group-payment-profile.md) | Optional | - | | `payment_collection_method` | [`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`. | @@ -19,6 +20,7 @@ ```json { + "uid": "uid4", "customer_id": 36, "payment_profile": { "id": 44, @@ -31,8 +33,7 @@ 146, 147, 148 - ], - "created_at": "2016-03-13T12:52:32.123Z" + ] } ``` diff --git a/doc/models/subscription-sort.md b/doc/models/subscription-sort.md index 8ccb033b..b07e8ee0 100644 --- a/doc/models/subscription-sort.md +++ b/doc/models/subscription-sort.md @@ -15,4 +15,8 @@ | `NEXT_ASSESSMENT` | | `UPDATED_AT` | | `CREATED_AT` | +| `TOTAL_PAYMENTS` | +| `ID` | +| `OPEN_BALANCE` | +| `EXPIRES_AT` | diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 1692bc39..f48bbf2e 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -33,7 +33,7 @@ | `signup_revenue` | `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) | | `delayed_cancel_at` | `DateTime` | Optional | Timestamp for when the subscription is currently set to cancel. | | `coupon_code` | `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. | -| `snap_day` | Integer \| [SnapDay](../../doc/models/snap-day.md) \| nil | Optional | This is a container for one-of cases. | +| `snap_day` | `String` | Optional | A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. | | `payment_collection_method` | [`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 | - | @@ -46,7 +46,7 @@ | `next_product_handle` | `String` | Optional | If a delayed product change is scheduled, the handle of the product that the subscription will be changed to at the next renewal. | | `coupon_use_count` | `Integer` | Optional | (deprecated) How many times the subscription's single coupon has been used. This field has no replacement for multiple coupons. | | `coupon_uses_allowed` | `Integer` | Optional | (deprecated) How many times the subscription's single coupon may be used. This field has no replacement for multiple coupons. | -| `reason_code` | `String` | Optional | If the subscription is canceled, this is their churn code. | +| `reason_code` | `String` | Optional | The churn reason code associated to a cancelled subscription. | | `automatically_resume_at` | `DateTime` | Optional | The date the subscription is scheduled to automatically resume from the on_hold state. | | `coupon_codes` | `Array[String]` | Optional | An array for all the coupons attached to the subscription. | | `offer_id` | `Integer` | Optional | The ID of the offer associated with the subscription. | @@ -57,7 +57,7 @@ | `next_product_price_point_id` | `Integer` | 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. | | `net_terms` | `Integer` | Optional | On Relationship Invoicing, the number of days before a renewal invoice is due. | | `stored_credential_transaction_id` | `Integer` | Optional | For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer. This will ensure the card will be charged successfully at renewal. | -| `reference` | `String` | Optional | The reference value (provided by your app) for the subscription itelf. | +| `reference` | `String` | Optional | The reference value (provided by your app) for the subscription istelf. | | `on_hold_at` | `DateTime` | Optional | The timestamp of the most recent on hold action. | | `prepaid_dunning` | `TrueClass \| FalseClass` | Optional | Boolean representing whether the subscription is prepaid and currently in dunning. Only returned for Relationship Invoicing sites with the feature enabled | | `coupons` | [`Array[SubscriptionIncludedCoupon]`](../../doc/models/subscription-included-coupon.md) | Optional | Additional coupon data. To use this data you also have to include the following param in the request`include[]=coupons`.
Only in Read Subscription Endpoint. | diff --git a/doc/models/update-component.md b/doc/models/update-component.md index 30130d53..e0e8e332 100644 --- a/doc/models/update-component.md +++ b/doc/models/update-component.md @@ -17,7 +17,7 @@ | `tax_code` | `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. | | `item_category` | [`ItemCategory`](../../doc/models/item-category.md) | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | | `display_on_hosted_page` | `TrueClass \| FalseClass` | Optional | - | -| `upgrade_charge` | [`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`. | +| `upgrade_charge` | [`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. | ## Example (as JSON) diff --git a/doc/models/update-subscription-component.md b/doc/models/update-subscription-component.md index 63423dd9..b17ca839 100644 --- a/doc/models/update-subscription-component.md +++ b/doc/models/update-subscription-component.md @@ -22,6 +22,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -33,8 +34,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/update-subscription.md b/doc/models/update-subscription.md index 6777f412..b59bf88c 100644 --- a/doc/models/update-subscription.md +++ b/doc/models/update-subscription.md @@ -15,7 +15,7 @@ | `product_change_delayed` | `TrueClass \| FalseClass` | Optional | - | | `next_product_id` | `String` | Optional | Set to an empty string to cancel a delayed product change. | | `next_product_price_point_id` | `String` | Optional | - | -| `snap_day` | Integer \| [SnapDay](../../doc/models/snap-day.md) \| nil | Optional | This is a container for one-of cases. | +| `snap_day` | String \| Integer \| nil | Optional | This is a container for one-of cases. | | `initial_billing_at` | `DateTime` | Optional | (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. | | `defer_signup` | `TrueClass \| FalseClass` | Optional | (Optional) Set this attribute to true to move the subscription from Awaiting Signup, to Awaiting Signup Date. Use this when you want to update a subscription that has an unknown initial billing date. When the first billing date is known, update a subscription to set the `initial_billing_at` date. The subscription moves to the awaiting signup with a scheduled initial billing date. You can omit the initial_billing_at date to activate the subscription immediately. See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773-Subscription-States) for more information.

**Default**: `false` | | `next_billing_at` | `DateTime` | Optional | - | @@ -25,7 +25,7 @@ | `net_terms` | String \| Integer \| nil | Optional | This is a container for one-of cases. | | `stored_credential_transaction_id` | `Integer` | Optional | - | | `reference` | `String` | Optional | - | -| `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription | +| `custom_price` | [`SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | | `components` | [`Array[UpdateSubscriptionComponent]`](../../doc/models/update-subscription-component.md) | Optional | (Optional) An array of component ids and custom prices to be added to the subscription. | | `dunning_communication_delay_enabled` | `TrueClass \| FalseClass` | Optional | Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute. | | `dunning_communication_delay_time_zone` | `String` | Optional | Time zone for the Dunning Communication Delay feature. | diff --git a/doc/models/upgrade-charge-credit-type.md b/doc/models/upgrade-charge-credit-type.md new file mode 100644 index 00000000..3bc95abc --- /dev/null +++ b/doc/models/upgrade-charge-credit-type.md @@ -0,0 +1,23 @@ + +# Upgrade Charge Credit Type + +The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + +`full` - A charge is added for the full price of the component. + +`prorated` - A charge is added for the prorated price of the component change. + +`none` - No charge is added. + +## Enumeration + +`UpgradeChargeCreditType` + +## Fields + +| Name | +| --- | +| `FULL` | +| `PRORATED` | +| `NONE` | + diff --git a/lib/advanced_billing.rb b/lib/advanced_billing.rb index b9f236e2..f78f9ed2 100644 --- a/lib/advanced_billing.rb +++ b/lib/advanced_billing.rb @@ -80,6 +80,7 @@ require_relative 'advanced_billing/models/apply_payment_event_data' require_relative 'advanced_billing/models/attribute_error' require_relative 'advanced_billing/models/auto_resume' +require_relative 'advanced_billing/models/available_actions' require_relative 'advanced_billing/models/bank_account_attributes' require_relative 'advanced_billing/models/bank_account_response' require_relative 'advanced_billing/models/bank_account_verification' @@ -110,6 +111,8 @@ 'change_invoice_collection_method_event_data' require_relative 'advanced_billing/models/change_invoice_status_event_data' require_relative 'advanced_billing/models/chargify_ebb' +require_relative 'advanced_billing/models/clone_component_price_point' +require_relative 'advanced_billing/models/clone_component_price_point_request' require_relative 'advanced_billing/models/component' require_relative 'advanced_billing/models/component_allocation_change' require_relative 'advanced_billing/models/component_allocation_error_item' @@ -121,12 +124,15 @@ require_relative 'advanced_billing/models/component_price' require_relative 'advanced_billing/models/component_price_point' require_relative 'advanced_billing/models/component_price_point_assignment' +require_relative 'advanced_billing/models/' \ + 'component_price_point_currency_overage_response' require_relative 'advanced_billing/models/component_price_point_item' require_relative 'advanced_billing/models/component_price_point_response' require_relative 'advanced_billing/models/component_price_points_response' require_relative 'advanced_billing/models/component_price_point_error_item' require_relative 'advanced_billing/models/component_response' require_relative 'advanced_billing/models/consolidated_invoice' +require_relative 'advanced_billing/models/contract' require_relative 'advanced_billing/models/count_response' require_relative 'advanced_billing/models/coupon' require_relative 'advanced_billing/models/coupon_currency' @@ -208,6 +214,7 @@ require_relative 'advanced_billing/models/credit_note_application' require_relative 'advanced_billing/models/credit_note_line_item' require_relative 'advanced_billing/models/credit_scheme_request' +require_relative 'advanced_billing/models/currency_overage_prices' require_relative 'advanced_billing/models/currency_price' require_relative 'advanced_billing/models/currency_prices_response' require_relative 'advanced_billing/models/custom_field_value_change' @@ -224,6 +231,7 @@ require_relative 'advanced_billing/models/deduct_service_credit_request' require_relative 'advanced_billing/models/delayed_cancellation_response' require_relative 'advanced_billing/models/delete_subscription_group_response' +require_relative 'advanced_billing/models/deliver_proforma_invoice_request' require_relative 'advanced_billing/models/dunner_data' require_relative 'advanced_billing/models/dunning_step_data' require_relative 'advanced_billing/models/dunning_step_reached' @@ -403,6 +411,7 @@ require_relative 'advanced_billing/models/refund_prepayment_base_refund_error' require_relative 'advanced_billing/models/refund_prepayment_request' require_relative 'advanced_billing/models/refund_success' +require_relative 'advanced_billing/models/register' require_relative 'advanced_billing/models/remove_payment_event_data' require_relative 'advanced_billing/models/renewal_preview' require_relative 'advanced_billing/models/renewal_preview_component' @@ -418,10 +427,34 @@ require_relative 'advanced_billing/models/sale_rep_item_mrr' require_relative 'advanced_billing/models/sale_rep_settings' require_relative 'advanced_billing/models/sale_rep_subscription' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_component_custom_price' +require_relative 'advanced_billing/models/scheduled_renewal_configuration' +require_relative 'advanced_billing/models/scheduled_renewal_configuration_item' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_configuration_item_request' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_configuration_item_response' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_configuration_request' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_configuration_request_body' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_configuration_response' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_configurations_response' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_item_request_body_component' +require_relative 'advanced_billing/models/' \ + 'scheduled_renewal_item_request_body_product' +require_relative 'advanced_billing/models/scheduled_renewal_lock_in_request' +require_relative 'advanced_billing/models/scheduled_renewal_product_price_point' +require_relative 'advanced_billing/models/scheduled_renewal_update_request' require_relative 'advanced_billing/models/segment' require_relative 'advanced_billing/models/segment_price' require_relative 'advanced_billing/models/segment_response' require_relative 'advanced_billing/models/send_invoice_request' +require_relative 'advanced_billing/models/send_email' require_relative 'advanced_billing/models/service_credit' require_relative 'advanced_billing/models/service_credit_response' require_relative 'advanced_billing/models/service_credit1' @@ -561,6 +594,7 @@ require_relative 'advanced_billing/models/debit_note_status' require_relative 'advanced_billing/models/direction' require_relative 'advanced_billing/models/discount_type' +require_relative 'advanced_billing/models/downgrade_credit_credit_type' require_relative 'advanced_billing/models/event_key' require_relative 'advanced_billing/models/expiration_interval_unit' require_relative 'advanced_billing/models/failed_payment_action' @@ -608,8 +642,8 @@ require_relative 'advanced_billing/models/restriction_type' require_relative 'advanced_billing/models/resumption_charge' require_relative 'advanced_billing/models/service_credit_type' -require_relative 'advanced_billing/models/snap_day' require_relative 'advanced_billing/models/sorting_direction' +require_relative 'advanced_billing/models/status' require_relative 'advanced_billing/models/subscription_date_field' require_relative 'advanced_billing/models/subscription_group_include' require_relative 'advanced_billing/models/subscription_group_prepayment_method' @@ -624,6 +658,7 @@ require_relative 'advanced_billing/models/tax_configuration_kind' require_relative 'advanced_billing/models/tax_destination_address' require_relative 'advanced_billing/models/trial_type' +require_relative 'advanced_billing/models/upgrade_charge_credit_type' require_relative 'advanced_billing/models/webhook_order' require_relative 'advanced_billing/models/webhook_status' require_relative 'advanced_billing/models/webhook_subscription' @@ -714,5 +749,6 @@ 'subscription_invoice_account_controller' require_relative 'advanced_billing/controllers/subscription_notes_controller' require_relative 'advanced_billing/controllers/subscription_products_controller' +require_relative 'advanced_billing/controllers/subscription_renewals_controller' require_relative 'advanced_billing/controllers/subscription_status_controller' require_relative 'advanced_billing/controllers/webhooks_controller' diff --git a/lib/advanced_billing/client.rb b/lib/advanced_billing/client.rb index ad03241f..e9461c4e 100644 --- a/lib/advanced_billing/client.rb +++ b/lib/advanced_billing/client.rb @@ -193,6 +193,12 @@ def subscription_products @subscription_products ||= SubscriptionProductsController.new @global_configuration end + # Access to subscription_renewals controller. + # @return [SubscriptionRenewalsController] Returns the controller instance. + def subscription_renewals + @subscription_renewals ||= SubscriptionRenewalsController.new @global_configuration + end + # Access to subscription_status controller. # @return [SubscriptionStatusController] Returns the controller instance. def subscription_status diff --git a/lib/advanced_billing/controllers/advance_invoice_controller.rb b/lib/advanced_billing/controllers/advance_invoice_controller.rb index 61d13458..dfa60cb5 100644 --- a/lib/advanced_billing/controllers/advance_invoice_controller.rb +++ b/lib/advanced_billing/controllers/advance_invoice_controller.rb @@ -24,7 +24,7 @@ class AdvanceInvoiceController < BaseController # invoices to preview this advance invoice before using this endpoint to # generate it. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [IssueAdvanceInvoiceRequest] body Optional parameter: TODO: type # description here # @return [Invoice] Response from the API call. @@ -59,7 +59,7 @@ def issue_advance_invoice(subscription_id, # renewal, it can be viewed through this endpoint. There can only be one # advance invoice per subscription per billing cycle. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [Invoice] Response from the API call. def read_advance_invoice(subscription_id) @api_call @@ -87,7 +87,7 @@ def read_advance_invoice(subscription_id) # to the invoice to be returned to the subscription. For a full overview of # the impact of voiding, [see our help docs]($m/Invoice). # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [VoidInvoiceRequest] body Optional parameter: TODO: type # description here # @return [Invoice] Response from the API call. diff --git a/lib/advanced_billing/controllers/base_controller.rb b/lib/advanced_billing/controllers/base_controller.rb index 4bb16cc1..002a87d3 100644 --- a/lib/advanced_billing/controllers/base_controller.rb +++ b/lib/advanced_billing/controllers/base_controller.rb @@ -10,7 +10,7 @@ class BaseController attr_accessor :config, :http_call_back def self.user_agent - 'AB SDK Ruby:8.0.0 on OS {os-info}' + 'AB SDK Ruby:9.0.0 on OS {os-info}' end def self.user_agent_parameters diff --git a/lib/advanced_billing/controllers/component_price_points_controller.rb b/lib/advanced_billing/controllers/component_price_points_controller.rb index 4b000829..8d5aa967 100644 --- a/lib/advanced_billing/controllers/component_price_points_controller.rb +++ b/lib/advanced_billing/controllers/component_price_points_controller.rb @@ -151,6 +151,66 @@ def bulk_create_component_price_points(component_id, .execute end + # Clones a component price point. Custom price points (tied to a specific + # subscription) cannot be cloned. The following attributes are copied from + # the source price point: + # - Pricing scheme + # - All price tiers (with starting/ending quantities and unit prices) + # - Tax included setting + # - Currency prices (if definitive pricing is set) + # - Overage pricing (for prepaid usage components) + # - Interval settings (if multi-frequency is enabled) + # - Event-based billing segments (if applicable) + # @param [Integer | String] component_id Required parameter: The id or + # handle of the component. 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. + # @param [Integer | String] price_point_id 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-price_point-handle` for a string handle. + # @param [CloneComponentPricePointRequest] body Optional parameter: TODO: + # type description here + # @return [ComponentPricePointCurrencyOverageResponse] Response from the API call. + def clone_component_price_point(component_id, + price_point_id, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::POST, + '/components/{component_id}/price_points/{price_point_id}/clone.json', + Server::PRODUCTION) + .template_param(new_parameter(component_id, key: 'component_id') + .is_required(true) + .should_encode(true) + .validator(proc do |value| + UnionTypeLookUp.get(:CloneComponentPricePointComponentId) + .validate(value) + end)) + .template_param(new_parameter(price_point_id, key: 'price_point_id') + .is_required(true) + .should_encode(true) + .validator(proc do |value| + UnionTypeLookUp.get(:CloneComponentPricePointPricePointId) + .validate(value) + end)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ComponentPricePointCurrencyOverageResponse.method(:from_hash)) + .local_error_template('404', + 'Not Found:\'{$response.body}\'', + APIException) + .local_error_template('422', + 'HTTP Response Not OK. Status code: {$statusCode}.'\ + ' Response: \'{$response.body}\'.', + ErrorListResponseException)) + .execute + end + # 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 @@ -219,7 +279,7 @@ def update_component_price_point(component_id, # `handle:example-price_point-handle` for a string handle. # @param [TrueClass | FalseClass] currency_prices Optional parameter: # Include an array of currency price data - # @return [ComponentPricePointResponse] Response from the API call. + # @return [ComponentPricePointCurrencyOverageResponse] Response from the API call. def read_component_price_point(component_id, price_point_id, currency_prices: nil) @@ -246,7 +306,7 @@ def read_component_price_point(component_id, .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) - .deserialize_into(ComponentPricePointResponse.method(:from_hash))) + .deserialize_into(ComponentPricePointCurrencyOverageResponse.method(:from_hash))) .execute end diff --git a/lib/advanced_billing/controllers/events_controller.rb b/lib/advanced_billing/controllers/events_controller.rb index de1b5ef3..d9eac70d 100644 --- a/lib/advanced_billing/controllers/events_controller.rb +++ b/lib/advanced_billing/controllers/events_controller.rb @@ -153,7 +153,7 @@ def list_events(options = {}) # For precise mappings from key to event_specific_data, refer to # [Event]($m/Event). # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] page Optional parameter: 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 diff --git a/lib/advanced_billing/controllers/invoices_controller.rb b/lib/advanced_billing/controllers/invoices_controller.rb index 04bf13eb..8eade0d0 100644 --- a/lib/advanced_billing/controllers/invoices_controller.rb +++ b/lib/advanced_billing/controllers/invoices_controller.rb @@ -424,7 +424,7 @@ def read_credit_note(uid) # Only ungrouped or primary subscriptions may be paid using the "bulk" # payment request. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [RecordPaymentRequest] body Optional parameter: TODO: type # description here # @return [RecordPaymentResponse] Response from the API call. @@ -771,7 +771,7 @@ def list_consolidated_invoice_segments(options = {}) # By default, invoices will be created with open status. Possible # alternative is `draft`. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [CreateInvoiceRequest] body Optional parameter: TODO: type # description here # @return [InvoiceResponse] Response from the API call. @@ -804,6 +804,10 @@ def create_invoice(subscription_id, # automatically generated invoices. Additionally, this endpoint supports # email delivery to direct recipients, carbon-copy (cc) recipients, and # blind carbon-copy (bcc) recipients. + # **File Attachments**: You can attach files to invoice emails using + # `attachment_urls[]` parameter by providing URLs to the files you want to + # attach. When using attachments, the request must use `multipart/form-data` + # content type. Max 10 files, 10MB per file. # 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 @@ -904,9 +908,10 @@ def update_customer_information(uid) .execute end - # This endpoint allows you to issue an invoice that is in "pending" status. - # For example, you can issue an invoice that was created when allocating new - # quantity on a component and using "accrue charges" option. + # This endpoint allows you to issue an invoice that is in "pending" or + # "draft" status. For example, you can issue an invoice that was created + # when allocating new quantity on a component and using "accrue charges" + # option. # You cannot issue a pending child invoice that was created for a member # subscription in a group. # For Remittance subscriptions, the invoice will go into "open" status and diff --git a/lib/advanced_billing/controllers/payment_profiles_controller.rb b/lib/advanced_billing/controllers/payment_profiles_controller.rb index 06e50450..2186c519 100644 --- a/lib/advanced_billing/controllers/payment_profiles_controller.rb +++ b/lib/advanced_billing/controllers/payment_profiles_controller.rb @@ -367,8 +367,7 @@ def delete_unused_payment_profile(payment_profile_id) .execute end - # This will delete a payment profile belonging to the customer on the - # subscription. + # Deletes a payment profile belonging to the customer on the subscription. # + If the customer has multiple subscriptions, the payment profile will be # removed from all of them. # + If you delete the default payment profile for a subscription, you will @@ -378,7 +377,7 @@ def delete_unused_payment_profile(payment_profile_id) # the Admin UI and use the “Add New Credit Card” or “Make Active Payment # Method” link, (depending on whether there are other cards present). # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] payment_profile_id Required parameter: The Chargify id of # the payment profile # @return [void] Response from the API call. @@ -434,7 +433,7 @@ def verify_bank_account(bank_account_id, .execute end - # This will delete a Payment Profile belonging to a Subscription Group. + # Deletes a Payment Profile belonging to a Subscription Group. # **Note**: If the Payment Profile belongs to multiple Subscription Groups # and/or Subscriptions, it will be removed from all of them. # @param [String] uid Required parameter: The uid of the subscription @@ -465,7 +464,7 @@ def delete_subscription_group_payment_profile(uid, # You must elect to change the existing payment profile to a new payment # profile ID in order to receive a satisfactory response from this endpoint. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] payment_profile_id Required parameter: The Chargify id of # the payment profile # @return [PaymentProfileResponse] Response from the API call. @@ -577,7 +576,7 @@ def read_one_time_token(chargify_token) # requests, and to provide clear and helpful information to users who # encounter errors during the request process. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [void] Response from the API call. def send_request_update_payment_email(subscription_id) @api_call diff --git a/lib/advanced_billing/controllers/proforma_invoices_controller.rb b/lib/advanced_billing/controllers/proforma_invoices_controller.rb index 79a82e98..59062ad2 100644 --- a/lib/advanced_billing/controllers/proforma_invoices_controller.rb +++ b/lib/advanced_billing/controllers/proforma_invoices_controller.rb @@ -119,7 +119,7 @@ def read_proforma_invoice(proforma_invoice_uid) # create a proforma invoice, the subscription must not be in a group, must # not be prepaid, and must be in a live state. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [ProformaInvoice] Response from the API call. def create_proforma_invoice(subscription_id) @api_call @@ -146,7 +146,7 @@ def create_proforma_invoice(subscription_id) # `credits`, `payments`, or `custom_fields`. To include breakdowns, pass the # specific field as a key in the query with a value set to `true`. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [String] start_date Optional parameter: The beginning date range # for the invoice's Due Date, in the YYYY-MM-DD format. # @param [String] end_date Optional parameter: The ending date range for the @@ -208,6 +208,47 @@ def list_proforma_invoices(options = {}) .execute end + # Allows for proforma invoices to be programmatically delivered via email. + # Supports email + # delivery to direct recipients, carbon-copy (cc) recipients, and blind + # carbon-copy (bcc) recipients. + # If `recipient_emails` is omitted, the system will fall back to the primary + # recipient derived from the invoice or + # subscription. At least one recipient must be present, either via the + # request body or via this default behavior, so an + # empty body may still succeed when defaults are available. + # @param [String] proforma_invoice_uid Required parameter: The uid of the + # proforma invoice + # @param [DeliverProformaInvoiceRequest] body Optional parameter: TODO: type + # description here + # @return [ProformaInvoice] Response from the API call. + def deliver_proforma_invoice(proforma_invoice_uid, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::POST, + '/proforma_invoices/{proforma_invoice_uid}/deliveries.json', + Server::PRODUCTION) + .template_param(new_parameter(proforma_invoice_uid, key: 'proforma_invoice_uid') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ProformaInvoice.method(:from_hash)) + .local_error_template('404', + 'Not Found:\'{$response.body}\'', + APIException) + .local_error_template('422', + 'HTTP Response Not OK. Status code: {$statusCode}.'\ + ' Response: \'{$response.body}\'.', + ErrorListResponseException)) + .execute + end + # This endpoint will void a proforma invoice that has the status "draft". # ## Restrictions # Proforma invoices are only available on Relationship Invoicing sites. @@ -267,7 +308,7 @@ def void_proforma_invoice(proforma_invoice_uid, # preview call to determine whether any billing information for the # subscription's upcoming renewal has changed. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [ProformaInvoice] Response from the API call. def preview_proforma_invoice(subscription_id) @api_call diff --git a/lib/advanced_billing/controllers/subscription_components_controller.rb b/lib/advanced_billing/controllers/subscription_components_controller.rb index 82905a8e..2163bd35 100644 --- a/lib/advanced_billing/controllers/subscription_components_controller.rb +++ b/lib/advanced_billing/controllers/subscription_components_controller.rb @@ -9,7 +9,7 @@ class SubscriptionComponentsController < BaseController # This request will list information regarding a specific component owned by # a subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] component_id Required parameter: The Advanced Billing id # of the component. Alternatively, the component's handle prefixed by # `handle:` @@ -43,7 +43,7 @@ def read_subscription_component(subscription_id, # subscription contains **archived** components they will be listed in the # server response. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [SubscriptionListDateField] date_field Optional parameter: The type # of filter you'd like to apply to your search. Use in query # `date_field=updated_at`. @@ -122,7 +122,7 @@ def list_subscription_components(options = {}) # 3. `"_default"` string, which will reset the price point to the # component's current default price point. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [BulkComponentsPricePointAssignment] body Optional parameter: TODO: # type description here # @return [BulkComponentsPricePointAssignment] Response from the API call. @@ -154,7 +154,7 @@ def bulk_update_subscription_components_price_points(subscription_id, # **Note**: this will update the price point for all of the subscription's # components, even ones that have not been allocated yet. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [SubscriptionResponse] Response from the API call. def bulk_reset_subscription_components_price_points(subscription_id) @api_call @@ -172,55 +172,18 @@ def bulk_reset_subscription_components_price_points(subscription_id) .execute end - # This endpoint creates a new allocation, setting the current allocated - # quantity for the Component and recording a memo. - # **Notice**: Allocations can only be updated for Quantity, On/Off, and - # Prepaid Components. - # ## Allocations Documentation - # Full documentation on how to record Allocations in the Advanced Billing UI - # can be located - # [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Componen - # t-Allocations-Overview). It is focused on how allocations operate within - # the Advanced Billing UI.It goes into greater detail on how the user - # interface will react when recording allocations. - # This documentation also goes into greater detail on how proration is taken - # into consideration when applying component allocations. - # ## Proration Schemes - # Changing the allocated quantity of a component mid-period can result in - # either a Charge or Credit being applied to the subscription. When creating - # an allocation via the API, you can pass the `upgrade_charge`, - # `downgrade_credit`, and `accrue_charge` to be applied. - # **Notice:** These proration and accural fields will be ignored for Prepaid + # Creates an allocation, sets the current allocated quantity for the + # component, and records a memo. Allocations can only be updated for + # Quantity, On/Off, and Prepaid Components. + # When creating an allocation via the API, you can pass the + # `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. + # > **Note:** These proration and accural fields are ignored for Prepaid # Components since this component type always generate charges immediately # without proration. - # For background information on prorated components and upgrade/downgrade - # schemes, see [Setting Component + # For information on prorated components and upgrade/downgrade schemes, see + # [Setting Component # Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-C - # omponent-Allocations-Proration). - # See the tables below for valid values. - # | upgrade_charge | Definition - #            | - # |----------------|-------------------------------------------------------- - # -----------| - # | `full`         | A charge is added for the full price of the component. - #            | - # | `prorated`     | A charge is added for the prorated price of the - # component change. | - # | `none`         | No charge is added. - #           | - # | downgrade_credit | Definition                                        | - # |------------------|---------------------------------------------------| - # | `full`           | A full price credit is added for the amount owed. | - # | `prorated`       | A prorated credit is added for the amount owed.   | - # | `none`           | No charge is added.                               | - # | accrue_charge | Definition - #                                                 | - # |---------------|--------------------------------------------------------- - # ---------------------------------------------------| - # | `true`        | Attempt to charge the customer at next renewal. - # | - # | `false`       | Attempt to charge the customer right away. If it fails, - # the charge will be accrued until the next renewal. | + # omponent-Allocations-Proration) # ### Order of Resolution for upgrade_charge and downgrade_credit # 1. Per allocation in API call (within a single allocation of the # `allocations` array) @@ -236,11 +199,14 @@ def bulk_reset_subscription_components_price_points(subscription_id) # 2. [Site-level default # value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Componen # t-Allocations-Proration#proration-schemes) - # **NOTE: Proration uses the current price of the component as well as the - # current tax rates. Changes to either may cause the prorated charge/credit - # to be wrong.** + # > **Note:** Proration uses the current price of the component as well as + # the current tax rates. Changes to either may cause the prorated + # charge/credit to be wrong. + # For more informaiton see the [Component + # Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Co + # mponent-Allocations-Overview) product Documentation. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] component_id Required parameter: The Advanced Billing id # of the component # @param [CreateAllocationRequest] body Optional parameter: TODO: type @@ -279,21 +245,8 @@ def allocate_component(subscription_id, # ## On/Off Components # When a subscription's on/off component has been toggled to on (`1`) or off # (`0`), usage will be logged in this response. - # ## Querying data via Advanced Billing gem - # You can also query the current quantity via the [official Advanced Billing - # Gem.](http://github.com/chargify/chargify_api_ares) - # ```# First way - # component = Chargify::Subscription::Component.find(1, :params => - # {:subscription_id => 7}) - # puts component.allocated_quantity - # # => 23 - # # Second way - # component = Chargify::Subscription.find(7).component(1) - # puts component.allocated_quantity - # # => 23 - # ``` # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] component_id Required parameter: The Advanced Billing id # of the component # @param [Integer] page Optional parameter: Result records are organized in @@ -334,15 +287,35 @@ def list_allocations(subscription_id, .execute end - # Creates multiple allocations, setting the current allocated quantity for - # each of the components and recording a memo. The charges and/or credits - # that are created will be rolled up into a single total which is used to - # determine whether this is an upgrade or a downgrade. Be aware of the Order - # of Resolutions explained below in determining the proration scheme. - # A `component_id` is required for each allocation. - # This endpoint only responds to JSON. It is not available for XML. + # Creates multiple allocations, sets the current allocated quantity for each + # of the components, and recording a memo. A `component_id` is required + # for each allocation. + # The charges and/or credits that are created will be rolled up into a + # single total which is used to determine whether this is an upgrade or a + # downgrade. + # ### Order of Resolution for upgrade_charge and downgrade_credit + # 1. Per allocation in API call (within a single allocation of the + # `allocations` array) + # 2. [Component-level default + # value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Componen + # t-Allocations-Overview) + # 3. Allocation API call top level (outside of the `allocations` array) + # 4. [Site-level default + # value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Componen + # t-Allocations-Proration#proration-schemes) + # ### Order of Resolution for accrue charge + # 1. Allocation API call top level (outside of the `allocations` array) + # 2. [Site-level default + # value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Componen + # t-Allocations-Proration#proration-schemes) + # > **Note:** Proration uses the current price of the component as well as + # the current tax rates. Changes to either may cause the prorated + # charge/credit to be wrong. + # For more informaiton see the [Component + # Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Co + # mponent-Allocations-Overview) product Documentation. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [AllocateComponents] body Optional parameter: TODO: type # description here # @return [Array[AllocationResponse]] Response from the API call. @@ -387,7 +360,7 @@ def allocate_components(subscription_id, # at the `line_items` and `allocations` level respectfully. # See example below for Fine-Grained Component Control response. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [PreviewAllocationsRequest] body Optional parameter: TODO: type # description here # @return [AllocationPreviewResponse] Response from the API call. @@ -430,7 +403,7 @@ def preview_allocations(subscription_id, # - An expiration date can be changed towards the past (essentially expiring # it) up to the subscription's current period beginning date. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] component_id Required parameter: The Advanced Billing id # of the component # @param [Integer] allocation_id Required parameter: The Advanced Billing id @@ -487,7 +460,7 @@ def update_prepaid_usage_allocation_expiration_date(subscription_id, # 3. `refund`: The allocation will be destroyed and the balances will be # updated and a refund will be issued along with a Credit Note. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] component_id Required parameter: The Advanced Billing id # of the component # @param [Integer] allocation_id Required parameter: The Advanced Billing id diff --git a/lib/advanced_billing/controllers/subscription_groups_controller.rb b/lib/advanced_billing/controllers/subscription_groups_controller.rb index 0533c3d2..74ae982e 100644 --- a/lib/advanced_billing/controllers/subscription_groups_controller.rb +++ b/lib/advanced_billing/controllers/subscription_groups_controller.rb @@ -173,8 +173,8 @@ def update_subscription_group_members(uid, .execute end - # Use this endpoint to delete subscription group. - # Only groups without members can be deleted + # Deletes a subscription group. + # Only groups without members can be deleted. # @param [String] uid Required parameter: The uid of the subscription # group # @return [DeleteSubscriptionGroupResponse] Response from the API call. @@ -251,7 +251,7 @@ def find_subscription_group(subscription_id) # Group](https://developers.chargify.com/docs/api-docs/d571659cf0f24-create- # subscription#subscription-in-a-subscription-group) # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [AddSubscriptionToAGroup] body Optional parameter: TODO: type # description here # @return [SubscriptionGroupResponse] Response from the API call. @@ -282,7 +282,7 @@ def add_subscription_to_group(subscription_id, # omer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to # remove existing subscription from subscription group. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [void] Response from the API call. def remove_subscription_from_group(subscription_id) @api_call diff --git a/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb b/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb index aff8c4c3..d078bd5d 100644 --- a/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +++ b/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb @@ -10,7 +10,7 @@ class SubscriptionInvoiceAccountController < BaseController # Service Credit, and Prepayment accounts, as well as the sum of the # Subscription's open, payable invoices. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [AccountBalances] Response from the API call. def read_account_balances(subscription_id) @api_call @@ -37,7 +37,7 @@ def read_account_balances(subscription_id) # manual replenishment of prepaid subscriptions. # Note that passing `amount_in_cents` is now allowed. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [CreatePrepaymentRequest] body Optional parameter: TODO: type # description here # @return [CreatePrepaymentResponse] Response from the API call. @@ -67,7 +67,7 @@ def create_prepayment(subscription_id, # This request will list a subscription's prepayments. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] page Optional parameter: 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 @@ -109,7 +109,7 @@ def list_prepayments(options = {}) # request body. The credit is subsequently applied to the next generated # invoice. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [IssueServiceCreditRequest] body Optional parameter: TODO: type # description here # @return [ServiceCredit] Response from the API call. @@ -141,7 +141,7 @@ def issue_service_credit(subscription_id, # the request body. The credit amount being deducted must be equal to or # less than the current credit balance. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [DeductServiceCreditRequest] body Optional parameter: TODO: type # description here # @return [void] Response from the API call. @@ -169,7 +169,7 @@ def deduct_service_credit(subscription_id, # This request will list a subscription's service credits. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] page Optional parameter: 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 @@ -220,7 +220,7 @@ def list_service_credits(subscription_id, # The amount may be passed either as a decimal, with `amount`, or an integer # in cents, with `amount_in_cents`. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] prepayment_id Required parameter: id of prepayment # @param [RefundPrepaymentRequest] body Optional parameter: TODO: type # description here diff --git a/lib/advanced_billing/controllers/subscription_notes_controller.rb b/lib/advanced_billing/controllers/subscription_notes_controller.rb index a1d49d96..b5d4892c 100644 --- a/lib/advanced_billing/controllers/subscription_notes_controller.rb +++ b/lib/advanced_billing/controllers/subscription_notes_controller.rb @@ -17,7 +17,7 @@ class SubscriptionNotesController < BaseController # [here](https://maxio.zendesk.com/hc/en-us/articles/24251712214413-Subscrip # tion-Summary-Overview). # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [UpdateSubscriptionNoteRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionNoteResponse] Response from the API call. @@ -48,7 +48,7 @@ def create_subscription_note(subscription_id, # Use this method to retrieve a list of Notes associated with a # Subscription. The response will be an array of Notes. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] page Optional parameter: 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 @@ -87,7 +87,7 @@ def list_subscription_notes(options = {}) # Once you have obtained the ID of the note you wish to read, use this # method to show a particular note attached to a subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] note_id Required parameter: The Advanced Billing id of # the note # @return [SubscriptionNoteResponse] Response from the API call. @@ -113,7 +113,7 @@ def read_subscription_note(subscription_id, # Use the following method to update a note for a Subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] note_id Required parameter: The Advanced Billing id of # the note # @param [UpdateSubscriptionNoteRequest] body Optional parameter: TODO: type @@ -147,9 +147,9 @@ def update_subscription_note(subscription_id, .execute end - # Use the following method to delete a note for a Subscription. + # Deletes a note for a Subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] note_id Required parameter: The Advanced Billing id of # the note # @return [void] Response from the API call. diff --git a/lib/advanced_billing/controllers/subscription_products_controller.rb b/lib/advanced_billing/controllers/subscription_products_controller.rb index 934e540e..8dbeb29b 100644 --- a/lib/advanced_billing/controllers/subscription_products_controller.rb +++ b/lib/advanced_billing/controllers/subscription_products_controller.rb @@ -99,7 +99,7 @@ class SubscriptionProductsController < BaseController # 8. Optionally, you can use the applied "msg" param in the `redirect_url` # to determine whether it was successful or not. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [SubscriptionProductMigrationRequest] body Optional parameter: # TODO: type description here # @return [SubscriptionResponse] Response from the API call. @@ -136,7 +136,7 @@ def migrate_subscription_product(subscription_id, # applied values assuming the migration is done at that date in the future # as opposed to right now. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [SubscriptionMigrationPreviewRequest] body Optional parameter: # TODO: type description here # @return [SubscriptionMigrationPreviewResponse] Response from the API call. diff --git a/lib/advanced_billing/controllers/subscription_renewals_controller.rb b/lib/advanced_billing/controllers/subscription_renewals_controller.rb new file mode 100644 index 00000000..8871b743 --- /dev/null +++ b/lib/advanced_billing/controllers/subscription_renewals_controller.rb @@ -0,0 +1,351 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # SubscriptionRenewalsController + class SubscriptionRenewalsController < BaseController + # Creates a scheduled renewal configuration for a subscription. The + # scheduled renewal is based on the subscription’s current product and + # component setup. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [ScheduledRenewalConfigurationRequest] body Optional parameter: + # TODO: type description here + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def create_scheduled_renewal_configuration(subscription_id, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::POST, + '/subscriptions/{subscription_id}/scheduled_renewals.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Lists scheduled renewal configurations for the subscription and permits an + # optional status query filter. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Status] status Optional parameter: (Optional) Status filter for + # scheduled renewal configurations. + # @return [ScheduledRenewalConfigurationsResponse] Response from the API call. + def list_scheduled_renewal_configurations(subscription_id, + status: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::GET, + '/subscriptions/{subscription_id}/scheduled_renewals.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .query_param(new_parameter(status, key: 'status')) + .header_param(new_parameter('application/json', key: 'accept')) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationsResponse.method(:from_hash))) + .execute + end + + # Retrieves the configuration settings for the scheduled renewal. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] id Required parameter: The renewal id. + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def read_scheduled_renewal_configuration(subscription_id, + id) + @api_call + .request(new_request_builder(HttpMethodEnum::GET, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'accept')) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash))) + .execute + end + + # Updates an existing configuration. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] id Required parameter: The renewal id. + # @param [ScheduledRenewalConfigurationRequest] body Optional parameter: + # TODO: type description here + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def update_scheduled_renewal_configuration(subscription_id, + id, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Schedules a future lock-in date for the renewal. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] id Required parameter: The renewal id. + # @param [ScheduledRenewalLockInRequest] body Optional parameter: TODO: type + # description here + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def schedule_scheduled_renewal_lock_in(subscription_id, + id, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/schedule_lock_in.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Locks in the renewal immediately. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] id Required parameter: The renewal id. + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def lock_in_scheduled_renewal_immediately(subscription_id, + id) + @api_call + .request(new_request_builder(HttpMethodEnum::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/immediate_lock_in.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'accept')) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Returns a scheduled renewal configuration to an editable state. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] id Required parameter: The renewal id. + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def unpublish_scheduled_renewal_configuration(subscription_id, + id) + @api_call + .request(new_request_builder(HttpMethodEnum::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/unpublish.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'accept')) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Cancels a scheduled renewal configuration. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] id Required parameter: The renewal id. + # @return [ScheduledRenewalConfigurationResponse] Response from the API call. + def cancel_scheduled_renewal_configuration(subscription_id, + id) + @api_call + .request(new_request_builder(HttpMethodEnum::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/cancel.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'accept')) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Adds product and component line items to the scheduled renewal. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] scheduled_renewals_configuration_id Required parameter: + # The scheduled renewal configuration id. + # @param [ScheduledRenewalConfigurationItemRequest] body Optional parameter: + # TODO: type description here + # @return [ScheduledRenewalConfigurationItemResponse] Response from the API call. + def create_scheduled_renewal_configuration_item(subscription_id, + scheduled_renewals_configuration_id, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::POST, + '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configuration_id}/configuration_items.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(scheduled_renewals_configuration_id, key: 'scheduled_renewals_configuration_id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationItemResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Updates an existing configuration item’s pricing and quantity. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] scheduled_renewals_configuration_id Required parameter: + # The scheduled renewal configuration id. + # @param [Integer] id Required parameter: The scheduled renewal + # configuration item id. + # @param [ScheduledRenewalUpdateRequest] body Optional parameter: TODO: type + # description here + # @return [ScheduledRenewalConfigurationItemResponse] Response from the API call. + def update_scheduled_renewal_configuration_item(subscription_id, + scheduled_renewals_configuration_id, + id, + body: nil) + @api_call + .request(new_request_builder(HttpMethodEnum::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configuration_id}/configuration_items/{id}.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(scheduled_renewals_configuration_id, key: 'scheduled_renewals_configuration_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .header_param(new_parameter('application/json', key: 'Content-Type')) + .body_param(new_parameter(body)) + .header_param(new_parameter('application/json', key: 'accept')) + .body_serializer(proc do |param| param.to_json unless param.nil? end) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .deserializer(APIHelper.method(:custom_type_deserializer)) + .deserialize_into(ScheduledRenewalConfigurationItemResponse.method(:from_hash)) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + + # Removes an item from the pending renewal configuration. + # @param [Integer] subscription_id Required parameter: The Chargify id of + # the subscription. + # @param [Integer] scheduled_renewals_configuration_id Required parameter: + # The scheduled renewal configuration id. + # @param [Integer] id Required parameter: The scheduled renewal + # configuration item id. + # @return [void] Response from the API call. + def delete_scheduled_renewal_configuration_item(subscription_id, + scheduled_renewals_configuration_id, + id) + @api_call + .request(new_request_builder(HttpMethodEnum::DELETE, + '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configuration_id}/configuration_items/{id}.json', + Server::PRODUCTION) + .template_param(new_parameter(subscription_id, key: 'subscription_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(scheduled_renewals_configuration_id, key: 'scheduled_renewals_configuration_id') + .is_required(true) + .should_encode(true)) + .template_param(new_parameter(id, key: 'id') + .is_required(true) + .should_encode(true)) + .auth(Single.new('BasicAuth'))) + .response(new_response_handler + .is_response_void(true) + .local_error('422', + 'Unprocessable Entity (WebDAV)', + ErrorListResponseException)) + .execute + end + end +end diff --git a/lib/advanced_billing/controllers/subscription_status_controller.rb b/lib/advanced_billing/controllers/subscription_status_controller.rb index d14948c2..3da7957a 100644 --- a/lib/advanced_billing/controllers/subscription_status_controller.rb +++ b/lib/advanced_billing/controllers/subscription_status_controller.rb @@ -13,7 +13,7 @@ class SubscriptionStatusController < BaseController # ## Failed Reactivation # The response will be `422 "Unprocessable Entity`. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [SubscriptionResponse] Response from the API call. def retry_subscription(subscription_id) @api_call @@ -35,10 +35,13 @@ def retry_subscription(subscription_id) .execute end - # The DELETE action causes the cancellation of the Subscription. This means, - # the method sets the Subscription state to "canceled". + # Cancels the Subscription. The Delete method sets the Subscription state to + # `canceled`. + # To cancel the subscription immediately, omit any schedule parameters from + # the request. To use the schedule options, the Schedule Subscription + # Cancellation feature must be enabled on your site. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [CancellationRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionResponse] Response from the API call. @@ -74,10 +77,10 @@ def cancel_subscription(subscription_id, # that date. Otherwise, it will behave like a reactivation, setting the # billing date to 'now' and charging the subscriber. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [ResumptionCharge] calendar_billing_resumption_charge Optional # parameter: (For calendar billing subscriptions only) The way that the - # resumed subscription's charge should be handled + # resumed subscription's charge should be handled. # @return [SubscriptionResponse] Response from the API call. def resume_subscription(subscription_id, calendar_billing_resumption_charge: ResumptionCharge::PRORATED) @@ -107,7 +110,7 @@ def resume_subscription(subscription_id, # You may not place a subscription on hold if the `next_billing_at` date is # within 24 hours. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [PauseRequest] body Optional parameter: TODO: type description # here # @return [SubscriptionResponse] Response from the API call. @@ -143,7 +146,7 @@ def pause_subscription(subscription_id, # Alternately, you can change the `automatically_resume_at` to `null` if you # would like the subscription to not have a resume date. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [PauseRequest] body Optional parameter: TODO: type description # here # @return [SubscriptionResponse] Response from the API call. @@ -171,9 +174,9 @@ def update_automatic_subscription_resumption(subscription_id, .execute end - # 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 + # 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). # **Note: The term "resume" is used also during another process in Advanced @@ -202,6 +205,10 @@ def update_automatic_subscription_resumption(subscription_id, # have been the next billing date of July 1st, then Advanced Billing would # not resume the subscription, and instead it would be reactivated with a # new billing period. + # If a reactivation with `resume: false`, or where 'resume" is omited were + # attempted, then Advanced Billing would reactivate the subscription with a + # new billing period regardless of whether or not resuming the previous + # billing period were possible. # | Canceled | Reactivation | Resumable? | # |---|---|---| # | Jun 15 | June 28 | Yes | @@ -309,7 +316,7 @@ def update_automatic_subscription_resumption(subscription_id, # + The next billing date should not have changed # + Any product-related charges should have been collected # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [ReactivateSubscriptionRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionResponse] Response from the API call. @@ -337,14 +344,12 @@ def reactivate_subscription(subscription_id, .execute end - # Advanced Billing offers the ability to cancel a subscription at the end of - # the current billing period. This period is set by its current product. - # Requesting to cancel the subscription at the end of the period sets the - # `cancel_at_end_of_period` flag to true. - # Note that you cannot set `cancel_at_end_of_period` at subscription - # creation, or if the subscription is past due. + # Cancels a subscription at the end of the current billing period based on + # the subscription's current product. You cannot set + # `cancel_at_end_of_period` at subscription creation, or if the subscription + # is past due. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [CancellationRequest] body Optional parameter: TODO: type # description here # @return [DelayedCancellationResponse] Response from the API call. @@ -382,7 +387,7 @@ def initiate_delayed_cancellation(subscription_id, # the future, removing the delayed cancellation has no effect and the call # will be successful. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [DelayedCancellationResponse] Response from the API call. def cancel_delayed_cancellation(subscription_id) @api_call @@ -406,7 +411,7 @@ def cancel_delayed_cancellation(subscription_id) # If a subscription is currently in dunning, the subscription will be set to # active and the active Dunner will be resolved. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @return [SubscriptionResponse] Response from the API call. def cancel_dunning(subscription_id) @api_call @@ -458,10 +463,10 @@ def cancel_dunning(subscription_id) # key. See the request body documentation below. # ## Subscription Side Effects # You can request a `POST` to obtain this data from the endpoint without any - # side effects. Plain and simple, this will preview data, not log any + # side effects. This method allows you to preview data, but does not log any # changes against a subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [RenewalPreviewRequest] body Optional parameter: TODO: type # description here # @return [RenewalPreviewResponse] Response from the API call. diff --git a/lib/advanced_billing/controllers/subscriptions_controller.rb b/lib/advanced_billing/controllers/subscriptions_controller.rb index f01c40fd..c966c6f1 100644 --- a/lib/advanced_billing/controllers/subscriptions_controller.rb +++ b/lib/advanced_billing/controllers/subscriptions_controller.rb @@ -60,9 +60,9 @@ def create_subscription(body: nil) .execute end - # This method will return an array of subscriptions from a Site. Pay close - # attention to query string filters and pagination in order to control - # responses from the server. + # returns an array of subscriptions from a Site. Pay close attention to + # query string filters and pagination in order to control responses from the + # server. # ## Search for a subscription # Use the query strings below to search for a subscription using the # criteria available. The return value will be an array. @@ -232,7 +232,7 @@ def list_subscriptions(options = {}) # 'null on the next billing cycle. This is because a product change is # instantanous and only affects the product associated with a subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [UpdateSubscriptionRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionResponse] Response from the API call. @@ -260,13 +260,13 @@ def update_subscription(subscription_id, .execute end - # Use this endpoint to find subscription details. + # Retrieves subscription details. # ## Self-Service Page token # Self-Service Page token for the subscription is not returned by default. # If this information is desired, the include[]=self_service_page_token # parameter must be provided with the request. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Array[SubscriptionInclude]] include Optional parameter: Allows # including additional data in the response. Use in query: # `include[]=coupons&include[]=self_service_page_token`. @@ -323,7 +323,7 @@ def read_subscription(subscription_id, # If unpermitted parameters are sent, a 400 HTTP response is sent along with # a string giving the reason for the problem. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [OverrideSubscriptionRequest] body Optional parameter: Only these # fields are available to be set. # @return [void] Response from the API call. @@ -381,7 +381,7 @@ def find_subscription(reference: nil) # The query params will be: # `?ack={customer_id}&cascade[]=customer&cascade[]=payment_profile` # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [Integer] ack Required parameter: id of the customer. # @param [Array[SubscriptionPurgeType]] cascade Optional parameter: Options # are "customer" or "payment_profile". Use in query: @@ -415,7 +415,7 @@ def purge_subscription(subscription_id, # Use this endpoint to update a subscription's prepaid configuration. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [UpsertPrepaidConfigurationRequest] body Optional parameter: TODO: # type description here # @return [PrepaidConfigurationResponse] Response from the API call. @@ -511,7 +511,7 @@ def preview_subscription(body: nil) # below. When passing in request body parameters, the list of coupon codes # will simply be added to any existing list of codes on the subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [String] code Optional parameter: A code for the coupon that would # be applied to a subscription # @param [AddCouponsRequest] body Optional parameter: TODO: type description @@ -549,7 +549,7 @@ def apply_coupons_to_subscription(subscription_id, # [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons # -and-Subscriptions#removing-a-coupon) # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [String] coupon_code Optional parameter: The coupon code # @return [String] Response from the API call. def remove_coupon_from_subscription(subscription_id, @@ -626,7 +626,7 @@ def remove_coupon_from_subscription(subscription_id, # from activation and return any prepayments and credits applied to the # invoice back to the subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of - # the subscription + # the subscription. # @param [ActivateSubscriptionRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionResponse] Response from the API call. diff --git a/lib/advanced_billing/models/allocate_components.rb b/lib/advanced_billing/models/allocate_components.rb index 7ee9b9da..d29e0cbd 100644 --- a/lib/advanced_billing/models/allocate_components.rb +++ b/lib/advanced_billing/models/allocate_components.rb @@ -27,13 +27,11 @@ class AllocateComponents < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit diff --git a/lib/advanced_billing/models/allocation.rb b/lib/advanced_billing/models/allocation.rb index 9ea6f4e7..e183de74 100644 --- a/lib/advanced_billing/models/allocation.rb +++ b/lib/advanced_billing/models/allocation.rb @@ -109,37 +109,31 @@ class Allocation < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit # 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`. # @return [PaymentForAllocation] attr_accessor :payment # 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`. # @return [DateTime] attr_accessor :expires_at # 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`. # @return [Integer] attr_accessor :used_quantity # 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`. # @return [Integer] attr_accessor :charge_id diff --git a/lib/advanced_billing/models/allocation_preview_item.rb b/lib/advanced_billing/models/allocation_preview_item.rb index 1bb8601c..ab38538c 100644 --- a/lib/advanced_billing/models/allocation_preview_item.rb +++ b/lib/advanced_billing/models/allocation_preview_item.rb @@ -47,19 +47,16 @@ class AllocationPreviewItem < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit # 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`. # @return [Integer] attr_accessor :price_point_id diff --git a/lib/advanced_billing/models/allocation_settings.rb b/lib/advanced_billing/models/allocation_settings.rb index 226e328d..3916454d 100644 --- a/lib/advanced_billing/models/allocation_settings.rb +++ b/lib/advanced_billing/models/allocation_settings.rb @@ -11,13 +11,11 @@ class AllocationSettings < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit diff --git a/lib/advanced_billing/models/available_actions.rb b/lib/advanced_billing/models/available_actions.rb new file mode 100644 index 00000000..5ae56d8c --- /dev/null +++ b/lib/advanced_billing/models/available_actions.rb @@ -0,0 +1,73 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # AvailableActions Model. + class AvailableActions < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [SendEmail] + attr_accessor :send_email + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['send_email'] = 'send_email' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + send_email + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(send_email: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @send_email = send_email unless send_email == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + send_email = SendEmail.from_hash(hash['send_email']) if hash['send_email'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + AvailableActions.new(send_email: send_email, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} send_email: #{@send_email}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} send_email: #{@send_email.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/calendar_billing.rb b/lib/advanced_billing/models/calendar_billing.rb index 59dde8c5..70a70b4f 100644 --- a/lib/advanced_billing/models/calendar_billing.rb +++ b/lib/advanced_billing/models/calendar_billing.rb @@ -38,9 +38,7 @@ def self.optionals # An array for nullable fields def self.nullables - %w[ - snap_day - ] + [] end def initialize(snap_day: SKIP, calendar_billing_first_charge: SKIP, diff --git a/lib/advanced_billing/models/cancellation_options.rb b/lib/advanced_billing/models/cancellation_options.rb index a137ecfa..62913a9e 100644 --- a/lib/advanced_billing/models/cancellation_options.rb +++ b/lib/advanced_billing/models/cancellation_options.rb @@ -3,27 +3,53 @@ # This file was automatically generated for Maxio by # APIMATIC v3.0 ( https://www.apimatic.io ). +require 'date' module AdvancedBilling # CancellationOptions Model. class CancellationOptions < BaseModel SKIP = Object.new private_constant :SKIP - # For your internal use. An indication as to why the subscription is being - # canceled. + # An indication as to why the subscription is being canceled. For your + # internal use. # @return [String] attr_accessor :cancellation_message - # The reason code associated with the cancellation. See the list of reason + # The reason code associated with the cancellation. Use the [List Reason + # Codes]($e/Reason%20Codes/listReasonCodes) endpoint to retrieve the reason # codes associated with your site. # @return [String] attr_accessor :reason_code + # When true, the subscription is cancelled at the current period end instead + # of immediately. To use this option, the Schedule Subscription Cancellation + # feature must be enabled on your site. + # @return [TrueClass | FalseClass] + attr_accessor :cancel_at_end_of_period + + # Schedules the cancellation on the provided date. This is option is not + # applicable for prepaid subscriptions. To use this option, the Schedule + # Subscription Cancellation feature must be enabled on your site. + # @return [DateTime] + attr_accessor :scheduled_cancellation_at + + # Applies to prepaid subscriptions. When true, which is the default, the + # remaining prepaid balance is refunded as part of cancellation processing. + # When false, prepaid balance is not refunded as part of cancellation + # processing. To use this option, the Schedule Subscription Cancellation + # feature must be enabled on your site. + # @return [TrueClass | FalseClass] + attr_accessor :refund_prepayment_account_balance + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @_hash['cancellation_message'] = 'cancellation_message' @_hash['reason_code'] = 'reason_code' + @_hash['cancel_at_end_of_period'] = 'cancel_at_end_of_period' + @_hash['scheduled_cancellation_at'] = 'scheduled_cancellation_at' + @_hash['refund_prepayment_account_balance'] = + 'refund_prepayment_account_balance' @_hash end @@ -32,15 +58,23 @@ def self.optionals %w[ cancellation_message reason_code + cancel_at_end_of_period + scheduled_cancellation_at + refund_prepayment_account_balance ] end # An array for nullable fields def self.nullables - [] + %w[ + scheduled_cancellation_at + ] end def initialize(cancellation_message: SKIP, reason_code: SKIP, + cancel_at_end_of_period: SKIP, + scheduled_cancellation_at: SKIP, + refund_prepayment_account_balance: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| @@ -49,6 +83,15 @@ def initialize(cancellation_message: SKIP, reason_code: SKIP, @cancellation_message = cancellation_message unless cancellation_message == SKIP @reason_code = reason_code unless reason_code == SKIP + @cancel_at_end_of_period = cancel_at_end_of_period unless cancel_at_end_of_period == SKIP + unless scheduled_cancellation_at == SKIP + @scheduled_cancellation_at = + scheduled_cancellation_at + end + unless refund_prepayment_account_balance == SKIP + @refund_prepayment_account_balance = + refund_prepayment_account_balance + end end # Creates an instance of the object from a hash. @@ -59,6 +102,15 @@ def self.from_hash(hash) cancellation_message = hash.key?('cancellation_message') ? hash['cancellation_message'] : SKIP reason_code = hash.key?('reason_code') ? hash['reason_code'] : SKIP + cancel_at_end_of_period = + hash.key?('cancel_at_end_of_period') ? hash['cancel_at_end_of_period'] : SKIP + scheduled_cancellation_at = if hash.key?('scheduled_cancellation_at') + (DateTimeHelper.from_rfc3339(hash['scheduled_cancellation_at']) if hash['scheduled_cancellation_at']) + else + SKIP + end + refund_prepayment_account_balance = + hash.key?('refund_prepayment_account_balance') ? hash['refund_prepayment_account_balance'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } @@ -66,21 +118,34 @@ def self.from_hash(hash) # Create object from extracted values. CancellationOptions.new(cancellation_message: cancellation_message, reason_code: reason_code, + cancel_at_end_of_period: cancel_at_end_of_period, + scheduled_cancellation_at: scheduled_cancellation_at, + refund_prepayment_account_balance: refund_prepayment_account_balance, additional_properties: additional_properties) end + def to_custom_scheduled_cancellation_at + DateTimeHelper.to_rfc3339(scheduled_cancellation_at) + end + # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last "<#{class_name} cancellation_message: #{@cancellation_message}, reason_code:"\ - " #{@reason_code}, additional_properties: #{get_additional_properties}>" + " #{@reason_code}, cancel_at_end_of_period: #{@cancel_at_end_of_period},"\ + " scheduled_cancellation_at: #{@scheduled_cancellation_at},"\ + " refund_prepayment_account_balance: #{@refund_prepayment_account_balance},"\ + " additional_properties: #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. def inspect class_name = self.class.name.split('::').last "<#{class_name} cancellation_message: #{@cancellation_message.inspect}, reason_code:"\ - " #{@reason_code.inspect}, additional_properties: #{get_additional_properties}>" + " #{@reason_code.inspect}, cancel_at_end_of_period: #{@cancel_at_end_of_period.inspect},"\ + " scheduled_cancellation_at: #{@scheduled_cancellation_at.inspect},"\ + " refund_prepayment_account_balance: #{@refund_prepayment_account_balance.inspect},"\ + " additional_properties: #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/clone_component_price_point.rb b/lib/advanced_billing/models/clone_component_price_point.rb new file mode 100644 index 00000000..33f5b61e --- /dev/null +++ b/lib/advanced_billing/models/clone_component_price_point.rb @@ -0,0 +1,81 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # CloneComponentPricePoint Model. + class CloneComponentPricePoint < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [String] + attr_accessor :name + + # TODO: Write general description for this method + # @return [String] + attr_accessor :handle + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['name'] = 'name' + @_hash['handle'] = 'handle' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + handle + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(name:, handle: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @name = name + @handle = handle unless handle == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + name = hash.key?('name') ? hash['name'] : nil + handle = hash.key?('handle') ? hash['handle'] : SKIP + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + CloneComponentPricePoint.new(name: name, + handle: handle, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} name: #{@name}, handle: #{@handle}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} name: #{@name.inspect}, handle: #{@handle.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/clone_component_price_point_request.rb b/lib/advanced_billing/models/clone_component_price_point_request.rb new file mode 100644 index 00000000..5114d2cb --- /dev/null +++ b/lib/advanced_billing/models/clone_component_price_point_request.rb @@ -0,0 +1,71 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # CloneComponentPricePointRequest Model. + class CloneComponentPricePointRequest < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [CloneComponentPricePoint] + attr_accessor :price_point + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['price_point'] = 'price_point' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(price_point:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @price_point = price_point + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + price_point = CloneComponentPricePoint.from_hash(hash['price_point']) if hash['price_point'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + CloneComponentPricePointRequest.new(price_point: price_point, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} price_point: #{@price_point}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} price_point: #{@price_point.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/component.rb b/lib/advanced_billing/models/component.rb index ad768aee..120b0892 100644 --- a/lib/advanced_billing/models/component.rb +++ b/lib/advanced_billing/models/component.rb @@ -112,13 +112,11 @@ class Component < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit diff --git a/lib/advanced_billing/models/component_custom_price.rb b/lib/advanced_billing/models/component_custom_price.rb index d1cf7e69..bafefbef 100644 --- a/lib/advanced_billing/models/component_custom_price.rb +++ b/lib/advanced_billing/models/component_custom_price.rb @@ -31,7 +31,17 @@ class ComponentCustomPrice < BaseModel # @return [IntervalUnit] attr_accessor :interval_unit - # On/off components only need one price bracket starting at 1 + # Optional id of the price point to use for list price calculations when + # overriding the customer price. + # @return [Integer] + attr_accessor :list_price_point_id + + # When true, list price calculations will continue to use the default price + # point even when a `custom_price` is supplied. + # @return [TrueClass | FalseClass] + attr_accessor :use_default_list_price + + # On/off components only need one price bracket starting at 1. # @return [Array[Price]] attr_accessor :prices @@ -62,6 +72,8 @@ def self.names @_hash['pricing_scheme'] = 'pricing_scheme' @_hash['interval'] = 'interval' @_hash['interval_unit'] = 'interval_unit' + @_hash['list_price_point_id'] = 'list_price_point_id' + @_hash['use_default_list_price'] = 'use_default_list_price' @_hash['prices'] = 'prices' @_hash['renew_prepaid_allocation'] = 'renew_prepaid_allocation' @_hash['rollover_prepaid_remainder'] = 'rollover_prepaid_remainder' @@ -77,6 +89,8 @@ def self.optionals pricing_scheme interval interval_unit + list_price_point_id + use_default_list_price renew_prepaid_allocation rollover_prepaid_remainder expiration_interval @@ -88,6 +102,7 @@ def self.optionals def self.nullables %w[ interval_unit + list_price_point_id expiration_interval expiration_interval_unit ] @@ -95,6 +110,7 @@ def self.nullables def initialize(prices:, tax_included: SKIP, pricing_scheme: SKIP, interval: SKIP, interval_unit: SKIP, + list_price_point_id: SKIP, use_default_list_price: SKIP, renew_prepaid_allocation: SKIP, rollover_prepaid_remainder: SKIP, expiration_interval: SKIP, expiration_interval_unit: SKIP, additional_properties: {}) @@ -107,6 +123,8 @@ def initialize(prices:, tax_included: SKIP, pricing_scheme: SKIP, @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP @interval = interval unless interval == SKIP @interval_unit = interval_unit unless interval_unit == SKIP + @list_price_point_id = list_price_point_id unless list_price_point_id == SKIP + @use_default_list_price = use_default_list_price unless use_default_list_price == SKIP @prices = prices @renew_prepaid_allocation = renew_prepaid_allocation unless renew_prepaid_allocation == SKIP unless rollover_prepaid_remainder == SKIP @@ -137,6 +155,10 @@ def self.from_hash(hash) hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP interval = hash.key?('interval') ? hash['interval'] : SKIP interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP + list_price_point_id = + hash.key?('list_price_point_id') ? hash['list_price_point_id'] : SKIP + use_default_list_price = + hash.key?('use_default_list_price') ? hash['use_default_list_price'] : SKIP renew_prepaid_allocation = hash.key?('renew_prepaid_allocation') ? hash['renew_prepaid_allocation'] : SKIP rollover_prepaid_remainder = @@ -155,6 +177,8 @@ def self.from_hash(hash) pricing_scheme: pricing_scheme, interval: interval, interval_unit: interval_unit, + list_price_point_id: list_price_point_id, + use_default_list_price: use_default_list_price, renew_prepaid_allocation: renew_prepaid_allocation, rollover_prepaid_remainder: rollover_prepaid_remainder, expiration_interval: expiration_interval, @@ -184,11 +208,12 @@ def self.validate(value) def to_s class_name = self.class.name.split('::').last "<#{class_name} tax_included: #{@tax_included}, pricing_scheme: #{@pricing_scheme},"\ - " interval: #{@interval}, interval_unit: #{@interval_unit}, prices: #{@prices},"\ - " renew_prepaid_allocation: #{@renew_prepaid_allocation}, rollover_prepaid_remainder:"\ - " #{@rollover_prepaid_remainder}, expiration_interval: #{@expiration_interval},"\ - " expiration_interval_unit: #{@expiration_interval_unit}, additional_properties:"\ - " #{get_additional_properties}>" + " interval: #{@interval}, interval_unit: #{@interval_unit}, list_price_point_id:"\ + " #{@list_price_point_id}, use_default_list_price: #{@use_default_list_price}, prices:"\ + " #{@prices}, renew_prepaid_allocation: #{@renew_prepaid_allocation},"\ + " rollover_prepaid_remainder: #{@rollover_prepaid_remainder}, expiration_interval:"\ + " #{@expiration_interval}, expiration_interval_unit: #{@expiration_interval_unit},"\ + " additional_properties: #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. @@ -196,9 +221,10 @@ def inspect class_name = self.class.name.split('::').last "<#{class_name} tax_included: #{@tax_included.inspect}, pricing_scheme:"\ " #{@pricing_scheme.inspect}, interval: #{@interval.inspect}, interval_unit:"\ - " #{@interval_unit.inspect}, prices: #{@prices.inspect}, renew_prepaid_allocation:"\ - " #{@renew_prepaid_allocation.inspect}, rollover_prepaid_remainder:"\ - " #{@rollover_prepaid_remainder.inspect}, expiration_interval:"\ + " #{@interval_unit.inspect}, list_price_point_id: #{@list_price_point_id.inspect},"\ + " use_default_list_price: #{@use_default_list_price.inspect}, prices: #{@prices.inspect},"\ + " renew_prepaid_allocation: #{@renew_prepaid_allocation.inspect},"\ + " rollover_prepaid_remainder: #{@rollover_prepaid_remainder.inspect}, expiration_interval:"\ " #{@expiration_interval.inspect}, expiration_interval_unit:"\ " #{@expiration_interval_unit.inspect}, additional_properties:"\ " #{get_additional_properties}>" diff --git a/lib/advanced_billing/models/component_price_point.rb b/lib/advanced_billing/models/component_price_point.rb index c288f5f6..24cb3e08 100644 --- a/lib/advanced_billing/models/component_price_point.rb +++ b/lib/advanced_billing/models/component_price_point.rb @@ -106,7 +106,8 @@ class ComponentPricePoint < BaseModel # are defined for the site. It varies based on the use_site_exchange_rate # setting for the price point. This parameter is present only in the # response of read endpoints, after including the appropriate query - # parameter. + # parameter. The clone endpoint always returns currency prices if they are + # present. # @return [Array[ComponentCurrencyPrice]] attr_accessor :currency_prices diff --git a/lib/advanced_billing/models/component_price_point_currency_overage_response.rb b/lib/advanced_billing/models/component_price_point_currency_overage_response.rb new file mode 100644 index 00000000..2bffec36 --- /dev/null +++ b/lib/advanced_billing/models/component_price_point_currency_overage_response.rb @@ -0,0 +1,71 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ComponentPricePointCurrencyOverageResponse Model. + class ComponentPricePointCurrencyOverageResponse < BaseModel + SKIP = Object.new + private_constant :SKIP + + # Extends a component price point with currency overage prices. + # @return [CurrencyOveragePrices] + attr_accessor :price_point + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['price_point'] = 'price_point' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(price_point:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @price_point = price_point + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + price_point = CurrencyOveragePrices.from_hash(hash['price_point']) if hash['price_point'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ComponentPricePointCurrencyOverageResponse.new(price_point: price_point, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} price_point: #{@price_point}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} price_point: #{@price_point.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/contract.rb b/lib/advanced_billing/models/contract.rb new file mode 100644 index 00000000..73d41c1d --- /dev/null +++ b/lib/advanced_billing/models/contract.rb @@ -0,0 +1,104 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # Contract linked to the scheduled renewal configuration. + class Contract < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :id + + # TODO: Write general description for this method + # @return [String] + attr_accessor :maxio_id + + # TODO: Write general description for this method + # @return [String] + attr_accessor :number + + # TODO: Write general description for this method + # @return [Register] + attr_accessor :register + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['id'] = 'id' + @_hash['maxio_id'] = 'maxio_id' + @_hash['number'] = 'number' + @_hash['register'] = 'register' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + id + maxio_id + number + register + ] + end + + # An array for nullable fields + def self.nullables + %w[ + number + ] + end + + def initialize(id: SKIP, maxio_id: SKIP, number: SKIP, register: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @id = id unless id == SKIP + @maxio_id = maxio_id unless maxio_id == SKIP + @number = number unless number == SKIP + @register = register unless register == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + id = hash.key?('id') ? hash['id'] : SKIP + maxio_id = hash.key?('maxio_id') ? hash['maxio_id'] : SKIP + number = hash.key?('number') ? hash['number'] : SKIP + register = Register.from_hash(hash['register']) if hash['register'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + Contract.new(id: id, + maxio_id: maxio_id, + number: number, + register: register, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id}, maxio_id: #{@maxio_id}, number: #{@number}, register:"\ + " #{@register}, additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id.inspect}, maxio_id: #{@maxio_id.inspect}, number:"\ + " #{@number.inspect}, register: #{@register.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/create_allocation.rb b/lib/advanced_billing/models/create_allocation.rb index 223c5994..7de2b7f7 100644 --- a/lib/advanced_billing/models/create_allocation.rb +++ b/lib/advanced_billing/models/create_allocation.rb @@ -16,12 +16,28 @@ class CreateAllocation < BaseModel # @return [Float] attr_accessor :quantity + # Decimal representation of the allocated quantity. Only valid when decimal + # allocations are enabled for the component. + # @return [String] + attr_accessor :decimal_quantity + + # The quantity that was in effect before this allocation. Responses always + # include this value; it may be supplied on preview requests to ensure the + # expected change is evaluated. + # @return [Float] + attr_accessor :previous_quantity + + # Decimal representation of `previous_quantity`. Only valid when decimal + # allocations are enabled for the component. + # @return [String] + attr_accessor :decimal_previous_quantity + # (required for the multiple allocations endpoint) The id associated with - # the component for which the allocation is being made + # the component for which the allocation is being made. # @return [Integer] attr_accessor :component_id - # A memo to record along with the allocation + # A memo to record along with the allocation. # @return [String] attr_accessor :memo @@ -35,24 +51,32 @@ class CreateAllocation < BaseModel # @return [String] attr_accessor :proration_upgrade_scheme - # If the change in cost is an upgrade, this determines if the charge should - # accrue to the next renewal or if capture should be attempted immediately. - # Defaults to the site setting if one is not provided. - # @return [TrueClass | FalseClass] - attr_accessor :accrue_charge - # 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`. - # @return [CreditType] + # the component and then site setting if one is not provided. Values are: + # `full` - A full price credit is added for the amount owed. + # `prorated` - A prorated credit is added for the amount owed. + # `none` - No charge is added. + # @return [DowngradeCreditCreditType] attr_accessor :downgrade_credit # 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`. - # @return [CreditType] + # the component and then site setting if one is not provided. Values are: + # `full` - A charge is added for the full price of the component. + # `prorated` - A charge is added for the prorated price of the component + # change. + # `none` - No charge is added. + # @return [UpgradeChargeCreditType] attr_accessor :upgrade_charge + # "If the change in cost is an upgrade, this determines if the charge should + # accrue to the next renewal or if capture should be attempted immediately. + # `true` - Attempt to charge the customer at the next renewal. + # `false` - Attempt to charge the customer right away. If it fails, the + # charge will be accrued until the next renewal. + # Defaults to the site setting if unspecified in the request. + # @return [TrueClass | FalseClass] + attr_accessor :accrue_charge + # 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. @@ -72,36 +96,49 @@ class CreateAllocation < BaseModel # @return [BillingSchedule] attr_accessor :billing_schedule + # Create or update custom pricing unique to the subscription. Used in place + # of `price_point_id`. + # @return [ComponentCustomPrice] + attr_accessor :custom_price + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @_hash['quantity'] = 'quantity' + @_hash['decimal_quantity'] = 'decimal_quantity' + @_hash['previous_quantity'] = 'previous_quantity' + @_hash['decimal_previous_quantity'] = 'decimal_previous_quantity' @_hash['component_id'] = 'component_id' @_hash['memo'] = 'memo' @_hash['proration_downgrade_scheme'] = 'proration_downgrade_scheme' @_hash['proration_upgrade_scheme'] = 'proration_upgrade_scheme' - @_hash['accrue_charge'] = 'accrue_charge' @_hash['downgrade_credit'] = 'downgrade_credit' @_hash['upgrade_charge'] = 'upgrade_charge' + @_hash['accrue_charge'] = 'accrue_charge' @_hash['initiate_dunning'] = 'initiate_dunning' @_hash['price_point_id'] = 'price_point_id' @_hash['billing_schedule'] = 'billing_schedule' + @_hash['custom_price'] = 'custom_price' @_hash end # An array for optional fields def self.optionals %w[ + decimal_quantity + previous_quantity + decimal_previous_quantity component_id memo proration_downgrade_scheme proration_upgrade_scheme - accrue_charge downgrade_credit upgrade_charge + accrue_charge initiate_dunning price_point_id billing_schedule + custom_price ] end @@ -114,18 +151,26 @@ def self.nullables ] end - def initialize(quantity:, component_id: SKIP, memo: SKIP, - proration_downgrade_scheme: SKIP, - proration_upgrade_scheme: SKIP, accrue_charge: SKIP, - downgrade_credit: SKIP, upgrade_charge: SKIP, + def initialize(quantity:, decimal_quantity: SKIP, previous_quantity: SKIP, + decimal_previous_quantity: SKIP, component_id: SKIP, + memo: SKIP, proration_downgrade_scheme: SKIP, + proration_upgrade_scheme: SKIP, downgrade_credit: SKIP, + upgrade_charge: SKIP, accrue_charge: SKIP, initiate_dunning: SKIP, price_point_id: SKIP, - billing_schedule: SKIP, additional_properties: {}) + billing_schedule: SKIP, custom_price: SKIP, + additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @quantity = quantity + @decimal_quantity = decimal_quantity unless decimal_quantity == SKIP + @previous_quantity = previous_quantity unless previous_quantity == SKIP + unless decimal_previous_quantity == SKIP + @decimal_previous_quantity = + decimal_previous_quantity + end @component_id = component_id unless component_id == SKIP @memo = memo unless memo == SKIP unless proration_downgrade_scheme == SKIP @@ -133,12 +178,13 @@ def initialize(quantity:, component_id: SKIP, memo: SKIP, proration_downgrade_scheme end @proration_upgrade_scheme = proration_upgrade_scheme unless proration_upgrade_scheme == SKIP - @accrue_charge = accrue_charge unless accrue_charge == SKIP @downgrade_credit = downgrade_credit unless downgrade_credit == SKIP @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP + @accrue_charge = accrue_charge unless accrue_charge == SKIP @initiate_dunning = initiate_dunning unless initiate_dunning == SKIP @price_point_id = price_point_id unless price_point_id == SKIP @billing_schedule = billing_schedule unless billing_schedule == SKIP + @custom_price = custom_price unless custom_price == SKIP end # Creates an instance of the object from a hash. @@ -147,17 +193,23 @@ def self.from_hash(hash) # Extract variables from the hash. quantity = hash.key?('quantity') ? hash['quantity'] : nil + decimal_quantity = + hash.key?('decimal_quantity') ? hash['decimal_quantity'] : SKIP + previous_quantity = + hash.key?('previous_quantity') ? hash['previous_quantity'] : SKIP + decimal_previous_quantity = + hash.key?('decimal_previous_quantity') ? hash['decimal_previous_quantity'] : SKIP component_id = hash.key?('component_id') ? hash['component_id'] : SKIP memo = hash.key?('memo') ? hash['memo'] : SKIP proration_downgrade_scheme = hash.key?('proration_downgrade_scheme') ? hash['proration_downgrade_scheme'] : SKIP proration_upgrade_scheme = hash.key?('proration_upgrade_scheme') ? hash['proration_upgrade_scheme'] : SKIP - accrue_charge = hash.key?('accrue_charge') ? hash['accrue_charge'] : SKIP downgrade_credit = hash.key?('downgrade_credit') ? hash['downgrade_credit'] : SKIP upgrade_charge = hash.key?('upgrade_charge') ? hash['upgrade_charge'] : SKIP + accrue_charge = hash.key?('accrue_charge') ? hash['accrue_charge'] : SKIP initiate_dunning = hash.key?('initiate_dunning') ? hash['initiate_dunning'] : SKIP price_point_id = hash.key?('price_point_id') ? APIHelper.deserialize_union_type( @@ -165,22 +217,27 @@ def self.from_hash(hash) ) : SKIP billing_schedule = BillingSchedule.from_hash(hash['billing_schedule']) if hash['billing_schedule'] + custom_price = ComponentCustomPrice.from_hash(hash['custom_price']) if hash['custom_price'] # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. CreateAllocation.new(quantity: quantity, + decimal_quantity: decimal_quantity, + previous_quantity: previous_quantity, + decimal_previous_quantity: decimal_previous_quantity, component_id: component_id, memo: memo, proration_downgrade_scheme: proration_downgrade_scheme, proration_upgrade_scheme: proration_upgrade_scheme, - accrue_charge: accrue_charge, downgrade_credit: downgrade_credit, upgrade_charge: upgrade_charge, + accrue_charge: accrue_charge, initiate_dunning: initiate_dunning, price_point_id: price_point_id, billing_schedule: billing_schedule, + custom_price: custom_price, additional_properties: additional_properties) end @@ -201,25 +258,30 @@ def self.validate(value) # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last - "<#{class_name} quantity: #{@quantity}, component_id: #{@component_id}, memo: #{@memo},"\ + "<#{class_name} quantity: #{@quantity}, decimal_quantity: #{@decimal_quantity},"\ + " previous_quantity: #{@previous_quantity}, decimal_previous_quantity:"\ + " #{@decimal_previous_quantity}, component_id: #{@component_id}, memo: #{@memo},"\ " proration_downgrade_scheme: #{@proration_downgrade_scheme}, proration_upgrade_scheme:"\ - " #{@proration_upgrade_scheme}, accrue_charge: #{@accrue_charge}, downgrade_credit:"\ - " #{@downgrade_credit}, upgrade_charge: #{@upgrade_charge}, initiate_dunning:"\ + " #{@proration_upgrade_scheme}, downgrade_credit: #{@downgrade_credit}, upgrade_charge:"\ + " #{@upgrade_charge}, accrue_charge: #{@accrue_charge}, initiate_dunning:"\ " #{@initiate_dunning}, price_point_id: #{@price_point_id}, billing_schedule:"\ - " #{@billing_schedule}, additional_properties: #{get_additional_properties}>" + " #{@billing_schedule}, custom_price: #{@custom_price}, additional_properties:"\ + " #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. def inspect class_name = self.class.name.split('::').last - "<#{class_name} quantity: #{@quantity.inspect}, component_id: #{@component_id.inspect},"\ - " memo: #{@memo.inspect}, proration_downgrade_scheme:"\ + "<#{class_name} quantity: #{@quantity.inspect}, decimal_quantity:"\ + " #{@decimal_quantity.inspect}, previous_quantity: #{@previous_quantity.inspect},"\ + " decimal_previous_quantity: #{@decimal_previous_quantity.inspect}, component_id:"\ + " #{@component_id.inspect}, memo: #{@memo.inspect}, proration_downgrade_scheme:"\ " #{@proration_downgrade_scheme.inspect}, proration_upgrade_scheme:"\ - " #{@proration_upgrade_scheme.inspect}, accrue_charge: #{@accrue_charge.inspect},"\ - " downgrade_credit: #{@downgrade_credit.inspect}, upgrade_charge:"\ - " #{@upgrade_charge.inspect}, initiate_dunning: #{@initiate_dunning.inspect},"\ - " price_point_id: #{@price_point_id.inspect}, billing_schedule:"\ - " #{@billing_schedule.inspect}, additional_properties: #{get_additional_properties}>" + " #{@proration_upgrade_scheme.inspect}, downgrade_credit: #{@downgrade_credit.inspect},"\ + " upgrade_charge: #{@upgrade_charge.inspect}, accrue_charge: #{@accrue_charge.inspect},"\ + " initiate_dunning: #{@initiate_dunning.inspect}, price_point_id:"\ + " #{@price_point_id.inspect}, billing_schedule: #{@billing_schedule.inspect}, custom_price:"\ + " #{@custom_price.inspect}, additional_properties: #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/create_subscription.rb b/lib/advanced_billing/models/create_subscription.rb index 4eddef8a..2b4fe7ec 100644 --- a/lib/advanced_billing/models/create_subscription.rb +++ b/lib/advanced_billing/models/create_subscription.rb @@ -30,7 +30,8 @@ class CreateSubscription < BaseModel attr_accessor :product_price_point_id # (Optional) Used in place of `product_price_point_id` to define a custom - # price point unique to the subscription + # price point unique to the subscription. A subscription can have up to 30 + # custom price points. Exceeding this limit will result in an API error. # @return [SubscriptionCustomPrice] attr_accessor :custom_price diff --git a/lib/advanced_billing/models/credit_type.rb b/lib/advanced_billing/models/credit_type.rb index 5b03c3ea..21eee5c9 100644 --- a/lib/advanced_billing/models/credit_type.rb +++ b/lib/advanced_billing/models/credit_type.rb @@ -5,8 +5,7 @@ module AdvancedBilling # 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`. + # component and then site setting if one is not provided. class CreditType CREDIT_TYPE = [ # TODO: Write general description for FULL diff --git a/lib/advanced_billing/models/currency_overage_prices.rb b/lib/advanced_billing/models/currency_overage_prices.rb new file mode 100644 index 00000000..401ee3fd --- /dev/null +++ b/lib/advanced_billing/models/currency_overage_prices.rb @@ -0,0 +1,433 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +require 'date' +module AdvancedBilling + # Extends a component price point with currency overage prices. + class CurrencyOveragePrices < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :id + + # 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. + # @return [PricePointType] + attr_accessor :type + + # Note: Refer to type attribute instead + # @return [TrueClass | FalseClass] + attr_accessor :default + + # Note: Refer to type attribute instead + # @return [String] + attr_accessor :name + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [PricingScheme] + attr_accessor :pricing_scheme + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [Integer] + attr_accessor :component_id + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [String] + attr_accessor :handle + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [DateTime] + attr_accessor :archived_at + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [DateTime] + attr_accessor :created_at + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [DateTime] + attr_accessor :updated_at + + # The identifier for the pricing scheme. See [Product + # Components](https://help.chargify.com/products/product-components.html) + # for an overview of pricing schemes. + # @return [Array[ComponentPrice]] + attr_accessor :prices + + # Whether to use the site level exchange rate or define your own prices for + # each currency if you have multiple currencies defined on the site. + # Defaults to true during creation. + # @return [TrueClass | FalseClass] + attr_accessor :use_site_exchange_rate + + # (only used for Custom Pricing - ie. when the price point's type is + # `custom`) The id of the subscription that the custom price point is for. + # @return [Integer] + attr_accessor :subscription_id + + # (only used for Custom Pricing - ie. when the price point's type is + # `custom`) The id of the subscription that the custom price point is for. + # @return [TrueClass | FalseClass] + attr_accessor :tax_included + + # 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. + # @return [Integer] + attr_accessor :interval + + # 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. + # @return [IntervalUnit] + attr_accessor :interval_unit + + # An array of currency pricing data is available when multiple currencies + # are defined for the site. It varies based on the use_site_exchange_rate + # setting for the price point. This parameter is present only in the + # response of read endpoints, after including the appropriate query + # parameter. The clone endpoint always returns currency prices if they are + # present. + # @return [Array[ComponentCurrencyPrice]] + attr_accessor :currency_prices + + # Applicable only to prepaid usage components. An array of overage price + # brackets. + # @return [Array[ComponentPrice]] + attr_accessor :overage_prices + + # Applicable only to prepaid usage components. Pricing scheme for overage + # pricing. + # @return [PricingScheme] + attr_accessor :overage_pricing_scheme + + # Applicable only to prepaid usage components. Boolean which controls + # whether or not the allocated quantity should be renewed at the beginning + # of each period. + # @return [TrueClass | FalseClass] + attr_accessor :renew_prepaid_allocation + + # Applicable only to prepaid usage components. Boolean which controls + # whether or not remaining units should be rolled over to the next period. + # @return [TrueClass | FalseClass] + attr_accessor :rollover_prepaid_remainder + + # Applicable only to prepaid usage components where + # rollover_prepaid_remainder is true. The number of + # `expiration_interval_unit`s after which rollover amounts should expire. + # @return [Integer] + attr_accessor :expiration_interval + + # Applicable only to prepaid usage components where + # rollover_prepaid_remainder is true. A string representing the expiration + # interval unit for this component, either month or day. + # @return [ExpirationIntervalUnit] + attr_accessor :expiration_interval_unit + + # Applicable only to prepaid usage components. An array of currency pricing + # data for overage prices. + # @return [Array[ComponentCurrencyPrice]] + attr_accessor :currency_overage_prices + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['id'] = 'id' + @_hash['type'] = 'type' + @_hash['default'] = 'default' + @_hash['name'] = 'name' + @_hash['pricing_scheme'] = 'pricing_scheme' + @_hash['component_id'] = 'component_id' + @_hash['handle'] = 'handle' + @_hash['archived_at'] = 'archived_at' + @_hash['created_at'] = 'created_at' + @_hash['updated_at'] = 'updated_at' + @_hash['prices'] = 'prices' + @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate' + @_hash['subscription_id'] = 'subscription_id' + @_hash['tax_included'] = 'tax_included' + @_hash['interval'] = 'interval' + @_hash['interval_unit'] = 'interval_unit' + @_hash['currency_prices'] = 'currency_prices' + @_hash['overage_prices'] = 'overage_prices' + @_hash['overage_pricing_scheme'] = 'overage_pricing_scheme' + @_hash['renew_prepaid_allocation'] = 'renew_prepaid_allocation' + @_hash['rollover_prepaid_remainder'] = 'rollover_prepaid_remainder' + @_hash['expiration_interval'] = 'expiration_interval' + @_hash['expiration_interval_unit'] = 'expiration_interval_unit' + @_hash['currency_overage_prices'] = 'currency_overage_prices' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + id + type + default + name + pricing_scheme + component_id + handle + archived_at + created_at + updated_at + prices + use_site_exchange_rate + subscription_id + tax_included + interval + interval_unit + currency_prices + overage_prices + overage_pricing_scheme + renew_prepaid_allocation + rollover_prepaid_remainder + expiration_interval + expiration_interval_unit + currency_overage_prices + ] + end + + # An array for nullable fields + def self.nullables + %w[ + handle + archived_at + interval + interval_unit + expiration_interval + expiration_interval_unit + ] + end + + def initialize(id: SKIP, type: SKIP, default: SKIP, name: SKIP, + pricing_scheme: SKIP, component_id: SKIP, handle: SKIP, + archived_at: SKIP, created_at: SKIP, updated_at: SKIP, + prices: SKIP, use_site_exchange_rate: SKIP, + subscription_id: SKIP, tax_included: SKIP, interval: SKIP, + interval_unit: SKIP, currency_prices: SKIP, + overage_prices: SKIP, overage_pricing_scheme: SKIP, + renew_prepaid_allocation: SKIP, + rollover_prepaid_remainder: SKIP, expiration_interval: SKIP, + expiration_interval_unit: SKIP, + currency_overage_prices: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @id = id unless id == SKIP + @type = type unless type == SKIP + @default = default unless default == SKIP + @name = name unless name == SKIP + @pricing_scheme = pricing_scheme unless pricing_scheme == SKIP + @component_id = component_id unless component_id == SKIP + @handle = handle unless handle == SKIP + @archived_at = archived_at unless archived_at == SKIP + @created_at = created_at unless created_at == SKIP + @updated_at = updated_at unless updated_at == SKIP + @prices = prices unless prices == SKIP + @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP + @subscription_id = subscription_id unless subscription_id == SKIP + @tax_included = tax_included unless tax_included == SKIP + @interval = interval unless interval == SKIP + @interval_unit = interval_unit unless interval_unit == SKIP + @currency_prices = currency_prices unless currency_prices == SKIP + @overage_prices = overage_prices unless overage_prices == SKIP + @overage_pricing_scheme = overage_pricing_scheme unless overage_pricing_scheme == SKIP + @renew_prepaid_allocation = renew_prepaid_allocation unless renew_prepaid_allocation == SKIP + unless rollover_prepaid_remainder == SKIP + @rollover_prepaid_remainder = + rollover_prepaid_remainder + end + @expiration_interval = expiration_interval unless expiration_interval == SKIP + @expiration_interval_unit = expiration_interval_unit unless expiration_interval_unit == SKIP + @currency_overage_prices = currency_overage_prices unless currency_overage_prices == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + id = hash.key?('id') ? hash['id'] : SKIP + type = hash.key?('type') ? hash['type'] : SKIP + default = hash.key?('default') ? hash['default'] : SKIP + name = hash.key?('name') ? hash['name'] : SKIP + pricing_scheme = + hash.key?('pricing_scheme') ? hash['pricing_scheme'] : SKIP + component_id = hash.key?('component_id') ? hash['component_id'] : SKIP + handle = hash.key?('handle') ? hash['handle'] : SKIP + archived_at = if hash.key?('archived_at') + (DateTimeHelper.from_rfc3339(hash['archived_at']) if hash['archived_at']) + else + SKIP + end + created_at = if hash.key?('created_at') + (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) + else + SKIP + end + updated_at = if hash.key?('updated_at') + (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) + else + SKIP + end + # Parameter is an array, so we need to iterate through it + prices = nil + unless hash['prices'].nil? + prices = [] + hash['prices'].each do |structure| + prices << (ComponentPrice.from_hash(structure) if structure) + end + end + + prices = SKIP unless hash.key?('prices') + use_site_exchange_rate = + hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP + subscription_id = + hash.key?('subscription_id') ? hash['subscription_id'] : SKIP + tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP + interval = hash.key?('interval') ? hash['interval'] : SKIP + interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : SKIP + # Parameter is an array, so we need to iterate through it + currency_prices = nil + unless hash['currency_prices'].nil? + currency_prices = [] + hash['currency_prices'].each do |structure| + currency_prices << (ComponentCurrencyPrice.from_hash(structure) if structure) + end + end + + currency_prices = SKIP unless hash.key?('currency_prices') + # Parameter is an array, so we need to iterate through it + overage_prices = nil + unless hash['overage_prices'].nil? + overage_prices = [] + hash['overage_prices'].each do |structure| + overage_prices << (ComponentPrice.from_hash(structure) if structure) + end + end + + overage_prices = SKIP unless hash.key?('overage_prices') + overage_pricing_scheme = + hash.key?('overage_pricing_scheme') ? hash['overage_pricing_scheme'] : SKIP + renew_prepaid_allocation = + hash.key?('renew_prepaid_allocation') ? hash['renew_prepaid_allocation'] : SKIP + rollover_prepaid_remainder = + hash.key?('rollover_prepaid_remainder') ? hash['rollover_prepaid_remainder'] : SKIP + expiration_interval = + hash.key?('expiration_interval') ? hash['expiration_interval'] : SKIP + expiration_interval_unit = + hash.key?('expiration_interval_unit') ? hash['expiration_interval_unit'] : SKIP + # Parameter is an array, so we need to iterate through it + currency_overage_prices = nil + unless hash['currency_overage_prices'].nil? + currency_overage_prices = [] + hash['currency_overage_prices'].each do |structure| + currency_overage_prices << (ComponentCurrencyPrice.from_hash(structure) if structure) + end + end + + currency_overage_prices = SKIP unless hash.key?('currency_overage_prices') + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + CurrencyOveragePrices.new(id: id, + type: type, + default: default, + name: name, + pricing_scheme: pricing_scheme, + component_id: component_id, + handle: handle, + archived_at: archived_at, + created_at: created_at, + updated_at: updated_at, + prices: prices, + use_site_exchange_rate: use_site_exchange_rate, + subscription_id: subscription_id, + tax_included: tax_included, + interval: interval, + interval_unit: interval_unit, + currency_prices: currency_prices, + overage_prices: overage_prices, + overage_pricing_scheme: overage_pricing_scheme, + renew_prepaid_allocation: renew_prepaid_allocation, + rollover_prepaid_remainder: rollover_prepaid_remainder, + expiration_interval: expiration_interval, + expiration_interval_unit: expiration_interval_unit, + currency_overage_prices: currency_overage_prices, + additional_properties: additional_properties) + end + + def to_custom_archived_at + DateTimeHelper.to_rfc3339(archived_at) + end + + def to_custom_created_at + DateTimeHelper.to_rfc3339(created_at) + end + + def to_custom_updated_at + DateTimeHelper.to_rfc3339(updated_at) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id}, type: #{@type}, default: #{@default}, name: #{@name},"\ + " pricing_scheme: #{@pricing_scheme}, component_id: #{@component_id}, handle: #{@handle},"\ + " archived_at: #{@archived_at}, created_at: #{@created_at}, updated_at: #{@updated_at},"\ + " prices: #{@prices}, use_site_exchange_rate: #{@use_site_exchange_rate}, subscription_id:"\ + " #{@subscription_id}, tax_included: #{@tax_included}, interval: #{@interval},"\ + " interval_unit: #{@interval_unit}, currency_prices: #{@currency_prices}, overage_prices:"\ + " #{@overage_prices}, overage_pricing_scheme: #{@overage_pricing_scheme},"\ + " renew_prepaid_allocation: #{@renew_prepaid_allocation}, rollover_prepaid_remainder:"\ + " #{@rollover_prepaid_remainder}, expiration_interval: #{@expiration_interval},"\ + " expiration_interval_unit: #{@expiration_interval_unit}, currency_overage_prices:"\ + " #{@currency_overage_prices}, additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id.inspect}, type: #{@type.inspect}, default: #{@default.inspect},"\ + " name: #{@name.inspect}, pricing_scheme: #{@pricing_scheme.inspect}, component_id:"\ + " #{@component_id.inspect}, handle: #{@handle.inspect}, archived_at:"\ + " #{@archived_at.inspect}, created_at: #{@created_at.inspect}, updated_at:"\ + " #{@updated_at.inspect}, prices: #{@prices.inspect}, use_site_exchange_rate:"\ + " #{@use_site_exchange_rate.inspect}, subscription_id: #{@subscription_id.inspect},"\ + " tax_included: #{@tax_included.inspect}, interval: #{@interval.inspect}, interval_unit:"\ + " #{@interval_unit.inspect}, currency_prices: #{@currency_prices.inspect}, overage_prices:"\ + " #{@overage_prices.inspect}, overage_pricing_scheme: #{@overage_pricing_scheme.inspect},"\ + " renew_prepaid_allocation: #{@renew_prepaid_allocation.inspect},"\ + " rollover_prepaid_remainder: #{@rollover_prepaid_remainder.inspect}, expiration_interval:"\ + " #{@expiration_interval.inspect}, expiration_interval_unit:"\ + " #{@expiration_interval_unit.inspect}, currency_overage_prices:"\ + " #{@currency_overage_prices.inspect}, additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/deliver_proforma_invoice_request.rb b/lib/advanced_billing/models/deliver_proforma_invoice_request.rb new file mode 100644 index 00000000..2848421d --- /dev/null +++ b/lib/advanced_billing/models/deliver_proforma_invoice_request.rb @@ -0,0 +1,97 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # DeliverProformaInvoiceRequest Model. + class DeliverProformaInvoiceRequest < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Array[String]] + attr_accessor :recipient_emails + + # TODO: Write general description for this method + # @return [Array[String]] + attr_accessor :cc_recipient_emails + + # TODO: Write general description for this method + # @return [Array[String]] + attr_accessor :bcc_recipient_emails + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['recipient_emails'] = 'recipient_emails' + @_hash['cc_recipient_emails'] = 'cc_recipient_emails' + @_hash['bcc_recipient_emails'] = 'bcc_recipient_emails' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + recipient_emails + cc_recipient_emails + bcc_recipient_emails + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(recipient_emails: SKIP, cc_recipient_emails: SKIP, + bcc_recipient_emails: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @recipient_emails = recipient_emails unless recipient_emails == SKIP + @cc_recipient_emails = cc_recipient_emails unless cc_recipient_emails == SKIP + @bcc_recipient_emails = bcc_recipient_emails unless bcc_recipient_emails == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + recipient_emails = + hash.key?('recipient_emails') ? hash['recipient_emails'] : SKIP + cc_recipient_emails = + hash.key?('cc_recipient_emails') ? hash['cc_recipient_emails'] : SKIP + bcc_recipient_emails = + hash.key?('bcc_recipient_emails') ? hash['bcc_recipient_emails'] : SKIP + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + DeliverProformaInvoiceRequest.new(recipient_emails: recipient_emails, + cc_recipient_emails: cc_recipient_emails, + bcc_recipient_emails: bcc_recipient_emails, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} recipient_emails: #{@recipient_emails}, cc_recipient_emails:"\ + " #{@cc_recipient_emails}, bcc_recipient_emails: #{@bcc_recipient_emails},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} recipient_emails: #{@recipient_emails.inspect}, cc_recipient_emails:"\ + " #{@cc_recipient_emails.inspect}, bcc_recipient_emails: #{@bcc_recipient_emails.inspect},"\ + " additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/downgrade_credit_credit_type.rb b/lib/advanced_billing/models/downgrade_credit_credit_type.rb new file mode 100644 index 00000000..0983555f --- /dev/null +++ b/lib/advanced_billing/models/downgrade_credit_credit_type.rb @@ -0,0 +1,43 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # The type of credit to be created when upgrading/downgrading. Defaults to the + # component and then site setting if one is not provided. Values are: `full` - + # A full price credit is added for the amount owed. `prorated` - A prorated + # credit is added for the amount owed. `none` - No charge is added. + class DowngradeCreditCreditType + DOWNGRADE_CREDIT_CREDIT_TYPE = [ + # TODO: Write general description for FULL + FULL = 'full'.freeze, + + # TODO: Write general description for PRORATED + PRORATED = 'prorated'.freeze, + + # TODO: Write general description for NONE + NONE = 'none'.freeze + ].freeze + + def self.validate(value) + return false if value.nil? + + DOWNGRADE_CREDIT_CREDIT_TYPE.include?(value) + end + + def self.from_value(value, default_value = FULL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'full' then FULL + when 'prorated' then PRORATED + when 'none' then NONE + else + default_value + end + end + end +end diff --git a/lib/advanced_billing/models/nested_subscription_group.rb b/lib/advanced_billing/models/nested_subscription_group.rb index 1a29a3d6..bcaff07b 100644 --- a/lib/advanced_billing/models/nested_subscription_group.rb +++ b/lib/advanced_billing/models/nested_subscription_group.rb @@ -88,16 +88,6 @@ def self.from_hash(hash) additional_properties: additional_properties) end - # Validates an instance of the object from a given value. - # @param [NestedSubscriptionGroup | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true - end - # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last diff --git a/lib/advanced_billing/models/on_off_component.rb b/lib/advanced_billing/models/on_off_component.rb index b521fb0e..e506ac3d 100644 --- a/lib/advanced_billing/models/on_off_component.rb +++ b/lib/advanced_billing/models/on_off_component.rb @@ -32,19 +32,16 @@ class OnOffComponent < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit # 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`. # @return [Array[ComponentPricePointItem]] attr_accessor :price_points diff --git a/lib/advanced_billing/models/prepaid_configuration.rb b/lib/advanced_billing/models/prepaid_configuration.rb index 37316695..090626e5 100644 --- a/lib/advanced_billing/models/prepaid_configuration.rb +++ b/lib/advanced_billing/models/prepaid_configuration.rb @@ -110,16 +110,6 @@ def self.from_hash(hash) additional_properties: additional_properties) end - # Validates an instance of the object from a given value. - # @param [PrepaidConfiguration | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true - end - # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last diff --git a/lib/advanced_billing/models/prepaid_usage_component.rb b/lib/advanced_billing/models/prepaid_usage_component.rb index 80e3bae0..ca41f3cc 100644 --- a/lib/advanced_billing/models/prepaid_usage_component.rb +++ b/lib/advanced_billing/models/prepaid_usage_component.rb @@ -53,19 +53,16 @@ class PrepaidUsageComponent < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit # 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`. # @return [Array[CreatePrepaidUsageComponentPricePoint]] attr_accessor :price_points diff --git a/lib/advanced_billing/models/preview_allocations_request.rb b/lib/advanced_billing/models/preview_allocations_request.rb index 13a6d39f..daa20bcc 100644 --- a/lib/advanced_billing/models/preview_allocations_request.rb +++ b/lib/advanced_billing/models/preview_allocations_request.rb @@ -20,13 +20,11 @@ class PreviewAllocationsRequest < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit diff --git a/lib/advanced_billing/models/product.rb b/lib/advanced_billing/models/product.rb index 625450c2..58046f52 100644 --- a/lib/advanced_billing/models/product.rb +++ b/lib/advanced_billing/models/product.rb @@ -523,16 +523,6 @@ def to_custom_archived_at DateTimeHelper.to_rfc3339(archived_at) end - # Validates an instance of the object from a given value. - # @param [Product | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true - end - # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last diff --git a/lib/advanced_billing/models/product_family.rb b/lib/advanced_billing/models/product_family.rb index cc652fab..d50f3bf9 100644 --- a/lib/advanced_billing/models/product_family.rb +++ b/lib/advanced_billing/models/product_family.rb @@ -38,6 +38,11 @@ class ProductFamily < BaseModel # @return [DateTime] attr_accessor :updated_at + # Timestamp indicating when this product family was archived. `null` if the + # product family is not archived. + # @return [DateTime] + attr_accessor :archived_at + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @@ -48,6 +53,7 @@ def self.names @_hash['description'] = 'description' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' + @_hash['archived_at'] = 'archived_at' @_hash end @@ -61,6 +67,7 @@ def self.optionals description created_at updated_at + archived_at ] end @@ -69,12 +76,13 @@ def self.nullables %w[ accounting_code description + archived_at ] end def initialize(id: SKIP, name: SKIP, handle: SKIP, accounting_code: SKIP, description: SKIP, created_at: SKIP, updated_at: SKIP, - additional_properties: {}) + archived_at: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) @@ -87,6 +95,7 @@ def initialize(id: SKIP, name: SKIP, handle: SKIP, accounting_code: SKIP, @description = description unless description == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP + @archived_at = archived_at unless archived_at == SKIP end # Creates an instance of the object from a hash. @@ -110,6 +119,11 @@ def self.from_hash(hash) else SKIP end + archived_at = if hash.key?('archived_at') + (DateTimeHelper.from_rfc3339(hash['archived_at']) if hash['archived_at']) + else + SKIP + end # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } @@ -122,6 +136,7 @@ def self.from_hash(hash) description: description, created_at: created_at, updated_at: updated_at, + archived_at: archived_at, additional_properties: additional_properties) end @@ -133,14 +148,8 @@ def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end - # Validates an instance of the object from a given value. - # @param [ProductFamily | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true + def to_custom_archived_at + DateTimeHelper.to_rfc3339(archived_at) end # Provides a human-readable string representation of the object. @@ -148,7 +157,8 @@ def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, name: #{@name}, handle: #{@handle}, accounting_code:"\ " #{@accounting_code}, description: #{@description}, created_at: #{@created_at}, updated_at:"\ - " #{@updated_at}, additional_properties: #{get_additional_properties}>" + " #{@updated_at}, archived_at: #{@archived_at}, additional_properties:"\ + " #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. @@ -156,8 +166,8 @@ def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, handle: #{@handle.inspect},"\ " accounting_code: #{@accounting_code.inspect}, description: #{@description.inspect},"\ - " created_at: #{@created_at.inspect}, updated_at: #{@updated_at.inspect},"\ - " additional_properties: #{get_additional_properties}>" + " created_at: #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, archived_at:"\ + " #{@archived_at.inspect}, additional_properties: #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/proforma_invoice.rb b/lib/advanced_billing/models/proforma_invoice.rb index 88699f45..63fe9f1a 100644 --- a/lib/advanced_billing/models/proforma_invoice.rb +++ b/lib/advanced_billing/models/proforma_invoice.rb @@ -217,6 +217,11 @@ class ProformaInvoice < BaseModel # @return [String] attr_accessor :public_url + # Information about the customer who is owner or recipient the invoiced + # subscription. + # @return [AvailableActions] + attr_accessor :available_actions + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @@ -256,6 +261,7 @@ def self.names @_hash['payments'] = 'payments' @_hash['custom_fields'] = 'custom_fields' @_hash['public_url'] = 'public_url' + @_hash['available_actions'] = 'available_actions' @_hash end @@ -298,6 +304,7 @@ def self.optionals payments custom_fields public_url + available_actions ] end @@ -325,7 +332,8 @@ def initialize(uid: SKIP, site_id: SKIP, customer_id: SKIP, paid_amount: SKIP, refund_amount: SKIP, due_amount: SKIP, line_items: SKIP, discounts: SKIP, taxes: SKIP, credits: SKIP, payments: SKIP, custom_fields: SKIP, - public_url: SKIP, additional_properties: {}) + public_url: SKIP, available_actions: SKIP, + additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) @@ -367,6 +375,7 @@ def initialize(uid: SKIP, site_id: SKIP, customer_id: SKIP, @payments = payments unless payments == SKIP @custom_fields = custom_fields unless custom_fields == SKIP @public_url = public_url unless public_url == SKIP + @available_actions = available_actions unless available_actions == SKIP end # Creates an instance of the object from a hash. @@ -478,6 +487,8 @@ def self.from_hash(hash) custom_fields = SKIP unless hash.key?('custom_fields') public_url = hash.key?('public_url') ? hash['public_url'] : SKIP + available_actions = AvailableActions.from_hash(hash['available_actions']) if + hash['available_actions'] # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } @@ -519,6 +530,7 @@ def self.from_hash(hash) payments: payments, custom_fields: custom_fields, public_url: public_url, + available_actions: available_actions, additional_properties: additional_properties) end @@ -542,7 +554,8 @@ def to_s " paid_amount: #{@paid_amount}, refund_amount: #{@refund_amount}, due_amount:"\ " #{@due_amount}, line_items: #{@line_items}, discounts: #{@discounts}, taxes: #{@taxes},"\ " credits: #{@credits}, payments: #{@payments}, custom_fields: #{@custom_fields},"\ - " public_url: #{@public_url}, additional_properties: #{get_additional_properties}>" + " public_url: #{@public_url}, available_actions: #{@available_actions},"\ + " additional_properties: #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. @@ -565,7 +578,8 @@ def inspect " due_amount: #{@due_amount.inspect}, line_items: #{@line_items.inspect}, discounts:"\ " #{@discounts.inspect}, taxes: #{@taxes.inspect}, credits: #{@credits.inspect}, payments:"\ " #{@payments.inspect}, custom_fields: #{@custom_fields.inspect}, public_url:"\ - " #{@public_url.inspect}, additional_properties: #{get_additional_properties}>" + " #{@public_url.inspect}, available_actions: #{@available_actions.inspect},"\ + " additional_properties: #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/public_signup_page.rb b/lib/advanced_billing/models/public_signup_page.rb index 67766060..c2e7d6d0 100644 --- a/lib/advanced_billing/models/public_signup_page.rb +++ b/lib/advanced_billing/models/public_signup_page.rb @@ -88,16 +88,6 @@ def self.from_hash(hash) additional_properties: additional_properties) end - # Validates an instance of the object from a given value. - # @param [PublicSignupPage | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true - end - # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last diff --git a/lib/advanced_billing/models/quantity_based_component.rb b/lib/advanced_billing/models/quantity_based_component.rb index 012b557d..230d7b7f 100644 --- a/lib/advanced_billing/models/quantity_based_component.rb +++ b/lib/advanced_billing/models/quantity_based_component.rb @@ -53,19 +53,16 @@ class QuantityBasedComponent < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit # 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`. # @return [Array[ComponentPricePointItem]] attr_accessor :price_points diff --git a/lib/advanced_billing/models/reactivate_subscription_request.rb b/lib/advanced_billing/models/reactivate_subscription_request.rb index 0396a63e..23bba4ef 100644 --- a/lib/advanced_billing/models/reactivate_subscription_request.rb +++ b/lib/advanced_billing/models/reactivate_subscription_request.rb @@ -27,16 +27,17 @@ class ReactivateSubscriptionRequest < BaseModel # @return [String] attr_accessor :coupon_code - # If true is sent, Chargify will use service credits and prepayments upon - # reactivation. If false is sent, the service credits and prepayments will - # be ignored. + # If true is sent, Advanced Billing will use service credits and prepayments + # upon reactivation. If false is sent, the service credits and prepayments + # will be ignored. # @return [TrueClass | FalseClass] attr_accessor :use_credits_and_prepayments - # If `true`, Chargify will attempt to resume the subscription's billing - # period. if not resumable, the subscription will be reactivated with a new - # billing period. If `false`: Chargify will only attempt to reactivate the - # subscription. + # If `true`, Advanced Billing will attempt to resume the subscription's + # billing period. If not resumable, the subscription will be reactivated + # with a new billing period. If `false` or omitted, Advanced Billing will + # only attempt to reactivate the subscription with a new billing period, + # regardless of whether or not the subscription is resumable. # @return [Object] attr_accessor :resume diff --git a/lib/advanced_billing/models/register.rb b/lib/advanced_billing/models/register.rb new file mode 100644 index 00000000..e39d951f --- /dev/null +++ b/lib/advanced_billing/models/register.rb @@ -0,0 +1,103 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # Register Model. + class Register < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :id + + # TODO: Write general description for this method + # @return [String] + attr_accessor :maxio_id + + # TODO: Write general description for this method + # @return [String] + attr_accessor :name + + # The ISO 4217 currency code (3 character string) representing the currency + # of invoice transaction. + # @return [String] + attr_accessor :currency_code + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['id'] = 'id' + @_hash['maxio_id'] = 'maxio_id' + @_hash['name'] = 'name' + @_hash['currency_code'] = 'currency_code' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + id + maxio_id + name + currency_code + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(id: SKIP, maxio_id: SKIP, name: SKIP, currency_code: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @id = id unless id == SKIP + @maxio_id = maxio_id unless maxio_id == SKIP + @name = name unless name == SKIP + @currency_code = currency_code unless currency_code == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + id = hash.key?('id') ? hash['id'] : SKIP + maxio_id = hash.key?('maxio_id') ? hash['maxio_id'] : SKIP + name = hash.key?('name') ? hash['name'] : SKIP + currency_code = hash.key?('currency_code') ? hash['currency_code'] : SKIP + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + Register.new(id: id, + maxio_id: maxio_id, + name: name, + currency_code: currency_code, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id}, maxio_id: #{@maxio_id}, name: #{@name}, currency_code:"\ + " #{@currency_code}, additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id.inspect}, maxio_id: #{@maxio_id.inspect}, name: #{@name.inspect},"\ + " currency_code: #{@currency_code.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_component_custom_price.rb b/lib/advanced_billing/models/scheduled_renewal_component_custom_price.rb new file mode 100644 index 00000000..ffd9cded --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_component_custom_price.rb @@ -0,0 +1,127 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # Custom pricing for a component within a scheduled renewal. + class ScheduledRenewalComponentCustomPrice < BaseModel + SKIP = Object.new + private_constant :SKIP + + # Whether or not the price point includes tax + # @return [TrueClass | FalseClass] + attr_accessor :tax_included + + # Omit for On/Off components + # @return [PricingScheme] + attr_accessor :pricing_scheme + + # On/off components only need one price bracket starting at 1. + # @return [Array[Price]] + attr_accessor :prices + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['tax_included'] = 'tax_included' + @_hash['pricing_scheme'] = 'pricing_scheme' + @_hash['prices'] = 'prices' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + tax_included + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(pricing_scheme:, prices:, tax_included: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @tax_included = tax_included unless tax_included == SKIP + @pricing_scheme = pricing_scheme + @prices = prices + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + pricing_scheme = + hash.key?('pricing_scheme') ? hash['pricing_scheme'] : nil + # Parameter is an array, so we need to iterate through it + prices = nil + unless hash['prices'].nil? + prices = [] + hash['prices'].each do |structure| + prices << (Price.from_hash(structure) if structure) + end + end + + prices = nil unless hash.key?('prices') + tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalComponentCustomPrice.new(pricing_scheme: pricing_scheme, + prices: prices, + tax_included: tax_included, + additional_properties: additional_properties) + end + + # Validates an instance of the object from a given value. + # @param [ScheduledRenewalComponentCustomPrice | Hash] The value against the validation is performed. + def self.validate(value) + if value.instance_of? self + return ( + APIHelper.valid_type?(value.pricing_scheme, + ->(val) { PricingScheme.validate(val) }) and + APIHelper.valid_type?(value.prices, + ->(val) { Price.validate(val) }, + is_model_hash: true, + is_inner_model_hash: true) + ) + end + + return false unless value.instance_of? Hash + + ( + APIHelper.valid_type?(value['pricing_scheme'], + ->(val) { PricingScheme.validate(val) }) and + APIHelper.valid_type?(value['prices'], + ->(val) { Price.validate(val) }, + is_model_hash: true, + is_inner_model_hash: true) + ) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} tax_included: #{@tax_included}, pricing_scheme: #{@pricing_scheme}, prices:"\ + " #{@prices}, additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} tax_included: #{@tax_included.inspect}, pricing_scheme:"\ + " #{@pricing_scheme.inspect}, prices: #{@prices.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration.rb b/lib/advanced_billing/models/scheduled_renewal_configuration.rb new file mode 100644 index 00000000..7ec83197 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration.rb @@ -0,0 +1,212 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +require 'date' +module AdvancedBilling + # ScheduledRenewalConfiguration Model. + class ScheduledRenewalConfiguration < BaseModel + SKIP = Object.new + private_constant :SKIP + + # ID of the renewal. + # @return [Integer] + attr_accessor :id + + # ID of the site to which the renewal belongs. + # @return [Integer] + attr_accessor :site_id + + # The id of the subscription. + # @return [Integer] + attr_accessor :subscription_id + + # The id of the subscription. + # @return [DateTime] + attr_accessor :starts_at + + # The id of the subscription. + # @return [DateTime] + attr_accessor :ends_at + + # The id of the subscription. + # @return [DateTime] + attr_accessor :lock_in_at + + # The id of the subscription. + # @return [DateTime] + attr_accessor :created_at + + # The id of the subscription. + # @return [String] + attr_accessor :status + + # The id of the subscription. + # @return [Array[ScheduledRenewalConfigurationItem]] + attr_accessor :scheduled_renewal_configuration_items + + # Contract linked to the scheduled renewal configuration. + # @return [Contract] + attr_accessor :contract + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['id'] = 'id' + @_hash['site_id'] = 'site_id' + @_hash['subscription_id'] = 'subscription_id' + @_hash['starts_at'] = 'starts_at' + @_hash['ends_at'] = 'ends_at' + @_hash['lock_in_at'] = 'lock_in_at' + @_hash['created_at'] = 'created_at' + @_hash['status'] = 'status' + @_hash['scheduled_renewal_configuration_items'] = + 'scheduled_renewal_configuration_items' + @_hash['contract'] = 'contract' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + id + site_id + subscription_id + starts_at + ends_at + lock_in_at + created_at + status + scheduled_renewal_configuration_items + contract + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(id: SKIP, site_id: SKIP, subscription_id: SKIP, + starts_at: SKIP, ends_at: SKIP, lock_in_at: SKIP, + created_at: SKIP, status: SKIP, + scheduled_renewal_configuration_items: SKIP, contract: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @id = id unless id == SKIP + @site_id = site_id unless site_id == SKIP + @subscription_id = subscription_id unless subscription_id == SKIP + @starts_at = starts_at unless starts_at == SKIP + @ends_at = ends_at unless ends_at == SKIP + @lock_in_at = lock_in_at unless lock_in_at == SKIP + @created_at = created_at unless created_at == SKIP + @status = status unless status == SKIP + unless scheduled_renewal_configuration_items == SKIP + @scheduled_renewal_configuration_items = + scheduled_renewal_configuration_items + end + @contract = contract unless contract == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + id = hash.key?('id') ? hash['id'] : SKIP + site_id = hash.key?('site_id') ? hash['site_id'] : SKIP + subscription_id = + hash.key?('subscription_id') ? hash['subscription_id'] : SKIP + starts_at = if hash.key?('starts_at') + (DateTimeHelper.from_rfc3339(hash['starts_at']) if hash['starts_at']) + else + SKIP + end + ends_at = if hash.key?('ends_at') + (DateTimeHelper.from_rfc3339(hash['ends_at']) if hash['ends_at']) + else + SKIP + end + lock_in_at = if hash.key?('lock_in_at') + (DateTimeHelper.from_rfc3339(hash['lock_in_at']) if hash['lock_in_at']) + else + SKIP + end + created_at = if hash.key?('created_at') + (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) + else + SKIP + end + status = hash.key?('status') ? hash['status'] : SKIP + # Parameter is an array, so we need to iterate through it + scheduled_renewal_configuration_items = nil + unless hash['scheduled_renewal_configuration_items'].nil? + scheduled_renewal_configuration_items = [] + hash['scheduled_renewal_configuration_items'].each do |structure| + scheduled_renewal_configuration_items << (ScheduledRenewalConfigurationItem.from_hash(structure) if structure) + end + end + + scheduled_renewal_configuration_items = SKIP unless hash.key?('scheduled_renewal_configuration_items') + contract = Contract.from_hash(hash['contract']) if hash['contract'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfiguration.new(id: id, + site_id: site_id, + subscription_id: subscription_id, + starts_at: starts_at, + ends_at: ends_at, + lock_in_at: lock_in_at, + created_at: created_at, + status: status, + scheduled_renewal_configuration_items: scheduled_renewal_configuration_items, + contract: contract, + additional_properties: additional_properties) + end + + def to_custom_starts_at + DateTimeHelper.to_rfc3339(starts_at) + end + + def to_custom_ends_at + DateTimeHelper.to_rfc3339(ends_at) + end + + def to_custom_lock_in_at + DateTimeHelper.to_rfc3339(lock_in_at) + end + + def to_custom_created_at + DateTimeHelper.to_rfc3339(created_at) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id}, site_id: #{@site_id}, subscription_id: #{@subscription_id},"\ + " starts_at: #{@starts_at}, ends_at: #{@ends_at}, lock_in_at: #{@lock_in_at}, created_at:"\ + " #{@created_at}, status: #{@status}, scheduled_renewal_configuration_items:"\ + " #{@scheduled_renewal_configuration_items}, contract: #{@contract}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id.inspect}, site_id: #{@site_id.inspect}, subscription_id:"\ + " #{@subscription_id.inspect}, starts_at: #{@starts_at.inspect}, ends_at:"\ + " #{@ends_at.inspect}, lock_in_at: #{@lock_in_at.inspect}, created_at:"\ + " #{@created_at.inspect}, status: #{@status.inspect}, scheduled_renewal_configuration_items:"\ + " #{@scheduled_renewal_configuration_items.inspect}, contract: #{@contract.inspect},"\ + " additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration_item.rb b/lib/advanced_billing/models/scheduled_renewal_configuration_item.rb new file mode 100644 index 00000000..f2d60245 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration_item.rb @@ -0,0 +1,195 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +require 'date' +module AdvancedBilling + # ScheduledRenewalConfigurationItem Model. + class ScheduledRenewalConfigurationItem < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :id + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :subscription_id + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :subscription_renewal_configuration_id + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :item_id + + # TODO: Write general description for this method + # @return [String] + attr_accessor :item_type + + # TODO: Write general description for this method + # @return [String] + attr_accessor :item_subclass + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :price_point_id + + # TODO: Write general description for this method + # @return [String] + attr_accessor :price_point_type + + # TODO: Write general description for this method + # @return [Integer] + attr_accessor :quantity + + # TODO: Write general description for this method + # @return [String] + attr_accessor :decimal_quantity + + # TODO: Write general description for this method + # @return [DateTime] + attr_accessor :created_at + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['id'] = 'id' + @_hash['subscription_id'] = 'subscription_id' + @_hash['subscription_renewal_configuration_id'] = + 'subscription_renewal_configuration_id' + @_hash['item_id'] = 'item_id' + @_hash['item_type'] = 'item_type' + @_hash['item_subclass'] = 'item_subclass' + @_hash['price_point_id'] = 'price_point_id' + @_hash['price_point_type'] = 'price_point_type' + @_hash['quantity'] = 'quantity' + @_hash['decimal_quantity'] = 'decimal_quantity' + @_hash['created_at'] = 'created_at' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + id + subscription_id + subscription_renewal_configuration_id + item_id + item_type + item_subclass + price_point_id + price_point_type + quantity + decimal_quantity + created_at + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(id: SKIP, subscription_id: SKIP, + subscription_renewal_configuration_id: SKIP, item_id: SKIP, + item_type: SKIP, item_subclass: SKIP, price_point_id: SKIP, + price_point_type: SKIP, quantity: SKIP, + decimal_quantity: SKIP, created_at: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @id = id unless id == SKIP + @subscription_id = subscription_id unless subscription_id == SKIP + unless subscription_renewal_configuration_id == SKIP + @subscription_renewal_configuration_id = + subscription_renewal_configuration_id + end + @item_id = item_id unless item_id == SKIP + @item_type = item_type unless item_type == SKIP + @item_subclass = item_subclass unless item_subclass == SKIP + @price_point_id = price_point_id unless price_point_id == SKIP + @price_point_type = price_point_type unless price_point_type == SKIP + @quantity = quantity unless quantity == SKIP + @decimal_quantity = decimal_quantity unless decimal_quantity == SKIP + @created_at = created_at unless created_at == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + id = hash.key?('id') ? hash['id'] : SKIP + subscription_id = + hash.key?('subscription_id') ? hash['subscription_id'] : SKIP + subscription_renewal_configuration_id = + hash.key?('subscription_renewal_configuration_id') ? hash['subscription_renewal_configuration_id'] : SKIP + item_id = hash.key?('item_id') ? hash['item_id'] : SKIP + item_type = hash.key?('item_type') ? hash['item_type'] : SKIP + item_subclass = hash.key?('item_subclass') ? hash['item_subclass'] : SKIP + price_point_id = + hash.key?('price_point_id') ? hash['price_point_id'] : SKIP + price_point_type = + hash.key?('price_point_type') ? hash['price_point_type'] : SKIP + quantity = hash.key?('quantity') ? hash['quantity'] : SKIP + decimal_quantity = + hash.key?('decimal_quantity') ? hash['decimal_quantity'] : SKIP + created_at = if hash.key?('created_at') + (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) + else + SKIP + end + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationItem.new(id: id, + subscription_id: subscription_id, + subscription_renewal_configuration_id: subscription_renewal_configuration_id, + item_id: item_id, + item_type: item_type, + item_subclass: item_subclass, + price_point_id: price_point_id, + price_point_type: price_point_type, + quantity: quantity, + decimal_quantity: decimal_quantity, + created_at: created_at, + additional_properties: additional_properties) + end + + def to_custom_created_at + DateTimeHelper.to_rfc3339(created_at) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id}, subscription_id: #{@subscription_id},"\ + " subscription_renewal_configuration_id: #{@subscription_renewal_configuration_id}, item_id:"\ + " #{@item_id}, item_type: #{@item_type}, item_subclass: #{@item_subclass}, price_point_id:"\ + " #{@price_point_id}, price_point_type: #{@price_point_type}, quantity: #{@quantity},"\ + " decimal_quantity: #{@decimal_quantity}, created_at: #{@created_at}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} id: #{@id.inspect}, subscription_id: #{@subscription_id.inspect},"\ + " subscription_renewal_configuration_id: #{@subscription_renewal_configuration_id.inspect},"\ + " item_id: #{@item_id.inspect}, item_type: #{@item_type.inspect}, item_subclass:"\ + " #{@item_subclass.inspect}, price_point_id: #{@price_point_id.inspect}, price_point_type:"\ + " #{@price_point_type.inspect}, quantity: #{@quantity.inspect}, decimal_quantity:"\ + " #{@decimal_quantity.inspect}, created_at: #{@created_at.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration_item_request.rb b/lib/advanced_billing/models/scheduled_renewal_configuration_item_request.rb new file mode 100644 index 00000000..ae066acf --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration_item_request.rb @@ -0,0 +1,87 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalConfigurationItemRequest Model. + class ScheduledRenewalConfigurationItemRequest < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Object] + attr_accessor :renewal_configuration_item + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['renewal_configuration_item'] = 'renewal_configuration_item' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(renewal_configuration_item:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @renewal_configuration_item = renewal_configuration_item + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + renewal_configuration_item = hash.key?('renewal_configuration_item') ? APIHelper.deserialize_union_type( + UnionTypeLookUp.get(:ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem), hash['renewal_configuration_item'] + ) : nil + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationItemRequest.new(renewal_configuration_item: renewal_configuration_item, + additional_properties: additional_properties) + end + + # Validates an instance of the object from a given value. + # @param [ScheduledRenewalConfigurationItemRequest | Hash] The value against the validation is performed. + def self.validate(value) + if value.instance_of? self + return UnionTypeLookUp.get(:ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem) + .validate(value.renewal_configuration_item) + end + + return false unless value.instance_of? Hash + + UnionTypeLookUp.get(:ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem) + .validate(value['renewal_configuration_item']) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} renewal_configuration_item: #{@renewal_configuration_item},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} renewal_configuration_item: #{@renewal_configuration_item.inspect},"\ + " additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration_item_response.rb b/lib/advanced_billing/models/scheduled_renewal_configuration_item_response.rb new file mode 100644 index 00000000..4f44ffe9 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration_item_response.rb @@ -0,0 +1,82 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalConfigurationItemResponse Model. + class ScheduledRenewalConfigurationItemResponse < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [ScheduledRenewalConfigurationItem] + attr_accessor :scheduled_renewal_configuration_item + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['scheduled_renewal_configuration_item'] = + 'scheduled_renewal_configuration_item' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + scheduled_renewal_configuration_item + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(scheduled_renewal_configuration_item: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + unless scheduled_renewal_configuration_item == SKIP + @scheduled_renewal_configuration_item = + scheduled_renewal_configuration_item + end + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + if hash['scheduled_renewal_configuration_item'] + scheduled_renewal_configuration_item = ScheduledRenewalConfigurationItem.from_hash(hash['scheduled_renewal_configuration_item']) + end + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationItemResponse.new(scheduled_renewal_configuration_item: scheduled_renewal_configuration_item, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} scheduled_renewal_configuration_item:"\ + " #{@scheduled_renewal_configuration_item}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} scheduled_renewal_configuration_item:"\ + " #{@scheduled_renewal_configuration_item.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration_request.rb b/lib/advanced_billing/models/scheduled_renewal_configuration_request.rb new file mode 100644 index 00000000..728199d7 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration_request.rb @@ -0,0 +1,73 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalConfigurationRequest Model. + class ScheduledRenewalConfigurationRequest < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [ScheduledRenewalConfigurationRequestBody] + attr_accessor :renewal_configuration + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['renewal_configuration'] = 'renewal_configuration' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(renewal_configuration:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @renewal_configuration = renewal_configuration + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + if hash['renewal_configuration'] + renewal_configuration = ScheduledRenewalConfigurationRequestBody.from_hash(hash['renewal_configuration']) + end + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationRequest.new(renewal_configuration: renewal_configuration, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} renewal_configuration: #{@renewal_configuration}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} renewal_configuration: #{@renewal_configuration.inspect},"\ + " additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration_request_body.rb b/lib/advanced_billing/models/scheduled_renewal_configuration_request_body.rb new file mode 100644 index 00000000..5f2f2070 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration_request_body.rb @@ -0,0 +1,141 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +require 'date' +module AdvancedBilling + # ScheduledRenewalConfigurationRequestBody Model. + class ScheduledRenewalConfigurationRequestBody < BaseModel + SKIP = Object.new + private_constant :SKIP + + # (Optional) Start of the renewal term. + # @return [DateTime] + attr_accessor :starts_at + + # (Optional) End of the renewal term. + # @return [DateTime] + attr_accessor :ends_at + + # (Optional) Lock-in date for the renewal. + # @return [DateTime] + attr_accessor :lock_in_at + + # (Optional) Existing contract to associate with the scheduled renewal. + # Contracts must be enabled for your site. + # @return [Integer] + attr_accessor :contract_id + + # (Optional) Set to true to create a new contract when contracts are + # enabled. Contracts must be enabled for your site. + # @return [TrueClass | FalseClass] + attr_accessor :create_new_contract + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['starts_at'] = 'starts_at' + @_hash['ends_at'] = 'ends_at' + @_hash['lock_in_at'] = 'lock_in_at' + @_hash['contract_id'] = 'contract_id' + @_hash['create_new_contract'] = 'create_new_contract' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + starts_at + ends_at + lock_in_at + contract_id + create_new_contract + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(starts_at: SKIP, ends_at: SKIP, lock_in_at: SKIP, + contract_id: SKIP, create_new_contract: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @starts_at = starts_at unless starts_at == SKIP + @ends_at = ends_at unless ends_at == SKIP + @lock_in_at = lock_in_at unless lock_in_at == SKIP + @contract_id = contract_id unless contract_id == SKIP + @create_new_contract = create_new_contract unless create_new_contract == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + starts_at = if hash.key?('starts_at') + (DateTimeHelper.from_rfc3339(hash['starts_at']) if hash['starts_at']) + else + SKIP + end + ends_at = if hash.key?('ends_at') + (DateTimeHelper.from_rfc3339(hash['ends_at']) if hash['ends_at']) + else + SKIP + end + lock_in_at = if hash.key?('lock_in_at') + (DateTimeHelper.from_rfc3339(hash['lock_in_at']) if hash['lock_in_at']) + else + SKIP + end + contract_id = hash.key?('contract_id') ? hash['contract_id'] : SKIP + create_new_contract = + hash.key?('create_new_contract') ? hash['create_new_contract'] : SKIP + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationRequestBody.new(starts_at: starts_at, + ends_at: ends_at, + lock_in_at: lock_in_at, + contract_id: contract_id, + create_new_contract: create_new_contract, + additional_properties: additional_properties) + end + + def to_custom_starts_at + DateTimeHelper.to_rfc3339(starts_at) + end + + def to_custom_ends_at + DateTimeHelper.to_rfc3339(ends_at) + end + + def to_custom_lock_in_at + DateTimeHelper.to_rfc3339(lock_in_at) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} starts_at: #{@starts_at}, ends_at: #{@ends_at}, lock_in_at: #{@lock_in_at},"\ + " contract_id: #{@contract_id}, create_new_contract: #{@create_new_contract},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} starts_at: #{@starts_at.inspect}, ends_at: #{@ends_at.inspect}, lock_in_at:"\ + " #{@lock_in_at.inspect}, contract_id: #{@contract_id.inspect}, create_new_contract:"\ + " #{@create_new_contract.inspect}, additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configuration_response.rb b/lib/advanced_billing/models/scheduled_renewal_configuration_response.rb new file mode 100644 index 00000000..68c367f2 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configuration_response.rb @@ -0,0 +1,81 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalConfigurationResponse Model. + class ScheduledRenewalConfigurationResponse < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [ScheduledRenewalConfiguration] + attr_accessor :scheduled_renewal_configuration + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['scheduled_renewal_configuration'] = + 'scheduled_renewal_configuration' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + scheduled_renewal_configuration + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(scheduled_renewal_configuration: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + unless scheduled_renewal_configuration == SKIP + @scheduled_renewal_configuration = + scheduled_renewal_configuration + end + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + if hash['scheduled_renewal_configuration'] + scheduled_renewal_configuration = ScheduledRenewalConfiguration.from_hash(hash['scheduled_renewal_configuration']) + end + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationResponse.new(scheduled_renewal_configuration: scheduled_renewal_configuration, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} scheduled_renewal_configuration: #{@scheduled_renewal_configuration},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} scheduled_renewal_configuration:"\ + " #{@scheduled_renewal_configuration.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_configurations_response.rb b/lib/advanced_billing/models/scheduled_renewal_configurations_response.rb new file mode 100644 index 00000000..b5b2c9b8 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_configurations_response.rb @@ -0,0 +1,88 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalConfigurationsResponse Model. + class ScheduledRenewalConfigurationsResponse < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Array[ScheduledRenewalConfiguration]] + attr_accessor :scheduled_renewal_configurations + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['scheduled_renewal_configurations'] = + 'scheduled_renewal_configurations' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + scheduled_renewal_configurations + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(scheduled_renewal_configurations: SKIP, + additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + unless scheduled_renewal_configurations == SKIP + @scheduled_renewal_configurations = + scheduled_renewal_configurations + end + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + # Parameter is an array, so we need to iterate through it + scheduled_renewal_configurations = nil + unless hash['scheduled_renewal_configurations'].nil? + scheduled_renewal_configurations = [] + hash['scheduled_renewal_configurations'].each do |structure| + scheduled_renewal_configurations << (ScheduledRenewalConfiguration.from_hash(structure) if structure) + end + end + + scheduled_renewal_configurations = SKIP unless hash.key?('scheduled_renewal_configurations') + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalConfigurationsResponse.new(scheduled_renewal_configurations: scheduled_renewal_configurations, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} scheduled_renewal_configurations: #{@scheduled_renewal_configurations},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} scheduled_renewal_configurations:"\ + " #{@scheduled_renewal_configurations.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_item_request_body_component.rb b/lib/advanced_billing/models/scheduled_renewal_item_request_body_component.rb new file mode 100644 index 00000000..14398779 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_item_request_body_component.rb @@ -0,0 +1,132 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalItemRequestBodyComponent Model. + class ScheduledRenewalItemRequestBodyComponent < BaseModel + SKIP = Object.new + private_constant :SKIP + + # Item type to add. Either Product or Component. + # @return [String] + attr_reader :item_type + + # Product or component identifier. + # @return [Integer] + attr_accessor :item_id + + # Price point identifier. + # @return [Integer] + attr_accessor :price_point_id + + # Optional quantity for the item. + # @return [Integer] + attr_accessor :quantity + + # Custom pricing for a component within a scheduled renewal. + # @return [ScheduledRenewalComponentCustomPrice] + attr_accessor :custom_price + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['item_type'] = 'item_type' + @_hash['item_id'] = 'item_id' + @_hash['price_point_id'] = 'price_point_id' + @_hash['quantity'] = 'quantity' + @_hash['custom_price'] = 'custom_price' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + price_point_id + quantity + custom_price + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(item_id:, price_point_id: SKIP, quantity: SKIP, + custom_price: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @item_type = 'Component' + @item_id = item_id + @price_point_id = price_point_id unless price_point_id == SKIP + @quantity = quantity unless quantity == SKIP + @custom_price = custom_price unless custom_price == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + item_id = hash.key?('item_id') ? hash['item_id'] : nil + price_point_id = + hash.key?('price_point_id') ? hash['price_point_id'] : SKIP + quantity = hash.key?('quantity') ? hash['quantity'] : SKIP + custom_price = ScheduledRenewalComponentCustomPrice.from_hash(hash['custom_price']) if + hash['custom_price'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalItemRequestBodyComponent.new(item_id: item_id, + price_point_id: price_point_id, + quantity: quantity, + custom_price: custom_price, + additional_properties: additional_properties) + end + + # Validates an instance of the object from a given value. + # @param [ScheduledRenewalItemRequestBodyComponent | Hash] The value against the validation is performed. + def self.validate(value) + if value.instance_of? self + return ( + APIHelper.valid_type?(value.item_type, + ->(val) { val.instance_of? String }) and + APIHelper.valid_type?(value.item_id, + ->(val) { val.instance_of? Integer }) + ) + end + + return false unless value.instance_of? Hash + + ( + APIHelper.valid_type?(value['item_type'], + ->(val) { val.instance_of? String }) and + APIHelper.valid_type?(value['item_id'], + ->(val) { val.instance_of? Integer }) + ) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} item_type: #{@item_type}, item_id: #{@item_id}, price_point_id:"\ + " #{@price_point_id}, quantity: #{@quantity}, custom_price: #{@custom_price},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} item_type: #{@item_type.inspect}, item_id: #{@item_id.inspect},"\ + " price_point_id: #{@price_point_id.inspect}, quantity: #{@quantity.inspect}, custom_price:"\ + " #{@custom_price.inspect}, additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_item_request_body_product.rb b/lib/advanced_billing/models/scheduled_renewal_item_request_body_product.rb new file mode 100644 index 00000000..13f55294 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_item_request_body_product.rb @@ -0,0 +1,132 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalItemRequestBodyProduct Model. + class ScheduledRenewalItemRequestBodyProduct < BaseModel + SKIP = Object.new + private_constant :SKIP + + # Item type to add. Either Product or Component. + # @return [String] + attr_reader :item_type + + # Product or component identifier. + # @return [Integer] + attr_accessor :item_id + + # Price point identifier. + # @return [Integer] + attr_accessor :price_point_id + + # Optional quantity for the item. + # @return [Integer] + attr_accessor :quantity + + # Custom pricing for a product within a scheduled renewal. + # @return [ScheduledRenewalProductPricePoint] + attr_accessor :custom_price + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['item_type'] = 'item_type' + @_hash['item_id'] = 'item_id' + @_hash['price_point_id'] = 'price_point_id' + @_hash['quantity'] = 'quantity' + @_hash['custom_price'] = 'custom_price' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + price_point_id + quantity + custom_price + ] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(item_id:, price_point_id: SKIP, quantity: SKIP, + custom_price: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @item_type = 'Product' + @item_id = item_id + @price_point_id = price_point_id unless price_point_id == SKIP + @quantity = quantity unless quantity == SKIP + @custom_price = custom_price unless custom_price == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + item_id = hash.key?('item_id') ? hash['item_id'] : nil + price_point_id = + hash.key?('price_point_id') ? hash['price_point_id'] : SKIP + quantity = hash.key?('quantity') ? hash['quantity'] : SKIP + custom_price = ScheduledRenewalProductPricePoint.from_hash(hash['custom_price']) if + hash['custom_price'] + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalItemRequestBodyProduct.new(item_id: item_id, + price_point_id: price_point_id, + quantity: quantity, + custom_price: custom_price, + additional_properties: additional_properties) + end + + # Validates an instance of the object from a given value. + # @param [ScheduledRenewalItemRequestBodyProduct | Hash] The value against the validation is performed. + def self.validate(value) + if value.instance_of? self + return ( + APIHelper.valid_type?(value.item_type, + ->(val) { val.instance_of? String }) and + APIHelper.valid_type?(value.item_id, + ->(val) { val.instance_of? Integer }) + ) + end + + return false unless value.instance_of? Hash + + ( + APIHelper.valid_type?(value['item_type'], + ->(val) { val.instance_of? String }) and + APIHelper.valid_type?(value['item_id'], + ->(val) { val.instance_of? Integer }) + ) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} item_type: #{@item_type}, item_id: #{@item_id}, price_point_id:"\ + " #{@price_point_id}, quantity: #{@quantity}, custom_price: #{@custom_price},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} item_type: #{@item_type.inspect}, item_id: #{@item_id.inspect},"\ + " price_point_id: #{@price_point_id.inspect}, quantity: #{@quantity.inspect}, custom_price:"\ + " #{@custom_price.inspect}, additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_lock_in_request.rb b/lib/advanced_billing/models/scheduled_renewal_lock_in_request.rb new file mode 100644 index 00000000..37a51784 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_lock_in_request.rb @@ -0,0 +1,71 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalLockInRequest Model. + class ScheduledRenewalLockInRequest < BaseModel + SKIP = Object.new + private_constant :SKIP + + # Date to lock in the renewal. + # @return [Date] + attr_accessor :lock_in_at + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['lock_in_at'] = 'lock_in_at' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(lock_in_at:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @lock_in_at = lock_in_at + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + lock_in_at = hash.key?('lock_in_at') ? hash['lock_in_at'] : nil + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalLockInRequest.new(lock_in_at: lock_in_at, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} lock_in_at: #{@lock_in_at}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} lock_in_at: #{@lock_in_at.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_product_price_point.rb b/lib/advanced_billing/models/scheduled_renewal_product_price_point.rb new file mode 100644 index 00000000..7e8ddd18 --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_product_price_point.rb @@ -0,0 +1,192 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # Custom pricing for a product within a scheduled renewal. + class ScheduledRenewalProductPricePoint < BaseModel + SKIP = Object.new + private_constant :SKIP + + # (Optional) + # @return [String] + attr_accessor :name + + # (Optional) + # @return [String] + attr_accessor :handle + + # Required if using `custom_price` attribute. + # @return [Object] + attr_accessor :price_in_cents + + # Required if using `custom_price` attribute. + # @return [Object] + attr_accessor :interval + + # Required if using `custom_price` attribute. + # @return [IntervalUnit] + attr_accessor :interval_unit + + # (Optional) + # @return [TrueClass | FalseClass] + attr_accessor :tax_included + + # The product price point initial charge, in integer cents. + # @return [Integer] + attr_accessor :initial_charge_in_cents + + # 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. + # @return [Integer] + attr_accessor :expiration_interval + + # A string representing the expiration interval unit for this product price + # point, either month, day or never + # @return [ExpirationIntervalUnit] + attr_accessor :expiration_interval_unit + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['name'] = 'name' + @_hash['handle'] = 'handle' + @_hash['price_in_cents'] = 'price_in_cents' + @_hash['interval'] = 'interval' + @_hash['interval_unit'] = 'interval_unit' + @_hash['tax_included'] = 'tax_included' + @_hash['initial_charge_in_cents'] = 'initial_charge_in_cents' + @_hash['expiration_interval'] = 'expiration_interval' + @_hash['expiration_interval_unit'] = 'expiration_interval_unit' + @_hash + end + + # An array for optional fields + def self.optionals + %w[ + name + handle + tax_included + initial_charge_in_cents + expiration_interval + expiration_interval_unit + ] + end + + # An array for nullable fields + def self.nullables + %w[ + interval_unit + expiration_interval_unit + ] + end + + def initialize(price_in_cents:, interval:, interval_unit:, name: SKIP, + handle: SKIP, tax_included: SKIP, + initial_charge_in_cents: SKIP, expiration_interval: SKIP, + expiration_interval_unit: SKIP, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @name = name unless name == SKIP + @handle = handle unless handle == SKIP + @price_in_cents = price_in_cents + @interval = interval + @interval_unit = interval_unit + @tax_included = tax_included unless tax_included == SKIP + @initial_charge_in_cents = initial_charge_in_cents unless initial_charge_in_cents == SKIP + @expiration_interval = expiration_interval unless expiration_interval == SKIP + @expiration_interval_unit = expiration_interval_unit unless expiration_interval_unit == SKIP + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + price_in_cents = hash.key?('price_in_cents') ? APIHelper.deserialize_union_type( + UnionTypeLookUp.get(:ScheduledRenewalProductPricePointPriceInCents), hash['price_in_cents'] + ) : nil + interval = hash.key?('interval') ? APIHelper.deserialize_union_type( + UnionTypeLookUp.get(:ScheduledRenewalProductPricePointInterval), hash['interval'] + ) : nil + interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : nil + name = hash.key?('name') ? hash['name'] : SKIP + handle = hash.key?('handle') ? hash['handle'] : SKIP + tax_included = hash.key?('tax_included') ? hash['tax_included'] : SKIP + initial_charge_in_cents = + hash.key?('initial_charge_in_cents') ? hash['initial_charge_in_cents'] : SKIP + expiration_interval = + hash.key?('expiration_interval') ? hash['expiration_interval'] : SKIP + expiration_interval_unit = + hash.key?('expiration_interval_unit') ? hash['expiration_interval_unit'] : SKIP + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalProductPricePoint.new(price_in_cents: price_in_cents, + interval: interval, + interval_unit: interval_unit, + name: name, + handle: handle, + tax_included: tax_included, + initial_charge_in_cents: initial_charge_in_cents, + expiration_interval: expiration_interval, + expiration_interval_unit: expiration_interval_unit, + additional_properties: additional_properties) + end + + # Validates an instance of the object from a given value. + # @param [ScheduledRenewalProductPricePoint | Hash] The value against the validation is performed. + def self.validate(value) + if value.instance_of? self + return ( + UnionTypeLookUp.get(:ScheduledRenewalProductPricePointPriceInCents) + .validate(value.price_in_cents) and + UnionTypeLookUp.get(:ScheduledRenewalProductPricePointInterval) + .validate(value.interval) and + APIHelper.valid_type?(value.interval_unit, + ->(val) { IntervalUnit.validate(val) }) + ) + end + + return false unless value.instance_of? Hash + + ( + UnionTypeLookUp.get(:ScheduledRenewalProductPricePointPriceInCents) + .validate(value['price_in_cents']) and + UnionTypeLookUp.get(:ScheduledRenewalProductPricePointInterval) + .validate(value['interval']) and + APIHelper.valid_type?(value['interval_unit'], + ->(val) { IntervalUnit.validate(val) }) + ) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} name: #{@name}, handle: #{@handle}, price_in_cents: #{@price_in_cents},"\ + " interval: #{@interval}, interval_unit: #{@interval_unit}, tax_included: #{@tax_included},"\ + " initial_charge_in_cents: #{@initial_charge_in_cents}, expiration_interval:"\ + " #{@expiration_interval}, expiration_interval_unit: #{@expiration_interval_unit},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} name: #{@name.inspect}, handle: #{@handle.inspect}, price_in_cents:"\ + " #{@price_in_cents.inspect}, interval: #{@interval.inspect}, interval_unit:"\ + " #{@interval_unit.inspect}, tax_included: #{@tax_included.inspect},"\ + " initial_charge_in_cents: #{@initial_charge_in_cents.inspect}, expiration_interval:"\ + " #{@expiration_interval.inspect}, expiration_interval_unit:"\ + " #{@expiration_interval_unit.inspect}, additional_properties:"\ + " #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/scheduled_renewal_update_request.rb b/lib/advanced_billing/models/scheduled_renewal_update_request.rb new file mode 100644 index 00000000..d36692ce --- /dev/null +++ b/lib/advanced_billing/models/scheduled_renewal_update_request.rb @@ -0,0 +1,87 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # ScheduledRenewalUpdateRequest Model. + class ScheduledRenewalUpdateRequest < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [Object] + attr_accessor :renewal_configuration_item + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['renewal_configuration_item'] = 'renewal_configuration_item' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(renewal_configuration_item:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @renewal_configuration_item = renewal_configuration_item + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + renewal_configuration_item = hash.key?('renewal_configuration_item') ? APIHelper.deserialize_union_type( + UnionTypeLookUp.get(:ScheduledRenewalUpdateRequestRenewalConfigurationItem), hash['renewal_configuration_item'] + ) : nil + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + ScheduledRenewalUpdateRequest.new(renewal_configuration_item: renewal_configuration_item, + additional_properties: additional_properties) + end + + # Validates an instance of the object from a given value. + # @param [ScheduledRenewalUpdateRequest | Hash] The value against the validation is performed. + def self.validate(value) + if value.instance_of? self + return UnionTypeLookUp.get(:ScheduledRenewalUpdateRequestRenewalConfigurationItem) + .validate(value.renewal_configuration_item) + end + + return false unless value.instance_of? Hash + + UnionTypeLookUp.get(:ScheduledRenewalUpdateRequestRenewalConfigurationItem) + .validate(value['renewal_configuration_item']) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} renewal_configuration_item: #{@renewal_configuration_item},"\ + " additional_properties: #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} renewal_configuration_item: #{@renewal_configuration_item.inspect},"\ + " additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/send_email.rb b/lib/advanced_billing/models/send_email.rb new file mode 100644 index 00000000..397e3b99 --- /dev/null +++ b/lib/advanced_billing/models/send_email.rb @@ -0,0 +1,79 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # SendEmail Model. + class SendEmail < BaseModel + SKIP = Object.new + private_constant :SKIP + + # TODO: Write general description for this method + # @return [TrueClass | FalseClass] + attr_accessor :can_execute + + # TODO: Write general description for this method + # @return [String] + attr_accessor :url + + # A mapping from model property names to API property names. + def self.names + @_hash = {} if @_hash.nil? + @_hash['can_execute'] = 'can_execute' + @_hash['url'] = 'url' + @_hash + end + + # An array for optional fields + def self.optionals + [] + end + + # An array for nullable fields + def self.nullables + [] + end + + def initialize(can_execute:, url:, additional_properties: {}) + # Add additional model properties to the instance. + additional_properties.each do |_name, _value| + instance_variable_set("@#{_name}", _value) + end + + @can_execute = can_execute + @url = url + end + + # Creates an instance of the object from a hash. + def self.from_hash(hash) + return nil unless hash + + # Extract variables from the hash. + can_execute = hash.key?('can_execute') ? hash['can_execute'] : nil + url = hash.key?('url') ? hash['url'] : nil + + # Clean out expected properties from Hash. + additional_properties = hash.reject { |k, _| names.value?(k) } + + # Create object from extracted values. + SendEmail.new(can_execute: can_execute, + url: url, + additional_properties: additional_properties) + end + + # Provides a human-readable string representation of the object. + def to_s + class_name = self.class.name.split('::').last + "<#{class_name} can_execute: #{@can_execute}, url: #{@url}, additional_properties:"\ + " #{get_additional_properties}>" + end + + # Provides a debugging-friendly string with detailed object information. + def inspect + class_name = self.class.name.split('::').last + "<#{class_name} can_execute: #{@can_execute.inspect}, url: #{@url.inspect},"\ + " additional_properties: #{get_additional_properties}>" + end + end +end diff --git a/lib/advanced_billing/models/send_invoice_request.rb b/lib/advanced_billing/models/send_invoice_request.rb index 37d7856e..517e7b54 100644 --- a/lib/advanced_billing/models/send_invoice_request.rb +++ b/lib/advanced_billing/models/send_invoice_request.rb @@ -21,12 +21,18 @@ class SendInvoiceRequest < BaseModel # @return [Array[String]] attr_accessor :bcc_recipient_emails + # Array of URLs to files to attach to the invoice email. Max 10 files, 10MB + # each. + # @return [Array[String]] + attr_accessor :attachment_urls + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @_hash['recipient_emails'] = 'recipient_emails' @_hash['cc_recipient_emails'] = 'cc_recipient_emails' @_hash['bcc_recipient_emails'] = 'bcc_recipient_emails' + @_hash['attachment_urls'] = 'attachment_urls' @_hash end @@ -36,6 +42,7 @@ def self.optionals recipient_emails cc_recipient_emails bcc_recipient_emails + attachment_urls ] end @@ -45,7 +52,8 @@ def self.nullables end def initialize(recipient_emails: SKIP, cc_recipient_emails: SKIP, - bcc_recipient_emails: SKIP, additional_properties: {}) + bcc_recipient_emails: SKIP, attachment_urls: SKIP, + additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) @@ -54,6 +62,7 @@ def initialize(recipient_emails: SKIP, cc_recipient_emails: SKIP, @recipient_emails = recipient_emails unless recipient_emails == SKIP @cc_recipient_emails = cc_recipient_emails unless cc_recipient_emails == SKIP @bcc_recipient_emails = bcc_recipient_emails unless bcc_recipient_emails == SKIP + @attachment_urls = attachment_urls unless attachment_urls == SKIP end # Creates an instance of the object from a hash. @@ -67,6 +76,8 @@ def self.from_hash(hash) hash.key?('cc_recipient_emails') ? hash['cc_recipient_emails'] : SKIP bcc_recipient_emails = hash.key?('bcc_recipient_emails') ? hash['bcc_recipient_emails'] : SKIP + attachment_urls = + hash.key?('attachment_urls') ? hash['attachment_urls'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } @@ -75,6 +86,7 @@ def self.from_hash(hash) SendInvoiceRequest.new(recipient_emails: recipient_emails, cc_recipient_emails: cc_recipient_emails, bcc_recipient_emails: bcc_recipient_emails, + attachment_urls: attachment_urls, additional_properties: additional_properties) end @@ -82,8 +94,8 @@ def self.from_hash(hash) def to_s class_name = self.class.name.split('::').last "<#{class_name} recipient_emails: #{@recipient_emails}, cc_recipient_emails:"\ - " #{@cc_recipient_emails}, bcc_recipient_emails: #{@bcc_recipient_emails},"\ - " additional_properties: #{get_additional_properties}>" + " #{@cc_recipient_emails}, bcc_recipient_emails: #{@bcc_recipient_emails}, attachment_urls:"\ + " #{@attachment_urls}, additional_properties: #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. @@ -91,7 +103,8 @@ def inspect class_name = self.class.name.split('::').last "<#{class_name} recipient_emails: #{@recipient_emails.inspect}, cc_recipient_emails:"\ " #{@cc_recipient_emails.inspect}, bcc_recipient_emails: #{@bcc_recipient_emails.inspect},"\ - " additional_properties: #{get_additional_properties}>" + " attachment_urls: #{@attachment_urls.inspect}, additional_properties:"\ + " #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/snap_day.rb b/lib/advanced_billing/models/snap_day.rb deleted file mode 100644 index 87c4717e..00000000 --- a/lib/advanced_billing/models/snap_day.rb +++ /dev/null @@ -1,26 +0,0 @@ -# advanced_billing -# -# This file was automatically generated for Maxio by -# APIMATIC v3.0 ( https://www.apimatic.io ). - -module AdvancedBilling - # SnapDay. - class SnapDay - SNAP_DAY = [ - # TODO: Write general description for ENUM_END - ENUM_END = 'end'.freeze - ].freeze - - def self.validate(value) - return false if value.nil? - - SNAP_DAY.include?(value) - end - - def self.from_value(value, default_value = ENUM_END) - return default_value if value.nil? - - default_value - end - end -end diff --git a/lib/advanced_billing/models/status.rb b/lib/advanced_billing/models/status.rb new file mode 100644 index 00000000..10e7ac0a --- /dev/null +++ b/lib/advanced_billing/models/status.rb @@ -0,0 +1,52 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # status. + class Status + STATUS = [ + # TODO: Write general description for DRAFT + DRAFT = 'draft'.freeze, + + # TODO: Write general description for SCHEDULED + SCHEDULED = 'scheduled'.freeze, + + # TODO: Write general description for PENDING + PENDING = 'pending'.freeze, + + # TODO: Write general description for CANCELED + CANCELED = 'canceled'.freeze, + + # TODO: Write general description for ACTIVE + ACTIVE = 'active'.freeze, + + # TODO: Write general description for FULFILLED + FULFILLED = 'fulfilled'.freeze + ].freeze + + def self.validate(value) + return false if value.nil? + + STATUS.include?(value) + end + + def self.from_value(value, default_value = DRAFT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'draft' then DRAFT + when 'scheduled' then SCHEDULED + when 'pending' then PENDING + when 'canceled' then CANCELED + when 'active' then ACTIVE + when 'fulfilled' then FULFILLED + else + default_value + end + end + end +end diff --git a/lib/advanced_billing/models/subscription.rb b/lib/advanced_billing/models/subscription.rb index 6e826f4f..444ca3da 100644 --- a/lib/advanced_billing/models/subscription.rb +++ b/lib/advanced_billing/models/subscription.rb @@ -196,9 +196,9 @@ class Subscription < BaseModel # @return [String] attr_accessor :coupon_code - # The day of the month that the subscription will charge according to - # calendar billing rules, if used. - # @return [Object] + # A day of month that subscription will be processed on. Can be 1 up to 28 + # or 'end'. + # @return [String] attr_accessor :snap_day # The type of payment collection to be used in the subscription. For legacy @@ -271,7 +271,7 @@ class Subscription < BaseModel # @return [Integer] attr_accessor :coupon_uses_allowed - # If the subscription is canceled, this is their churn code. + # The churn reason code associated to a cancelled subscription. # @return [String] attr_accessor :reason_code @@ -329,7 +329,7 @@ class Subscription < BaseModel # @return [Integer] attr_accessor :stored_credential_transaction_id - # The reference value (provided by your app) for the subscription itelf. + # The reference value (provided by your app) for the subscription istelf. # @return [String] attr_accessor :reference @@ -783,9 +783,7 @@ def self.from_hash(hash) SKIP end coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP - snap_day = hash.key?('snap_day') ? APIHelper.deserialize_union_type( - UnionTypeLookUp.get(:SubscriptionSnapDay), hash['snap_day'] - ) : SKIP + snap_day = hash.key?('snap_day') ? hash['snap_day'] : SKIP payment_collection_method = hash.key?('payment_collection_method') ? hash['payment_collection_method'] : SKIP customer = Customer.from_hash(hash['customer']) if hash['customer'] @@ -989,16 +987,6 @@ def to_custom_scheduled_cancellation_at DateTimeHelper.to_rfc3339(scheduled_cancellation_at) end - # Validates an instance of the object from a given value. - # @param [Subscription | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true - end - # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last diff --git a/lib/advanced_billing/models/subscription_component.rb b/lib/advanced_billing/models/subscription_component.rb index 48abc20e..ad751f4c 100644 --- a/lib/advanced_billing/models/subscription_component.rb +++ b/lib/advanced_billing/models/subscription_component.rb @@ -79,85 +79,71 @@ class SubscriptionComponent < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge # 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`. # @return [CreditType] attr_accessor :downgrade_credit # 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`. # @return [DateTime] attr_accessor :archived_at # 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`. # @return [Integer] attr_accessor :price_point_id # 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`. # @return [String] attr_accessor :price_point_handle # 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`. # @return [PricePointType] attr_accessor :price_point_type # 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`. # @return [String] attr_accessor :price_point_name # 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`. # @return [Integer] attr_accessor :product_family_id # 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`. # @return [String] attr_accessor :product_family_handle # 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`. # @return [DateTime] attr_accessor :created_at # 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`. # @return [DateTime] attr_accessor :updated_at # 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`. # @return [TrueClass | FalseClass] attr_accessor :use_site_exchange_rate # 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`. # @return [String] attr_accessor :description # 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`. # @return [TrueClass | FalseClass] attr_accessor :allow_fractional_quantities diff --git a/lib/advanced_billing/models/subscription_custom_price.rb b/lib/advanced_billing/models/subscription_custom_price.rb index 972143b1..d2d4734a 100644 --- a/lib/advanced_billing/models/subscription_custom_price.rb +++ b/lib/advanced_billing/models/subscription_custom_price.rb @@ -5,7 +5,8 @@ module AdvancedBilling # (Optional) Used in place of `product_price_point_id` to define a custom - # price point unique to the subscription + # price point unique to the subscription. A subscription can have up to 30 + # custom price points. Exceeding this limit will result in an API error. class SubscriptionCustomPrice < BaseModel SKIP = Object.new private_constant :SKIP diff --git a/lib/advanced_billing/models/subscription_group.rb b/lib/advanced_billing/models/subscription_group.rb index 47185936..a782237b 100644 --- a/lib/advanced_billing/models/subscription_group.rb +++ b/lib/advanced_billing/models/subscription_group.rb @@ -10,6 +10,10 @@ class SubscriptionGroup < BaseModel SKIP = Object.new private_constant :SKIP + # TODO: Write general description for this method + # @return [String] + attr_accessor :uid + # TODO: Write general description for this method # @return [Integer] attr_accessor :customer_id @@ -42,6 +46,7 @@ class SubscriptionGroup < BaseModel # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? + @_hash['uid'] = 'uid' @_hash['customer_id'] = 'customer_id' @_hash['payment_profile'] = 'payment_profile' @_hash['payment_collection_method'] = 'payment_collection_method' @@ -53,6 +58,7 @@ def self.names # An array for optional fields def self.optionals %w[ + uid customer_id payment_profile payment_collection_method @@ -66,7 +72,7 @@ def self.nullables [] end - def initialize(customer_id: SKIP, payment_profile: SKIP, + def initialize(uid: SKIP, customer_id: SKIP, payment_profile: SKIP, payment_collection_method: SKIP, subscription_ids: SKIP, created_at: SKIP, additional_properties: {}) # Add additional model properties to the instance. @@ -74,6 +80,7 @@ def initialize(customer_id: SKIP, payment_profile: SKIP, instance_variable_set("@#{_name}", _value) end + @uid = uid unless uid == SKIP @customer_id = customer_id unless customer_id == SKIP @payment_profile = payment_profile unless payment_profile == SKIP unless payment_collection_method == SKIP @@ -89,6 +96,7 @@ def self.from_hash(hash) return nil unless hash # Extract variables from the hash. + uid = hash.key?('uid') ? hash['uid'] : SKIP customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP payment_profile = SubscriptionGroupPaymentProfile.from_hash(hash['payment_profile']) if hash['payment_profile'] @@ -106,7 +114,8 @@ def self.from_hash(hash) additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. - SubscriptionGroup.new(customer_id: customer_id, + SubscriptionGroup.new(uid: uid, + customer_id: customer_id, payment_profile: payment_profile, payment_collection_method: payment_collection_method, subscription_ids: subscription_ids, @@ -121,17 +130,17 @@ def to_custom_created_at # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last - "<#{class_name} customer_id: #{@customer_id}, payment_profile: #{@payment_profile},"\ - " payment_collection_method: #{@payment_collection_method}, subscription_ids:"\ - " #{@subscription_ids}, created_at: #{@created_at}, additional_properties:"\ + "<#{class_name} uid: #{@uid}, customer_id: #{@customer_id}, payment_profile:"\ + " #{@payment_profile}, payment_collection_method: #{@payment_collection_method},"\ + " subscription_ids: #{@subscription_ids}, created_at: #{@created_at}, additional_properties:"\ " #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. def inspect class_name = self.class.name.split('::').last - "<#{class_name} customer_id: #{@customer_id.inspect}, payment_profile:"\ - " #{@payment_profile.inspect}, payment_collection_method:"\ + "<#{class_name} uid: #{@uid.inspect}, customer_id: #{@customer_id.inspect},"\ + " payment_profile: #{@payment_profile.inspect}, payment_collection_method:"\ " #{@payment_collection_method.inspect}, subscription_ids: #{@subscription_ids.inspect},"\ " created_at: #{@created_at.inspect}, additional_properties: #{get_additional_properties}>" end diff --git a/lib/advanced_billing/models/subscription_group_signup_item.rb b/lib/advanced_billing/models/subscription_group_signup_item.rb index 73b6208f..47d98d64 100644 --- a/lib/advanced_billing/models/subscription_group_signup_item.rb +++ b/lib/advanced_billing/models/subscription_group_signup_item.rb @@ -57,7 +57,8 @@ class SubscriptionGroupSignupItem < BaseModel attr_accessor :components # (Optional) Used in place of `product_price_point_id` to define a custom - # price point unique to the subscription + # price point unique to the subscription. A subscription can have up to 30 + # custom price points. Exceeding this limit will result in an API error. # @return [SubscriptionCustomPrice] attr_accessor :custom_price diff --git a/lib/advanced_billing/models/subscription_included_coupon.rb b/lib/advanced_billing/models/subscription_included_coupon.rb index 87d6ce08..389f6f01 100644 --- a/lib/advanced_billing/models/subscription_included_coupon.rb +++ b/lib/advanced_billing/models/subscription_included_coupon.rb @@ -117,16 +117,6 @@ def self.from_hash(hash) additional_properties: additional_properties) end - # Validates an instance of the object from a given value. - # @param [SubscriptionIncludedCoupon | Hash] The value against the validation is performed. - def self.validate(value) - return true if value.instance_of? self - - return false unless value.instance_of? Hash - - true - end - # Provides a human-readable string representation of the object. def to_s class_name = self.class.name.split('::').last diff --git a/lib/advanced_billing/models/subscription_sort.rb b/lib/advanced_billing/models/subscription_sort.rb index 9864fe99..1497d71c 100644 --- a/lib/advanced_billing/models/subscription_sort.rb +++ b/lib/advanced_billing/models/subscription_sort.rb @@ -23,7 +23,19 @@ class SubscriptionSort UPDATED_AT = 'updated_at'.freeze, # TODO: Write general description for CREATED_AT - CREATED_AT = 'created_at'.freeze + CREATED_AT = 'created_at'.freeze, + + # TODO: Write general description for TOTAL_PAYMENTS + TOTAL_PAYMENTS = 'total_payments'.freeze, + + # TODO: Write general description for ID + ID = 'id'.freeze, + + # TODO: Write general description for OPEN_BALANCE + OPEN_BALANCE = 'open_balance'.freeze, + + # TODO: Write general description for EXPIRES_AT + EXPIRES_AT = 'expires_at'.freeze ].freeze def self.validate(value) @@ -44,6 +56,10 @@ def self.from_value(value, default_value = SIGNUP_DATE) when 'next_assessment' then NEXT_ASSESSMENT when 'updated_at' then UPDATED_AT when 'created_at' then CREATED_AT + when 'total_payments' then TOTAL_PAYMENTS + when 'id' then ID + when 'open_balance' then OPEN_BALANCE + when 'expires_at' then EXPIRES_AT else default_value end diff --git a/lib/advanced_billing/models/update_component.rb b/lib/advanced_billing/models/update_component.rb index 5bc0db63..1c3bffc9 100644 --- a/lib/advanced_billing/models/update_component.rb +++ b/lib/advanced_billing/models/update_component.rb @@ -48,7 +48,6 @@ class UpdateComponent < BaseModel # 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`. # @return [CreditType] attr_accessor :upgrade_charge diff --git a/lib/advanced_billing/models/update_subscription.rb b/lib/advanced_billing/models/update_subscription.rb index fb78b289..3b59fc10 100644 --- a/lib/advanced_billing/models/update_subscription.rb +++ b/lib/advanced_billing/models/update_subscription.rb @@ -35,8 +35,8 @@ class UpdateSubscription < BaseModel # @return [String] attr_accessor :next_product_price_point_id - # Use for subscriptions with product eligible for calendar billing only. - # Value can be 1-28 or 'end'. + # A day of month that subscription will be processed on. Can be 1 up to 28 + # or 'end'. # @return [Object] attr_accessor :snap_day @@ -118,7 +118,8 @@ class UpdateSubscription < BaseModel attr_accessor :reference # (Optional) Used in place of `product_price_point_id` to define a custom - # price point unique to the subscription + # price point unique to the subscription. A subscription can have up to 30 + # custom price points. Exceeding this limit will result in an API error. # @return [SubscriptionCustomPrice] attr_accessor :custom_price @@ -207,7 +208,6 @@ def self.optionals # An array for nullable fields def self.nullables %w[ - snap_day dunning_communication_delay_time_zone ] end diff --git a/lib/advanced_billing/models/upgrade_charge_credit_type.rb b/lib/advanced_billing/models/upgrade_charge_credit_type.rb new file mode 100644 index 00000000..094e21a8 --- /dev/null +++ b/lib/advanced_billing/models/upgrade_charge_credit_type.rb @@ -0,0 +1,44 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # The type of credit to be created when upgrading/downgrading. Defaults to the + # component and then site setting if one is not provided. Values are: `full` - + # A charge is added for the full price of the component. `prorated` - A + # charge is added for the prorated price of the component change. `none` - No + # charge is added. + class UpgradeChargeCreditType + UPGRADE_CHARGE_CREDIT_TYPE = [ + # TODO: Write general description for FULL + FULL = 'full'.freeze, + + # TODO: Write general description for PRORATED + PRORATED = 'prorated'.freeze, + + # TODO: Write general description for NONE + NONE = 'none'.freeze + ].freeze + + def self.validate(value) + return false if value.nil? + + UPGRADE_CHARGE_CREDIT_TYPE.include?(value) + end + + def self.from_value(value, default_value = FULL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'full' then FULL + when 'prorated' then PRORATED + when 'none' then NONE + else + default_value + end + end + end +end diff --git a/lib/advanced_billing/utilities/union_type_lookup.rb b/lib/advanced_billing/utilities/union_type_lookup.rb index bc9feae3..7153bb6e 100644 --- a/lib/advanced_billing/utilities/union_type_lookup.rb +++ b/lib/advanced_billing/utilities/union_type_lookup.rb @@ -12,6 +12,20 @@ class UnionTypeLookUp # rubocop:disable Lint/RedundantCopDisableDirective, Style/HashSyntax, Layout/FirstArgumentIndentation def self.union_types { + :CloneComponentPricePointComponentId => OneOf.new( + [ + LeafType.new(Integer), + LeafType.new(String) + ] + ), + + :CloneComponentPricePointPricePointId => OneOf.new( + [ + LeafType.new(Integer), + LeafType.new(String) + ] + ), + :UpdateComponentPricePointComponentId => OneOf.new( [ LeafType.new(Integer), @@ -275,11 +289,10 @@ def self.union_types :CalendarBillingSnapDay => OneOf.new( [ LeafType.new(Integer), - LeafType.new(SnapDay) + LeafType.new(String) ], UnionTypeContext.new( - is_optional: true, - is_nullable: true + is_optional: true ) ), @@ -803,6 +816,34 @@ def self.union_types ) ), + :ScheduledRenewalConfigurationItemRequestRenewalConfigurationItem => OneOf.new( + [ + LeafType.new(ScheduledRenewalItemRequestBodyComponent), + LeafType.new(ScheduledRenewalItemRequestBodyProduct) + ] + ), + + :ScheduledRenewalProductPricePointPriceInCents => OneOf.new( + [ + LeafType.new(String), + LeafType.new(Integer) + ] + ), + + :ScheduledRenewalProductPricePointInterval => OneOf.new( + [ + LeafType.new(String), + LeafType.new(Integer) + ] + ), + + :ScheduledRenewalUpdateRequestRenewalConfigurationItem => OneOf.new( + [ + LeafType.new(ScheduledRenewalItemRequestBodyComponent), + LeafType.new(ScheduledRenewalItemRequestBodyProduct) + ] + ), + :SegmentSegmentProperty1Value => OneOf.new( [ LeafType.new(String), @@ -851,17 +892,6 @@ def self.union_types ) ), - :SubscriptionSnapDay => OneOf.new( - [ - LeafType.new(Integer), - LeafType.new(SnapDay) - ], - UnionTypeContext.new( - is_optional: true, - is_nullable: true - ) - ), - :SubscriptionComponentAllocatedQuantity => OneOf.new( [ LeafType.new(Integer), @@ -1048,12 +1078,11 @@ def self.union_types :UpdateSubscriptionSnapDay => OneOf.new( [ - LeafType.new(Integer), - LeafType.new(SnapDay) + LeafType.new(String), + LeafType.new(Integer) ], UnionTypeContext.new( - is_optional: true, - is_nullable: true + is_optional: true ) ), diff --git a/spec/Gemfile b/spec/Gemfile index 309d3486..33938c1c 100644 --- a/spec/Gemfile +++ b/spec/Gemfile @@ -1,8 +1,9 @@ -eval_gemfile "../Gemfile" +eval_gemfile '../Gemfile' group :test do - gem 'rspec' + gem 'connection_pool', '>= 2.4', '< 3.0' gem 'dotenv' gem 'ffaker' gem 'pry' + gem 'rspec' end diff --git a/spec/subscription_spec.rb b/spec/subscription_spec.rb index 3544f688..56a550f6 100644 --- a/spec/subscription_spec.rb +++ b/spec/subscription_spec.rb @@ -63,8 +63,8 @@ expect(subscription.product.product_family.name).to eq(@product_family.name) expect(subscription.product.product_family.handle).to eq(@product_family.handle) expect(subscription.product.product_family.description).to eq(@product_family.description) - expect(subscription.current_period_ends_at.to_datetime).to eq((Date.today + 1).to_datetime) - expect(subscription.current_period_started_at.to_date).to eq(Date.today) + expect(subscription.current_period_ends_at.to_date).to be_between(Date.today, Date.today + 1) + expect(subscription.current_period_started_at.to_date).to be_between(Date.today - 1, Date.today) coupons = @client.subscriptions.read_subscription(subscription.id, include: ['coupons']).subscription.coupons expect(coupons.size).to eq(1)