From afd2ece3382bc7d2083b0593be11f16058be5286 Mon Sep 17 00:00:00 2001 From: lucassus Date: Thu, 4 Dec 2025 12:42:57 +0000 Subject: [PATCH] Automated commit message --- .rubocop.yml | 3 + README.md | 138 ++- advanced_billing.gemspec | 6 +- bin/console | 15 + doc/client.md | 14 + doc/controllers/advance-invoice.md | 4 +- doc/controllers/api-exports.md | 12 +- doc/controllers/billing-portal.md | 2 +- doc/controllers/component-price-points.md | 8 +- doc/controllers/components.md | 18 +- doc/controllers/coupons.md | 26 +- doc/controllers/custom-fields.md | 204 ++-- doc/controllers/customers.md | 12 +- .../events-based-billing-segments.md | 2 +- doc/controllers/events.md | 16 +- doc/controllers/insights.md | 4 +- doc/controllers/invoices.md | 80 +- doc/controllers/offers.md | 2 +- doc/controllers/payment-profiles.md | 296 +----- doc/controllers/product-families.md | 14 +- doc/controllers/product-price-points.md | 34 +- doc/controllers/products.md | 16 +- doc/controllers/proforma-invoices.md | 4 +- doc/controllers/reason-codes.md | 4 +- doc/controllers/sales-commissions.md | 16 +- doc/controllers/sites.md | 2 +- doc/controllers/subscription-components.md | 57 +- .../subscription-group-invoice-account.md | 2 +- doc/controllers/subscription-group-status.md | 6 +- doc/controllers/subscription-groups.md | 12 +- .../subscription-invoice-account.md | 6 +- doc/controllers/subscription-notes.md | 4 +- doc/controllers/subscription-products.md | 6 +- doc/controllers/subscription-status.md | 7 +- doc/controllers/subscriptions.md | 675 +------------ doc/controllers/webhooks.md | 6 +- ...environment-based-client-initialization.md | 68 ++ doc/models/activate-event-based-component.md | 5 +- doc/models/add-coupons-request.md | 2 +- doc/models/allocate-components.md | 2 +- doc/models/allocation-preview.md | 4 +- doc/models/apply-credit-note-event-data.md | 2 +- doc/models/attribute-error.md | 2 +- doc/models/base-refund-error.md | 2 +- doc/models/base-string-error.md | 2 +- doc/models/billing-manifest.md | 2 +- doc/models/billing-schedule.md | 2 +- .../bulk-components-price-point-assignment.md | 2 +- ...ulk-create-product-price-points-request.md | 4 +- ...lk-create-product-price-points-response.md | 2 +- doc/models/bulk-create-segments.md | 2 +- doc/models/bulk-update-segments-item.md | 2 +- doc/models/bulk-update-segments.md | 2 +- doc/models/calendar-billing.md | 4 +- doc/models/chargify-ebb.md | 4 +- .../component-allocation-error-exception.md | 2 +- doc/models/component-cost-data.md | 2 +- .../component-currency-prices-response.md | 2 +- doc/models/component-custom-price.md | 9 +- .../component-price-point-error-exception.md | 2 +- doc/models/component-price-point-item.md | 2 +- doc/models/component-price-point.md | 6 +- doc/models/component-price-points-response.md | 2 +- doc/models/component.md | 8 +- doc/models/consolidated-invoice.md | 2 +- .../containers/calendar-billing-snap-day.md | 4 +- .../containers/subscription-snap-day.md | 14 + .../update-subscription-snap-day.md | 4 +- doc/models/coupon-currency-request.md | 2 +- doc/models/coupon-currency-response.md | 2 +- doc/models/coupon-subcodes-response.md | 6 +- doc/models/coupon-subcodes.md | 2 +- doc/models/coupon.md | 4 +- doc/models/create-allocation.md | 2 +- doc/models/create-component-price-point.md | 2 +- doc/models/create-currency-prices-request.md | 2 +- doc/models/create-invoice-coupon.md | 5 +- doc/models/create-invoice-item.md | 4 +- doc/models/create-invoice.md | 4 +- doc/models/create-metadata-request.md | 2 +- doc/models/create-metafield.md | 4 +- doc/models/create-multi-invoice-payment.md | 2 +- doc/models/create-offer.md | 4 +- doc/models/create-or-update-endpoint.md | 2 +- doc/models/create-or-update-product.md | 6 +- doc/models/create-payment-profile.md | 4 +- ...ate-prepaid-usage-component-price-point.md | 2 +- .../create-product-currency-prices-request.md | 2 +- .../create-product-price-point-request.md | 2 +- doc/models/create-product-price-point.md | 4 +- doc/models/create-segment.md | 2 +- doc/models/create-subscription-group.md | 2 +- doc/models/create-subscription.md | 4 +- doc/models/create-usage-request.md | 19 + doc/models/create-usage.md | 22 +- doc/models/credit-note.md | 12 +- doc/models/currency-prices-response.md | 2 +- doc/models/customer-custom-fields-change.md | 4 +- doc/models/debit-note.md | 8 +- doc/models/ebb-component.md | 6 +- doc/models/endpoint.md | 2 +- doc/models/error-list-response-exception.md | 2 +- doc/models/errors.md | 4 +- .../full-subscription-group-response.md | 2 +- doc/models/invoice-discount.md | 2 +- doc/models/invoice-issued.md | 2 +- .../invoice-line-item-component-cost-data.md | 2 +- doc/models/invoice-line-item-event-data.md | 2 +- doc/models/invoice-previous-balance.md | 2 +- doc/models/invoice-tax.md | 4 +- doc/models/invoice.md | 18 +- doc/models/list-components-filter.md | 2 +- .../list-components-price-points-response.md | 2 +- doc/models/list-coupons-filter.md | 7 +- doc/models/list-credit-notes-response.md | 2 +- doc/models/list-invoices-response.md | 2 +- doc/models/list-metafields-response.md | 2 +- doc/models/list-mrr-filter.md | 2 +- doc/models/list-mrr-response-result.md | 2 +- doc/models/list-offers-response.md | 2 +- doc/models/list-price-points-filter.md | 4 +- .../list-product-price-points-response.md | 2 +- doc/models/list-products-filter.md | 2 +- doc/models/list-proforma-invoices-response.md | 2 +- doc/models/list-public-keys-response.md | 2 +- doc/models/list-segments-response.md | 2 +- doc/models/list-service-credits-response.md | 2 +- .../list-subscription-components-filter.md | 2 +- ...subscription-components-for-site-filter.md | 2 +- .../list-subscription-components-response.md | 2 +- ...-subscription-group-prepayment-response.md | 2 +- doc/models/list-subscription-groups-item.md | 2 +- .../list-subscription-groups-response.md | 2 +- doc/models/metafield-input.md | 2 +- doc/models/metafield-scope.md | 6 +- doc/models/metafield.md | 4 +- doc/models/metered-component.md | 8 +- doc/models/movement-line-item.md | 2 +- doc/models/movement.md | 2 +- doc/models/multi-invoice-payment.md | 2 +- doc/models/offer-item.md | 2 +- doc/models/offer.md | 6 +- doc/models/on-off-component.md | 6 +- doc/models/overage-pricing.md | 2 +- doc/models/paginated-metadata.md | 2 +- doc/models/payer-error.md | 6 +- doc/models/payment-profile-attributes.md | 2 +- doc/models/prepaid-usage-component.md | 8 +- doc/models/prepaid-usage.md | 2 +- doc/models/prepayments-response.md | 2 +- doc/models/preview-allocations-request.md | 2 +- doc/models/product-price-point-errors.md | 10 +- doc/models/product-price-point.md | 4 +- doc/models/product.md | 6 +- doc/models/proforma-invoice-discount.md | 2 +- doc/models/proforma-invoice-issued.md | 2 +- doc/models/proforma-invoice-tax.md | 2 +- doc/models/proforma-invoice.md | 12 +- doc/models/quantity-based-component.md | 8 +- .../reactivate-subscription-group-response.md | 2 +- doc/models/record-payment-response.md | 2 +- doc/models/renewal-preview-request.md | 2 +- doc/models/renewal-preview.md | 2 +- doc/models/replay-webhooks-request.md | 2 +- doc/models/resume-options.md | 2 +- doc/models/sale-rep.md | 2 +- doc/models/segment.md | 2 +- doc/models/send-invoice-request.md | 6 +- doc/models/site.md | 2 +- doc/models/snap-day.md | 2 - ...subscription-add-coupon-error-exception.md | 8 +- ...on-component-allocation-error-exception.md | 2 +- doc/models/subscription-component.md | 2 +- doc/models/subscription-custom-price.md | 1 + doc/models/subscription-filter.md | 2 +- ...bscription-group-component-custom-price.md | 7 +- .../subscription-group-members-array-error.md | 2 +- .../subscription-group-signup-component.md | 9 +- doc/models/subscription-group-signup-error.md | 2 +- .../subscription-group-signup-failure-data.md | 2 +- doc/models/subscription-group-signup-item.md | 4 +- .../subscription-group-signup-response.md | 4 +- doc/models/subscription-group-signup.md | 2 +- .../subscription-group-subscription-error.md | 16 +- doc/models/subscription-group-update-error.md | 2 +- doc/models/subscription-group.md | 2 +- doc/models/subscription-mrr-response.md | 2 +- ...cription-remove-coupon-errors-exception.md | 2 +- doc/models/subscription.md | 8 +- doc/models/trial-type.md | 16 + doc/models/update-component-price-point.md | 2 +- doc/models/update-component.md | 2 +- doc/models/update-currency-prices-request.md | 2 +- doc/models/update-metafield.md | 4 +- doc/models/update-payment-profile.md | 2 +- doc/models/update-segment.md | 2 +- doc/models/update-subscription-component.md | 3 +- doc/models/update-subscription-group.md | 2 +- doc/models/update-subscription.md | 4 +- lib/advanced_billing.rb | 1 + lib/advanced_billing/client.rb | 11 + lib/advanced_billing/configuration.rb | 73 ++ .../controllers/advance_invoice_controller.rb | 4 +- .../controllers/base_controller.rb | 2 +- .../controllers/billing_portal_controller.rb | 4 +- .../component_price_points_controller.rb | 4 +- .../controllers/components_controller.rb | 10 +- .../controllers/coupons_controller.rb | 16 +- .../controllers/custom_fields_controller.rb | 230 ++--- .../controllers/customers_controller.rb | 8 +- .../controllers/invoices_controller.rb | 59 +- .../payment_profiles_controller.rb | 313 ++---- .../product_families_controller.rb | 15 +- .../product_price_points_controller.rb | 32 +- .../controllers/products_controller.rb | 15 +- .../proforma_invoices_controller.rb | 2 +- .../sales_commissions_controller.rb | 6 +- .../subscription_components_controller.rb | 57 +- .../subscription_group_status_controller.rb | 18 +- .../subscription_groups_controller.rb | 15 +- ...subscription_invoice_account_controller.rb | 2 +- .../subscription_products_controller.rb | 13 +- .../subscription_status_controller.rb | 13 +- .../controllers/subscriptions_controller.rb | 894 ++---------------- lib/advanced_billing/http/auth/basic_auth.rb | 12 + lib/advanced_billing/http/proxy_settings.rb | 9 + .../models/activate_event_based_component.rb | 3 +- lib/advanced_billing/models/all_vaults.rb | 45 + .../models/allocation_preview_direction.rb | 13 + .../allocation_preview_line_item_kind.rb | 15 + .../models/apple_pay_vault.rb | 6 + lib/advanced_billing/models/auto_invite.rb | 19 + .../models/bank_account_holder_type.rb | 13 + .../models/bank_account_type.rb | 13 + .../models/bank_account_vault.rb | 19 + .../models/basic_date_field.rb | 13 + .../models/billing_manifest_line_item_kind.rb | 17 + .../models/billing_schedule.rb | 4 +- .../models/calendar_billing.rb | 4 +- .../models/cancellation_method.rb | 17 + lib/advanced_billing/models/card_type.rb | 47 + .../models/chargeback_status.rb | 15 + lib/advanced_billing/models/chargify_ebb.rb | 8 +- lib/advanced_billing/models/cleanup_scope.rb | 13 + .../models/collection_method.rb | 15 + lib/advanced_billing/models/component.rb | 62 +- .../models/component_custom_price.rb | 64 +- lib/advanced_billing/models/component_kind.rb | 16 + .../models/compounding_strategy.rb | 13 + .../models/create_allocation.rb | 3 +- .../models/create_invoice_coupon.rb | 23 +- .../models/create_invoice_item.rb | 10 +- .../models/create_invoice_status.rb | 13 + .../models/create_metafield.rb | 8 +- .../models/create_or_update_product.rb | 19 +- .../models/create_payment_profile.rb | 12 +- .../models/create_prepayment_method.rb | 19 + .../models/create_product_price_point.rb | 11 +- .../create_signup_proforma_preview_include.rb | 6 + lib/advanced_billing/models/create_usage.rb | 24 +- .../models/credit_card_vault.rb | 44 + .../models/credit_note_status.rb | 13 + lib/advanced_billing/models/credit_scheme.rb | 14 + lib/advanced_billing/models/credit_type.rb | 14 + .../models/currency_price_role.rb | 14 + .../models/custom_field_owner.rb | 13 + .../models/debit_note_role.rb | 13 + .../models/debit_note_status.rb | 15 + lib/advanced_billing/models/direction.rb | 13 + lib/advanced_billing/models/discount_type.rb | 13 + lib/advanced_billing/models/ebb_component.rb | 4 +- lib/advanced_billing/models/event_key.rb | 91 ++ .../models/expiration_interval_unit.rb | 14 + .../models/failed_payment_action.rb | 14 + .../models/first_charge_type.rb | 14 + .../models/group_target_type.rb | 16 + lib/advanced_billing/models/group_type.rb | 13 + .../models/include_not_null.rb | 6 + .../models/include_null_or_not_null.rb | 13 + lib/advanced_billing/models/include_option.rb | 13 + lib/advanced_billing/models/interval_unit.rb | 13 + .../models/invoice_consolidation_level.rb | 14 + .../models/invoice_date_field.rb | 16 + .../models/invoice_discount_source_type.rb | 14 + .../models/invoice_discount_type.rb | 14 + .../models/invoice_event_payment_method.rb | 16 + .../models/invoice_event_type.rb | 26 + .../models/invoice_payment_method_type.rb | 17 + .../models/invoice_payment_type.rb | 15 + lib/advanced_billing/models/invoice_role.rb | 21 + .../models/invoice_sort_field.rb | 19 + lib/advanced_billing/models/invoice_status.rb | 18 + lib/advanced_billing/models/item_category.rb | 16 + lib/advanced_billing/models/line_item_kind.rb | 21 + .../models/line_item_transaction_type.rb | 18 + .../list_components_price_points_include.rb | 6 + .../models/list_coupons_filter.rb | 28 +- .../models/list_events_date_field.rb | 6 + .../models/list_prepayment_date_field.rb | 13 + .../models/list_products_include.rb | 6 + .../list_products_price_points_include.rb | 6 + .../list_subscription_components_include.rb | 13 + .../list_subscription_components_sort.rb | 13 + lib/advanced_billing/models/metafield.rb | 19 +- .../models/metafield_input.rb | 23 +- .../models/metafield_scope.rb | 13 +- .../models/metered_component.rb | 4 +- .../models/nested_subscription_group.rb | 10 + .../models/on_off_component.rb | 4 +- lib/advanced_billing/models/pay_pal_vault.rb | 15 + .../models/payment_profile_attributes.rb | 6 +- lib/advanced_billing/models/payment_type.rb | 15 + .../models/prepaid_configuration.rb | 10 + .../models/prepaid_usage_component.rb | 4 +- .../models/prepayment_method.rb | 18 + .../models/price_point_type.rb | 14 + lib/advanced_billing/models/pricing_scheme.rb | 15 + lib/advanced_billing/models/product.rb | 26 +- lib/advanced_billing/models/product_family.rb | 10 + .../models/product_price_point.rb | 11 +- .../proforma_invoice_discount_source_type.rb | 13 + .../models/proforma_invoice_role.rb | 15 + .../models/proforma_invoice_status.rb | 14 + .../proforma_invoice_tax_source_type.rb | 13 + .../models/public_signup_page.rb | 10 + .../models/quantity_based_component.rb | 4 +- .../models/reactivation_charge.rb | 14 + .../models/recurring_scheme.rb | 14 + lib/advanced_billing/models/resource_type.rb | 13 + .../models/restriction_type.rb | 13 + lib/advanced_billing/models/resume_options.rb | 2 +- .../models/resumption_charge.rb | 14 + .../models/service_credit_type.rb | 13 + lib/advanced_billing/models/snap_day.rb | 9 +- .../models/sorting_direction.rb | 13 + lib/advanced_billing/models/subscription.rb | 19 +- .../models/subscription_custom_price.rb | 30 +- .../models/subscription_date_field.rb | 20 + .../models/subscription_group_include.rb | 6 + .../subscription_group_prepayment_method.rb | 17 + .../subscription_groups_list_include.rb | 6 + .../models/subscription_include.rb | 13 + .../models/subscription_included_coupon.rb | 10 + .../models/subscription_list_date_field.rb | 6 + .../models/subscription_list_include.rb | 6 + .../models/subscription_purge_type.rb | 13 + .../models/subscription_sort.rb | 17 + .../models/subscription_state.rb | 26 + .../models/subscription_state_filter.rb | 23 + .../models/tax_configuration_kind.rb | 15 + .../models/tax_destination_address.rb | 15 + lib/advanced_billing/models/trial_type.rb | 41 + .../models/update_component.rb | 4 +- .../models/update_metafield.rb | 10 +- .../models/update_payment_profile.rb | 6 +- .../models/update_subscription.rb | 1 + lib/advanced_billing/models/webhook_order.rb | 13 + lib/advanced_billing/models/webhook_status.rb | 15 + .../models/webhook_subscription.rb | 46 + .../utilities/union_type_lookup.rb | 23 +- 360 files changed, 3389 insertions(+), 2962 deletions(-) create mode 100644 bin/console create mode 100644 doc/environment-based-client-initialization.md create mode 100644 doc/models/containers/subscription-snap-day.md create mode 100644 doc/models/trial-type.md create mode 100644 lib/advanced_billing/models/trial_type.rb diff --git a/.rubocop.yml b/.rubocop.yml index 08c50fe7..b563c468 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -51,6 +51,9 @@ Style/MultilineTernaryOperator: Layout/MultilineMethodCallIndentation: Enabled: false +Style/OptionalBooleanParameter: + Enabled: false + Style/KeywordParametersOrder: Enabled: false diff --git a/README.md b/README.md index 1ec9d1b6..a012b566 100644 --- a/README.md +++ b/README.md @@ -29,20 +29,55 @@ 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 7.0.1 +gem install maxio-advanced-billing-sdk -v 8.0.0 ``` Or add the gem to your Gemfile and run `bundle`: ```ruby -gem 'maxio-advanced-billing-sdk', '7.0.1' +gem 'maxio-advanced-billing-sdk', '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/7.0.1). +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). + +## IRB Console Usage + +You can explore the SDK interactively using IRB in two ways + +### 1. Use IRB with Installed Gem + +Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and type the following command to start the irb console. + +```bash +irb +``` + +Now you can load the SDK in the IRB + +```ruby +require 'advanced_billing' +include AdvancedBilling +``` + +### 2. Use IRB within SDK + +Open your system terminal (Command Prompt, Git Bash or macOS Terminal) and navigate to the root folder of SDK. + +``` +cd path/to/advanced_billing +``` + +Now you can start the preconfigured irb console by running the following command + +```bash +ruby bin/console +``` + +**_Note:_** This automatically loads the SDK from lib/ ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/client.md) +**_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) The following parameters are configurable for the API Client: @@ -59,11 +94,13 @@ 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/7.0.1/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/7.0.1/doc/auth/basic-authentication.md) | The credential object for Basic Authentication | +| 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 | The API client can be initialized as follows: +### Code-Based Client Initialization + ```ruby require 'advanced_billing' include AdvancedBilling @@ -78,6 +115,18 @@ client = Client.new( ) ``` +### Environment-Based Client Initialization + +```ruby +require 'advanced_billing' +include AdvancedBilling + +# Create client from environment +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. + ## Environments The SDK can be configured to use a different environment for making API calls. Available environments are: @@ -93,56 +142,57 @@ 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/7.0.1/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-ruby-sdk/tree/8.0.0/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/controllers/webhooks.md) +* [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) ## SDK Infrastructure ### Configuration -* [ProxySettings](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/proxy-settings.md) +* [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) ### HTTP -* [HttpResponse](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/http-response.md) -* [HttpRequest](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/http-request.md) +* [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) ### Utilities -* [ApiHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/api-helper.md) -* [DateTimeHelper](https://www.github.com/maxio-com/ab-ruby-sdk/tree/7.0.1/doc/date-time-helper.md) +* [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) diff --git a/advanced_billing.gemspec b/advanced_billing.gemspec index 44aa570d..9606da4a 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 = '7.0.1' + s.version = '8.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'] @@ -10,8 +10,8 @@ Gem::Specification.new do |s| s.metadata = { } - s.add_dependency('apimatic_core_interfaces', '~> 0.2.2') - s.add_dependency('apimatic_core', '~> 0.3.19') + s.add_dependency('apimatic_core_interfaces', '~> 0.2.3') + s.add_dependency('apimatic_core', '~> 0.3.20') s.add_dependency('apimatic_faraday_client_adapter', '~> 0.1.6') s.required_ruby_version = ['>= 2.6'] s.files = Dir['{bin,lib,man,test,spec}/**/*', 'README*', 'LICENSE*'] diff --git a/bin/console b/bin/console new file mode 100644 index 00000000..86773de2 --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby + +# Load the lib folder into Ruby's load path +$LOAD_PATH.unshift(File.expand_path('../lib', __dir__)) + +# Require the gem +require 'advanced_billing' + +puts 'AdvancedBilling SDK loaded!' +puts 'You can now create a client with: client = AdvancedBilling::Client.new' +puts 'Or use from_env: client = AdvancedBilling::Client.from_env' + +# Start an interactive IRB session +require 'irb' +IRB.start diff --git a/doc/client.md b/doc/client.md index f7613683..98859e65 100644 --- a/doc/client.md +++ b/doc/client.md @@ -21,6 +21,8 @@ The following parameters are configurable for the API Client: The API client can be initialized as follows: +## Code-Based Client Initialization + ```ruby require 'advanced_billing' include AdvancedBilling @@ -35,6 +37,18 @@ client = Client.new( ) ``` +## Environment-Based Client Initialization + +```ruby +require 'advanced_billing' +include AdvancedBilling + +# Create client from environment +client = Client.from_env +``` + +See the [`Environment-Based Client Initialization`](../doc/environment-based-client-initialization.md) section for details. + ## Maxio Advanced Billing Client The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK. diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md index 022b9755..1b1a947c 100644 --- a/doc/controllers/advance-invoice.md +++ b/doc/controllers/advance-invoice.md @@ -17,7 +17,7 @@ advance_invoice_controller = client.advance_invoice # Issue Advance Invoice -Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. +Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error. That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated. We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it. @@ -99,7 +99,7 @@ puts result # Void Advance Invoice Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. -A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs](../../doc/models/invoice.md). +A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs](../../doc/models/invoice.md). ```ruby def void_advance_invoice(subscription_id, diff --git a/doc/controllers/api-exports.md b/doc/controllers/api-exports.md index d8b6db0d..aa97dad1 100644 --- a/doc/controllers/api-exports.md +++ b/doc/controllers/api-exports.md @@ -41,7 +41,7 @@ def list_exported_proforma_invoices(options = {}) ## Response Type -[`Array`](../../doc/models/proforma-invoice.md) +[`Array[ProformaInvoice]`](../../doc/models/proforma-invoice.md) ## Example Usage @@ -49,7 +49,7 @@ def list_exported_proforma_invoices(options = {}) collect = { 'batch_id' => 'batch_id8', 'per_page' => 100, - 'page' => 2 + 'page' => 1 } result = api_exports_controller.list_exported_proforma_invoices(collect) @@ -83,7 +83,7 @@ def list_exported_invoices(options = {}) ## Response Type -[`Array`](../../doc/models/invoice.md) +[`Array[Invoice]`](../../doc/models/invoice.md) ## Example Usage @@ -91,7 +91,7 @@ def list_exported_invoices(options = {}) collect = { 'batch_id' => 'batch_id8', 'per_page' => 100, - 'page' => 2 + 'page' => 1 } result = api_exports_controller.list_exported_invoices(collect) @@ -125,7 +125,7 @@ def list_exported_subscriptions(options = {}) ## Response Type -[`Array`](../../doc/models/subscription.md) +[`Array[Subscription]`](../../doc/models/subscription.md) ## Example Usage @@ -133,7 +133,7 @@ def list_exported_subscriptions(options = {}) collect = { 'batch_id' => 'batch_id8', 'per_page' => 100, - 'page' => 2 + 'page' => 1 } result = api_exports_controller.list_exported_subscriptions(collect) diff --git a/doc/controllers/billing-portal.md b/doc/controllers/billing-portal.md index a228370f..54b0a94b 100644 --- a/doc/controllers/billing-portal.md +++ b/doc/controllers/billing-portal.md @@ -32,7 +32,7 @@ If your customer has been invited to the Billing Portal, then they will receive If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing. -In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), please **do not** make an API request to Advanced Billing every time. +In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time. ```ruby def enable_billing_portal_for_customer(customer_id, diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index 120011ed..427f8fe7 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -177,7 +177,7 @@ def list_component_price_points(options = {}) | `currency_prices` | `TrueClass \| FalseClass` | Query, Optional | Include an array of currency price data | | `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_type` | [`Array`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. | +| `filter_type` | [`Array[PricePointType]`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. | ## Response Type @@ -188,7 +188,7 @@ def list_component_price_points(options = {}) ```ruby collect = { 'component_id' => 222, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter_type' => Liquid error: Value cannot be null. (Parameter 'key') } @@ -375,7 +375,7 @@ puts result # Update Component Price Point -When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones. +When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. Passing in a price bracket without an `id` will attempt to create a new price. @@ -798,7 +798,7 @@ def list_all_component_price_points(options = {}) ```ruby collect = { 'include' => ListComponentsPricePointsInclude::CURRENCY_PRICES, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListPricePointsFilter.new( start_date: Date.iso8601('2011-12-17'), diff --git a/doc/controllers/components.md b/doc/controllers/components.md index 43fd96f7..2d8a4c14 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -32,7 +32,7 @@ Metered components are used to bill for any type of unit that resets to 0 at the Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```ruby def create_metered_component(product_family_id, @@ -151,7 +151,7 @@ One-time quantity-based components are used to create ad hoc usage charges that The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```ruby def create_quantity_based_component(product_family_id, @@ -261,7 +261,7 @@ This request will create a component definition of kind **on_off_component** und On/off components are used for any flat fee, recurring add on (think $99/month for tech support or a flat add on shipping fee). -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```ruby def create_on_off_component(product_family_id, @@ -356,7 +356,7 @@ This request will create a component definition of kind **prepaid_usage_componen Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```ruby def create_prepaid_usage_component(product_family_id, @@ -491,7 +491,7 @@ Event-based components are similar to other component types, in that you define So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. -For more information on components, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). ```ruby def create_event_based_component(product_family_id, @@ -885,14 +885,14 @@ def list_components(options = {}) ## Response Type -[`Array`](../../doc/models/component-response.md) +[`Array[ComponentResponse]`](../../doc/models/component-response.md) ## Example Usage ```ruby collect = { 'date_field' => BasicDateField::UPDATED_AT, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListComponentsFilter.new( ids: [ @@ -1109,14 +1109,14 @@ def list_components_for_product_family(options = {}) ## Response Type -[`Array`](../../doc/models/component-response.md) +[`Array[ComponentResponse]`](../../doc/models/component-response.md) ## Example Usage ```ruby collect = { 'product_family_id' => 140, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListComponentsFilter.new( ids: [ diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md index 57065349..38e04b1c 100644 --- a/doc/controllers/coupons.md +++ b/doc/controllers/coupons.md @@ -30,9 +30,9 @@ coupons_controller = client.coupons ## Coupons Documentation -Coupons can be administered in the Advanced Billing application or created via API. Please view our section on [creating coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creating-Editing-Deleting-Coupons) for more information. +Coupons can be administered in the Advanced Billing application or created via API. View our section on [creating coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creating-Editing-Deleting-Coupons) for more information. -Additionally, for documentation on how to apply a coupon to a subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). +Additionally, for documentation on how to apply a coupon to a subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). ## Create Coupon @@ -106,8 +106,6 @@ puts result List coupons for a specific Product Family in a Site. -If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. - ```ruby def list_coupons_for_product_family(options = {}) ``` @@ -124,14 +122,14 @@ def list_coupons_for_product_family(options = {}) ## Response Type -[`Array`](../../doc/models/coupon-response.md) +[`Array[CouponResponse]`](../../doc/models/coupon-response.md) ## Example Usage ```ruby collect = { 'product_family_id' => 140, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListCouponsFilter.new( start_date: Date.iso8601('2011-12-17'), @@ -525,8 +523,6 @@ puts result You can retrieve a list of coupons. -If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. - ```ruby def list_coupons(options = {}) ``` @@ -542,13 +538,13 @@ def list_coupons(options = {}) ## Response Type -[`Array`](../../doc/models/coupon-response.md) +[`Array[CouponResponse]`](../../doc/models/coupon-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListCouponsFilter.new( start_date: Date.iso8601('2011-12-17'), @@ -634,12 +630,12 @@ def read_coupon_usage(product_family_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `product_family_id` | `Integer` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs | -| `coupon_id` | `Integer` | Template, Required | The Advanced Billing id of the coupon | +| `product_family_id` | `Integer` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs. | +| `coupon_id` | `Integer` | Template, Required | The Advanced Billing id of the coupon. | ## Response Type -[`Array`](../../doc/models/coupon-usage.md) +[`Array[CouponUsage]`](../../doc/models/coupon-usage.md) ## Example Usage @@ -855,7 +851,7 @@ When creating a coupon subcode, you must specify a coupon to attach it to using Full documentation on how to create coupon subcodes in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes). -Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). +Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). ## Create Coupon Subcode @@ -946,7 +942,7 @@ def list_coupon_subcodes(options = {}) ```ruby collect = { 'coupon_id' => 162, - 'page' => 2, + 'page' => 1, 'per_page' => 50 } diff --git a/doc/controllers/custom-fields.md b/doc/controllers/custom-fields.md index 3c4026df..23a3512f 100644 --- a/doc/controllers/custom-fields.md +++ b/doc/controllers/custom-fields.md @@ -23,30 +23,20 @@ custom_fields_controller = client.custom_fields # Create Metafields -## Custom Fields: Metafield Intro +Creates metafields on a Site for either the Subscriptions or Customers resource. -**Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. +Metafields and their metadata are created in the Custom Fields configuration page on your Site. Metafields can be populated with metadata when you create them or later with the [Update Metafield](../../doc/controllers/custom-fields.md#update-metafield), [Create Metadata](../../doc/controllers/custom-fields.md#create-metadata), or [Update Metadata](../../doc/controllers/custom-fields.md#update-metadata) endpoints. The Create Metadata and Update Metadata endpoints allow you to add metafields and metadata values to a specific subscription or customer. -+ **Metafield is the custom field** -+ **Metadata is the data populating the custom field.** +Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. -Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/sections/24266118312589-Custom-Fields). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab). +> Note: After creating a metafield, the resource type cannot be modified. -Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record. +In the UI and product documentation, metafields and metadata are called Custom Fields. -## Create Metafields +- Metafield is the custom field +- Metadata is the data populating the custom field. -Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact. - -Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer. - -### Metafields "On-the-Fly" - -It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existent name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”. - -### Metafield Scope Warning - -If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**. +See [Custom Fields Reference](https://docs.maxio.com/hc/en-us/articles/24266140850573-Custom-Fields-Reference) and [Custom Fields Tab](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab) for information on using Custom Fields in the Advanced Billing UI. ```ruby def create_metafields(resource_type, @@ -57,12 +47,12 @@ def create_metafields(resource_type, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `body` | [`CreateMetafieldsRequest`](../../doc/models/create-metafields-request.md) | Body, Optional | - | ## Response Type -[`Array`](../../doc/models/metafield.md) +[`Array[Metafield]`](../../doc/models/metafield.md) ## Example Usage @@ -73,8 +63,10 @@ body = CreateMetafieldsRequest.new( metafields: CreateMetafield.new( name: 'Dropdown field', scope: MetafieldScope.new( - public_show: IncludeOption::INCLUDE, - public_edit: IncludeOption::INCLUDE + csv: IncludeOption::EXCLUDE, + invoices: IncludeOption::EXCLUDE, + statements: IncludeOption::EXCLUDE, + portal: IncludeOption::INCLUDE ), input_type: MetafieldInput::DROPDOWN, enum: [ @@ -131,7 +123,7 @@ puts result # List Metafields -This endpoint lists metafields associated with a site. The metafield description and usage is contained in the response. +Lists the metafields and their associated details for a Site and resource type. You can filter the request to a specific metafield. ```ruby def list_metafields(options = {}) @@ -141,8 +133,8 @@ def list_metafields(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | -| `name` | `String` | Query, Optional | filter by the name of the metafield | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | +| `name` | `String` | Query, Optional | Filter by the name of the metafield. | | `page` | `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`. | @@ -156,7 +148,7 @@ def list_metafields(options = {}) ```ruby collect = { 'resource_type' => ResourceType::SUBSCRIPTIONS, - 'page' => 2, + 'page' => 1, 'per_page' => 50 } @@ -168,10 +160,10 @@ puts result ```json { - "total_count": 0, - "current_page": 0, + "total_count": 1, + "current_page": 1, "total_pages": 0, - "per_page": 0, + "per_page": 50, "metafields": [ { "id": 0, @@ -195,7 +187,33 @@ puts result # Update Metafield -Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact. +Updates metafields on your Site for a resource type. Depending on the request structure, you can update or add metafields and metadata to the Subscriptions or Customers resource. + +With this endpoint, you can: + +- Add metafields. If the metafield specified in current_name does not exist, a new metafield is added. + + > Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. + +- Change the name of a metafield. + + > Note: To keep the metafield name the same and only update the metadata for the metafield, you must use the current metafield name in both the `current_name` and `name` parameters. + +- Change the input type for the metafield. For example, you can change a metafield input type from text to a dropdown. If you change the input type from text to a dropdown or radio, you must update the specific subscriptions or customers where the metafield was used to reflect the updated metafield and metadata. + +- Add metadata values to the existing metadata for a dropdown or radio metafield. + + > Note: Updates to metadata overwrite. To add one or more values, you must specify all metadata values including the new value you want to add. + +- Add new metadata to a dropdown or radio for a metafield that was created without metadata. + +- Remove metadata for a dropdown or radio for a metafield. + + > Note: Updates to metadata overwrite existing values. To remove one or more values, specify all metadata values except those you want to remove. + +- Add or update scope settings for a metafield. + + > Note: Scope changes overwrite existing settings. You must specify the complete scope, including the changes you want to make. ```ruby def update_metafield(resource_type, @@ -206,12 +224,12 @@ def update_metafield(resource_type, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `body` | [`UpdateMetafieldsRequest`](../../doc/models/update-metafields-request.md) | Body, Optional | - | ## Response Type -[`Array`](../../doc/models/metafield.md) +[`Array[Metafield]`](../../doc/models/metafield.md) ## Example Usage @@ -231,9 +249,7 @@ puts result # Delete Metafield -Use the following method to delete a metafield. This will remove the metafield from the Site. - -Additionally, this will remove the metafield and associated metadata with all Subscriptions on the Site. +Deletes a metafield from your Site. Removes the metafield and associated metadata from all Subscriptions or Customers resources on the Site. ```ruby def delete_metafield(resource_type, @@ -244,7 +260,7 @@ def delete_metafield(resource_type, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `name` | `String` | Query, Optional | The name of the metafield to be deleted | ## Response Type @@ -268,28 +284,11 @@ custom_fields_controller.delete_metafield(resource_type) # Create Metadata -## Custom Fields: Metadata Intro +Creates metadata and metafields for a specific subscription or customer, or updates metadata values of existing metafields for a subscription or customer. Metadata values are limited to 2 KB in size. -**Advanced Billing refers to Custom Fields in the API documentation as metafields and metadata.** Within the Advanced Billing UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata. +If you create metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field. You can update the input_type for the metafield with the [Update Metafield](../../doc/controllers/custom-fields.md#update-metafield) endpoint. -+ **Metafield is the custom field** -+ **Metadata is the data populating the custom field.** - -Advanced Billing Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24266164865677-Custom-Fields-Overview). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscription-Summary-Custom-Fields-Tab) - -Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**. - -## Metadata limits - -Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource. - -## Create Metadata - -This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value. - -### Subscription or Customer Resource - -Please pay special attention to the resource you use when creating metadata. +> Note: Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscriptions and another 100 for Customers. ```ruby def create_metadata(resource_type, @@ -301,13 +300,13 @@ def create_metadata(resource_type, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resource_id` | `Integer` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `body` | [`CreateMetadataRequest`](../../doc/models/create-metadata-request.md) | Body, Optional | - | ## Response Type -[`Array`](../../doc/models/metadata.md) +[`Array[Metadata]`](../../doc/models/metadata.md) ## Example Usage @@ -346,11 +345,7 @@ puts result # List Metadata -This request will list all of the metadata belonging to a particular resource (ie. subscription, customer) that is specified. - -## Metadata Data - -This endpoint will also display the current stats of your metadata to use as a tool for pagination. +Lists metadata and metafields for a specific customer or subscription. ```ruby def list_metadata(options = {}) @@ -360,7 +355,7 @@ def list_metadata(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resource_id` | `Integer` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `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` | @@ -375,7 +370,7 @@ def list_metadata(options = {}) collect = { 'resource_type' => ResourceType::SUBSCRIPTIONS, 'resource_id' => 60, - 'page' => 2, + 'page' => 1, 'per_page' => 50 } @@ -383,10 +378,35 @@ result = custom_fields_controller.list_metadata(collect) puts result ``` +## Example Response *(as JSON)* + +```json +{ + "total_count": 1, + "current_page": 1, + "total_pages": 1, + "per_page": 50, + "metadata": [ + { + "id": 77889911, + "value": "green", + "resource_id": 1234567, + "metafield_id": 112233, + "deleted_at": null, + "name": "Color" + } + ] +} +``` + # Update Metadata -This method allows you to update the existing metadata associated with a subscription or customer. +Updates metadata and metafields on the Site and the customer or subscription specified, and updates the metadata value on a subscription or customer. + +If you update metadata on a subscription or customer with a metafield that does not already exist, the metafield is created with the metadata you specify and it is always added as a text field to the Site and to the subscription or customer you specify. You can update the input_type for the metafield with the Update Metafield endpoint. + +Each site is limited to 100 unique metafields per resource. This means you can have 100 metafields for Subscription and another 100 for Customer. ```ruby def update_metadata(resource_type, @@ -398,13 +418,13 @@ def update_metadata(resource_type, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resource_id` | `Integer` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `body` | [`UpdateMetadataRequest`](../../doc/models/update-metadata-request.md) | Body, Optional | - | ## Response Type -[`Array`](../../doc/models/metadata.md) +[`Array[Metadata]`](../../doc/models/metadata.md) ## Example Usage @@ -429,29 +449,7 @@ puts result # Delete Metadata -This method removes the metadata from the subscriber/customer cited. - -## Query String Usage - -For instance if you wanted to delete the metadata for customer 99 named weight you would request: - -``` -https://acme.chargify.com/customers/99/metadata.json?name=weight -``` - -If you want to delete multiple metadata fields for a customer 99 named: `weight` and `age` you wrould request: - -``` -https://acme.chargify.com/customers/99/metadata.json?names[]=weight&names[]=age -``` - -## Successful Response - -For a success, there will be a code `200` and the plain text response `true`. - -## Unsuccessful Response - -When a failed response is encountered, you will receive a `404` response and the plain text response of `true`. +Deletes one or more metafields (and associated metadata) from the specified subscription or customer. ```ruby def delete_metadata(resource_type, @@ -464,10 +462,10 @@ def delete_metadata(resource_type, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `resource_id` | `Integer` | Template, Required | The Advanced Billing id of the customer or the subscription for which the metadata applies | | `name` | `String` | Query, Optional | Name of field to be removed. | -| `names` | `Array` | Query, Optional | Names of fields to be removed. Use in query: `names[]=field1&names[]=my-field&names[]=another-field`. | +| `names` | `Array[String]` | Query, Optional | Names of fields to be removed. Use in query: `names[]=field1&names[]=my-field&names[]=another-field`. | ## Response Type @@ -495,19 +493,7 @@ custom_fields_controller.delete_metadata( # List Metadata for Resource Type -This method will provide you information on usage of metadata across your selected resource (ie. subscriptions, customers) - -## Metadata Data - -This endpoint will also display the current stats of your metadata to use as a tool for pagination. - -### Metadata for multiple records - -`https://acme.chargify.com/subscriptions/metadata.json?resource_ids[]=1&resource_ids[]=2` - -## Read Metadata for a Site - -This endpoint will list the number of pages of metadata information that are contained within a site. +Lists metadata for a specified array of subscriptions or customers. ```ruby def list_metadata_for_resource_type(options = {}) @@ -517,7 +503,7 @@ def list_metadata_for_resource_type(options = {}) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong | +| `resource_type` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | The resource type to which the metafields belong. | | `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` | | `date_field` | [`BasicDateField`](../../doc/models/basic-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. | @@ -526,7 +512,7 @@ def list_metadata_for_resource_type(options = {}) | `start_datetime` | `DateTime` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns metadata with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. | | `end_datetime` | `DateTime` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns metadata with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. | | `with_deleted` | `TrueClass \| FalseClass` | Query, Optional | Allow to fetch deleted metadata. | -| `resource_ids` | `Array` | Query, Optional | Allow to fetch metadata for multiple records based on provided ids. Use in query: `resource_ids[]=122&resource_ids[]=123&resource_ids[]=124`.

**Constraints**: *Maximum Items*: `50` | +| `resource_ids` | `Array[Integer]` | Query, Optional | Allow to fetch metadata for multiple records based on provided ids. Use in query: `resource_ids[]=122&resource_ids[]=123&resource_ids[]=124`.

**Constraints**: *Maximum Items*: `50` | | `direction` | [`SortingDirection`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | ## Response Type @@ -538,7 +524,7 @@ def list_metadata_for_resource_type(options = {}) ```ruby collect = { 'resource_type' => ResourceType::SUBSCRIPTIONS, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'date_field' => BasicDateField::UPDATED_AT } diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index 4c1f1f8a..ccbe5289 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -31,7 +31,7 @@ Full documentation on how to locate, create and edit Customers in the Advanced B Advanced Billing requires that you use the ISO Standard Country codes when formatting country attribute of the customer. -Countries should be formatted as 2 characters. For more information, please see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) +Countries should be formatted as 2 characters. For more information, see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) ## Required State Format @@ -39,7 +39,7 @@ Advanced Billing requires that you use the ISO Standard State codes when formatt + US States (2 characters): [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US) -+ States Outside the US (2-3 characters): To find the correct state codes outside of the US, please go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. ++ States Outside the US (2-3 characters): To find the correct state codes outside of the US, go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. ## Locale @@ -144,7 +144,7 @@ Common use cases are: + Search by a reference value from your application + Search by a first or last name -To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). +To retrieve a single, exact match by reference, use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference). ```ruby def list_customers(options = {}) @@ -166,13 +166,13 @@ def list_customers(options = {}) ## Response Type -[`Array`](../../doc/models/customer-response.md) +[`Array[CustomerResponse]`](../../doc/models/customer-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 30, 'date_field' => BasicDateField::UPDATED_AT } @@ -481,7 +481,7 @@ def list_customer_subscriptions(customer_id) ## Response Type -[`Array`](../../doc/models/subscription-response.md) +[`Array[SubscriptionResponse]`](../../doc/models/subscription-response.md) ## Example Usage diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md index baf9177b..5355ad5d 100644 --- a/doc/controllers/events-based-billing-segments.md +++ b/doc/controllers/events-based-billing-segments.md @@ -116,7 +116,7 @@ def list_segments_for_price_point(options = {}) collect = { 'component_id' => 'component_id8', 'price_point_id' => 'price_point_id8', - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListSegmentsFilter.new( segment_property_1_value: 'EU' diff --git a/doc/controllers/events.md b/doc/controllers/events.md index 2144318e..604dd78d 100644 --- a/doc/controllers/events.md +++ b/doc/controllers/events.md @@ -99,7 +99,7 @@ def list_events(options = {}) | `since_id` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified | | `max_id` | `Integer` | Query, Optional | Returns events with an id less than or equal to the one specified | | `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.

**Default**: `Direction::DESC` | -| `filter` | [`Array`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | +| `filter` | [`Array[EventKey]`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | | `date_field` | [`ListEventsDateField`](../../doc/models/list-events-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. | | `start_date` | `String` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. | | `end_date` | `String` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. | @@ -108,13 +108,13 @@ def list_events(options = {}) ## Response Type -[`Array`](../../doc/models/event-response.md) +[`Array[EventResponse]`](../../doc/models/event-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::DESC, 'filter' => [ @@ -219,18 +219,18 @@ def list_subscription_events(options = {}) | `since_id` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified | | `max_id` | `Integer` | Query, Optional | Returns events with an id less than or equal to the one specified | | `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.

**Default**: `Direction::DESC` | -| `filter` | [`Array`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | +| `filter` | [`Array[EventKey]`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | ## Response Type -[`Array`](../../doc/models/event-response.md) +[`Array[EventResponse]`](../../doc/models/event-response.md) ## Example Usage ```ruby collect = { 'subscription_id' => 222, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::DESC, 'filter' => [ @@ -304,7 +304,7 @@ def read_events_count(options = {}) | `since_id` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified | | `max_id` | `Integer` | Query, Optional | Returns events with an id less than or equal to the one specified | | `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.

**Default**: `Direction::DESC` | -| `filter` | [`Array`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | +| `filter` | [`Array[EventKey]`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | ## Response Type @@ -314,7 +314,7 @@ def read_events_count(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::DESC, 'filter' => [ diff --git a/doc/controllers/insights.md b/doc/controllers/insights.md index 7f5728e7..d6915d7e 100644 --- a/doc/controllers/insights.md +++ b/doc/controllers/insights.md @@ -163,7 +163,7 @@ def list_mrr_movements(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 20 } @@ -260,7 +260,7 @@ collect = { ] ), 'at_time' => 'at_time=2022-01-10T10:00:00-05:00', - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::DESC } diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 52f5b7db..64dac0ea 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -116,9 +116,9 @@ def list_invoices(options = {}) | `date_field` | [`InvoiceDateField`](../../doc/models/invoice-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. Use in query `date_field=issue_date`.

**Default**: `InvoiceDateField::DUE_DATE` | | `start_datetime` | `String` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns invoices with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. Allowed to be used only along with date_field set to created_at or updated_at. | | `end_datetime` | `String` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns invoices with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. Allowed to be used only along with date_field set to created_at or updated_at. | -| `customer_ids` | `Array` | Query, Optional | Allows fetching invoices with matching customer id based on provided values. Use in query `customer_ids=1,2,3`. | -| `number` | `Array` | Query, Optional | Allows fetching invoices with matching invoice number based on provided values. Use in query `number=1234,1235`. | -| `product_ids` | `Array` | Query, Optional | Allows fetching invoices with matching line items product ids based on provided values. Use in query `product_ids=23,34`. | +| `customer_ids` | `Array[Integer]` | Query, Optional | Allows fetching invoices with matching customer id based on provided values. Use in query `customer_ids=1,2,3`. | +| `number` | `Array[String]` | Query, Optional | Allows fetching invoices with matching invoice number based on provided values. Use in query `number=1234,1235`. | +| `product_ids` | `Array[Integer]` | Query, Optional | Allows fetching invoices with matching line items product ids based on provided values. Use in query `product_ids=23,34`. | | `sort` | [`InvoiceSortField`](../../doc/models/invoice-sort-field.md) | Query, Optional | Allows specification of the order of the returned list. Use in query `sort=total_amount`.

**Default**: `InvoiceSortField::NUMBER` | ## Response Type @@ -129,7 +129,7 @@ def list_invoices(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::DESC, 'line_items' => false, @@ -204,7 +204,7 @@ puts result "organization": "", "email": "meg@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -270,7 +270,7 @@ puts result "organization": "", "email": "food@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "", "line2": "", @@ -336,7 +336,7 @@ puts result "organization": "123", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 Anywhere Street", "line2": "", @@ -402,7 +402,7 @@ puts result "organization": "", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -516,7 +516,7 @@ puts result "organization": null, "email": "joe@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": null, "line2": null, @@ -625,7 +625,7 @@ def list_invoice_events(options = {}) | `per_page` | `Integer` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 100. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.

**Default**: `100` | | `invoice_uid` | `String` | Query, Optional | Providing an invoice_uid allows for scoping of the invoice events to a single invoice or credit note. | | `with_change_invoice_status` | `String` | Query, Optional | Use this parameter if you want to fetch also invoice events with change_invoice_status type. | -| `event_types` | [`Array`](../../doc/models/invoice-event-type.md) | Query, Optional | Filter results by event_type. Supply a comma separated list of event types (listed above). Use in query: `event_types=void_invoice,void_remainder`. | +| `event_types` | [`Array[InvoiceEventType]`](../../doc/models/invoice-event-type.md) | Query, Optional | Filter results by event_type. Supply a comma separated list of event types (listed above). Use in query: `event_types=void_invoice,void_remainder`. | ## Response Type @@ -635,7 +635,7 @@ def list_invoice_events(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 100 } @@ -1206,7 +1206,7 @@ def list_credit_notes(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'line_items' => false, 'discounts' => false, @@ -2052,7 +2052,7 @@ def list_consolidated_invoice_segments(options = {}) ```ruby collect = { 'invoice_uid' => 'invoice_uid0', - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::ASC } @@ -2105,7 +2105,7 @@ puts result "organization": "", "email": "meg@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -2171,7 +2171,7 @@ puts result "organization": "", "email": "food@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "", "line2": "", @@ -2237,7 +2237,7 @@ puts result "organization": "123", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 Anywhere Street", "line2": "", @@ -2303,7 +2303,7 @@ puts result "organization": "", "email": "example@example.com" }, - "memo": "Please pay within 15 days.", + "memo": "Payment due within 15 days of receipt.", "billing_address": { "street": "123 I Love Cats Way", "line2": "", @@ -2428,6 +2428,42 @@ If You want to use existing coupon for discount creation, only `code` and option ... ``` +#### Using Coupon Subcodes + +You can also use coupon subcodes to apply existing coupons with specific subcodes: + +```json +... + "coupons": [ + { + "subcode": "SUB1", + "product_family_id": 1 + } + ] +... +``` + +**Important:** You cannot specify both `code` and `subcode` for the same coupon. Use either: + +- `code` to apply a main coupon +- `subcode` to apply a specific coupon subcode + +The API response will include both the main coupon code and the subcode used: + +```json +... + "coupons": [ + { + "code": "MAIN123", + "subcode": "SUB1", + "product_family_id": 1, + "percentage": 10, + "description": "Special discount" + } + ] +... +``` + ### Coupon options #### Code @@ -2436,6 +2472,10 @@ Coupon `code` will be displayed on invoice discount section. Coupon code can only contain uppercase letters, numbers, and allowed special characters. Lowercase letters will be converted to uppercase. It can be used to select an existing coupon from the catalog, or as an ad hoc coupon when passed with `percentage` or `amount`. +#### Subcode + +Coupon `subcode` allows you to apply existing coupons using their subcodes. When a subcode is used, the API response will include both the main coupon code and the specific subcode that was applied. Subcodes are case-insensitive and will be converted to uppercase automatically. + #### Percentage Coupon `percentage` can take values from 0 to 100 and up to 4 decimal places. It cannot be used with `amount`. Only for ad hoc coupons, will be ignored if `code` is used to select an existing coupon from the catalog. @@ -2495,7 +2535,7 @@ By default, invoices will be created with a due date matching the date of invoic #### Addresses -The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. Please see below for the details on which parameters can be sent for each address object. +The seller, shipping and billing addresses can be sent to override the site's defaults. Each address requires to send a `first_name` at a minimum in order to work. See below for the details on which parameters can be sent for each address object. #### Memo and Payment Instructions @@ -2653,9 +2693,9 @@ 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. -Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. +If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. -On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. +On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. ```ruby def send_invoice(uid, diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md index cfee1fed..f89b9d88 100644 --- a/doc/controllers/offers.md +++ b/doc/controllers/offers.md @@ -146,7 +146,7 @@ def list_offers(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'include_archived' => true } diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 4a163dfd..0f369d2f 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -26,236 +26,37 @@ payment_profiles_controller = client.payment_profiles # Create Payment Profile -Use this endpoint to create a payment profile for a customer. +Creates a payment profile for a customer. -Payment Profiles house the credit card, ACH (Authorize.Net or Stripe only,) or PayPal (Braintree only,) data for a customer. The payment information is attached to the customer within Advanced Billing, as opposed to the Subscription itself. +When you create a new payment profile for a customer via the API, it does not automatically make the profile current for any of the customer’s subscriptions. To use the payment profile as the default, you must set it explicitly for the subscription or subscription group. -You must include a customer_id so that Advanced Billing will attach it to the customer entry. If no customer_id is included the API will return a 404. +Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating payment profiles. -## Create a Payment Profile for ACH usage +Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. -If you would like to create a payment method that is a Bank Account applicable for ACH payments use the following: +Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. -```json -{ -"payment_profile": { - "customer_id": [Valid-Customer-ID], - "bank_name": "Best Bank", - "bank_routing_number": "021000089", - "bank_account_number": "111111111111", - "bank_account_type": "checking", - "bank_account_holder_type": "business", - "payment_type": "bank_account" - } -} -``` - -## Taxable Subscriptions - -If your subscriber pays taxes on their purchased product, and you are attempting to create or update the `payment_profile`, complete address information is required. For information on required address formatting to allow your subscriber to be taxed, please see our documentation [here](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-signups#taxes) - -## Payment Profile Documentation - -Full documentation on how Payment Profiles operate within Advanced Billing can be located under the following links: +See the following articles to learn more about subscriptions and payments: + [Subscriber Payment Details](https://maxio.zendesk.com/hc/en-us/articles/24251599929613-Subscription-Summary-Payment-Details-Tab) + [Self Service Pages](https://maxio.zendesk.com/hc/en-us/articles/24261425318541-Self-Service-Pages) (Allows credit card updates by Subscriber) + [Public Signup Pages payment settings](https://maxio.zendesk.com/hc/en-us/articles/24261368332557-Individual-Page-Settings) - -## Create a Payment Profile with a Chargify.js token - -```json -{ - "payment_profile": { - "customer_id": 1036, - "chargify_token": "tok_w68qcpnftyv53jk33jv6wk3w" - } -} -``` - -## Active Payment Methods - -Creating a new payment profile for a Customer via the API will not make that Payment Profile current for any of the Customer’s Subscriptions. In order to utilize the payment profile as the default, it must be set as the default payment profile for the subscription or subscription group. - -## Requirements - -Either the full_number, expiration_month, and expiration_year or if you have an existing vault_token from your gateway, that vault_token and the current_vault are required. -Passing in the vault_token and current_vault are only allowed when creating a new payment profile. - -### Taxable Subscriptions - -If your subscriber pays taxes on their purchased product, and you are attempting to create or update the `payment_profile`, complete address information is required. For information on required address formatting to allow your subscriber to be taxed, please see our documentation [here](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-signups#taxes) - -## BraintreeBlue - -Some merchants use Braintree JavaScript libraries directly and then pass `payment_method_nonce` and/or `paypal_email` to create a payment profile. This implementation is deprecated and does not handle 3D Secure. Instead, we have provided [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDI0-overview) which is continuously improved and supports Credit Cards (along with 3D Secure), PayPal and ApplePay payment types. - -## GoCardless - -For more information on GoCardless, please view the following resources: - ++ [Taxes](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-signups#taxes) ++ [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview) + + [Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) + + [Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) + + [Chargify.js with Stripe Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) + + [Chargify.js with Stripe Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRECQQ4ECS3ZA55GY7) + + [Chargify.js with Stripe BECS Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway) + + [Chargify.js with Stripe BECS Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) + [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless) - -+ [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) - -+ [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) - -### GoCardless with Local Bank Details - -Following examples create customer, bank account and mandate in GoCardless: - -```json -{ - "payment_profile": { - "customer_id": "Valid-Customer-ID", - "bank_name": "Royal Bank of France", - "bank_account_number": "0000000", - "bank_routing_number": "0003", - "bank_branch_code": "00006", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } -} -``` - -### GoCardless with IBAN - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "French Bank", - "bank_iban": "FR1420041010050500013M02606", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } -} -``` - -### Importing GoCardless - -If the customer, bank account, and mandate already exist in GoCardless, a payment profile can be created by using the IDs. In order to create masked versions of `bank_account_number` and `bank_routing_number` that are used to display within Advanced Billing Admin UI, you can pass the last four digits for this fields which then will be saved in this form `XXXX[four-provided-digits]`. - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "customer_vault_token": [Existing GoCardless Customer ID] - "vault_token": [Existing GoCardless Mandate ID], - "current_vault": "gocardless", - "bank_name": "French Bank", - "bank_account_number": [Last Four Of The Existing Account Number or IBAN if applicable], - "bank_routing_number": [Last Four Of The Existing Routing Number], - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } -} -``` - -## SEPA Direct Debit - -For more information on Stripe SEPA Direct Debit, please view the following resources: - + [Full documentation on Stripe SEPA Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRECQQ4ECS3ZA55GY7) - -### Stripe SEPA Direct Debit Payment Profiles - -The following example creates a customer, bank account and mandate in Stripe: - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "Deutsche bank", - "bank_iban": "DE89370400440532013000", - "payment_type": "bank_account", - "billing_address": "Test", - "billing_city": "Berlin", - "billing_state": "Brandenburg", - "billing_zip": "12345", - "billing_country": "DE" - } -} -``` - -## Stripe BECS Direct Debit - -For more information on Stripe BECS Direct Debit, please view the following resources: - + [Full documentation on Stripe BECS Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe BECS Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway) - -+ [Using Chargify.js with Stripe BECS Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) - -### Stripe BECS Direct Debit Payment Profiles - -The following example creates a customer, bank account and mandate in Stripe: - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "Australian bank", - "bank_branch_code": "000000", - "bank_account_number": "000123456" - "payment_type": "bank_account", - "billing_address": "Test", - "billing_city": "Stony Rise", - "billing_state": "Tasmania", - "billing_zip": "12345", - "billing_country": "AU" - } -} -``` - -## Stripe BACS Direct Debit - -Contact the support team to enable this payment method. -For more information on Stripe BACS Direct Debit, please view the following resources: - + [Full documentation on Stripe BACS Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) -### Stripe BACS Direct Debit Payment Profiles +## 3D Secure Authentication during payment profile creation. -The following example creates a customer, bank account and mandate in Stripe: - -```json -{ - "payment_profile": { - "customer_id": "24907598", - "bank_name": "British bank", - "bank_branch_code": "108800", - "bank_account_number": "00012345" - "payment_type": "bank_account", - "billing_address": "Test", - "billing_city": "London", - "billing_state": "LND", - "billing_zip": "12345", - "billing_country": "GB" - } -} -``` - -## 3D Secure - Checkout - -It may happen that a payment needs 3D Secure Authentication when the payment profile is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: +When a payment requires 3D Secure Authentication to adhear to Strong Customer Authentication (SCA) during payment profile creation, the request enters a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). In this case, a 422 Unprocessable Entity status is returned with the following response: ```json { @@ -275,29 +76,34 @@ It may happen that a payment needs 3D Secure Authentication when the payment pro ``` To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. -Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information: + +Optionally, you can specify the `callback_url` parameter in the `action_link` URL to receive notification about the result of 3D Secure Authentication. + +The `callback_url` will return the following information: - whether the authentication was successful (`success`) - the payment profile ID (`payment_profile_id`) -Lastly, you can also specify a `redirect_url` parameter within the `action_link` URL if you’d like to redirect a customer back to your site. +You can also specify a `redirect_url` parameter in the `action_link` URL to redirect the customer back to your site. + +You cannot use action_link in an iframe inside a custom application. You must redirect the customer directly to the `action_link` and use the `redirect_url` or `callback_url` to be notified of the result. -It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. +The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: -The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://checkout-test.chargifypay.test/3d-secure/checkout/pay_uerzhsxd5uhkbodx5jhvkg6yeu?one_time_token_id=93&callback_url=http://localhost:4000&redirect_url=https://yourpage.com` +`https://checkout-test.chargifypay.test/3d-secure/checkout/pay_uerzhsxd5uhkbodx5jhvkg6yeu?one_time_token_id=93&callback_url=http://localhost:4000&redirect_url=https://yourpage.com` ### Example Redirect Flow -You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference: +Here's an example flow to redirect customers to different pages depending on whether SCA was performed successfully: -1. Create a payment profile via API; it requires 3DS -2. You receive a `action_link` in the response. -3. Use this `action_link` to, for example, connect with your internal resources or generate a session_id -4. Include 1 of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to +1. Create a payment profile via the API; it requires 3DS. +2. You receive an `action_link` in the response. +3. Use this `action_link` to, for example, connect with your internal resources or generate a `session_id`. +4. Include one of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to. 5. Redirect the customer to the `action_link` with `callback_url` and `redirect_url` applied -6. After the customer finishes 3DS authentication, we let you know the result by making a request to applied `callback_url`. -7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known -8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not +6. After the customer completes 3DS authentication, we notify you of the result via the applied `callback_url`. +7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known. +8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine if the redirect was successful. ```ruby def create_payment_profile(body: nil) @@ -318,13 +124,8 @@ def create_payment_profile(body: nil) ```ruby body = CreatePaymentProfileRequest.new( payment_profile: CreatePaymentProfile.new( - payment_type: PaymentType::BANK_ACCOUNT, - customer_id: 123, - bank_name: 'Best Bank', - bank_routing_number: '021000089', - bank_account_number: '111111111111', - bank_account_type: BankAccountType::CHECKING, - bank_account_holder_type: BankAccountHolderType::BUSINESS + chargify_token: 'tok_w68qcpnftyv53jk33jv6wk3w', + customer_id: 1036 ) ) @@ -387,13 +188,13 @@ def list_payment_profiles(options = {}) ## Response Type -[`Array`](../../doc/models/payment-profile-response.md) +[`Array[PaymentProfileResponse]`](../../doc/models/payment-profile-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50 } @@ -469,7 +270,7 @@ puts result Using the GET method you can retrieve a Payment Profile identified by its unique ID. -Please note that a different JSON object will be returned if the card method on file is a bank account. +Note that a different JSON object will be returned if the card method on file is a bank account. ### Response for Bank Account @@ -628,11 +429,6 @@ body = UpdatePaymentProfileRequest.new( payment_profile: UpdatePaymentProfile.new( first_name: 'Graham', last_name: 'Test', - full_number: '4111111111111111', - card_type: CardType::MASTER, - expiration_month: '04', - expiration_year: '2030', - current_vault: AllVaults::BOGUS, billing_address: '456 Juniper Court', billing_city: 'Boulder', billing_state: 'CO', @@ -657,23 +453,13 @@ puts result "id": 10088716, "first_name": "Test", "last_name": "Subscription", - "masked_card_number": "XXXX-XXXX-XXXX-1", - "card_type": "bogus", - "expiration_month": 1, - "expiration_year": 2022, - "customer_id": 14543792, - "current_vault": "bogus", - "vault_token": "1", "billing_address": "123 Montana Way", "billing_city": "Billings", "billing_state": "MT", "billing_zip": "59101", "billing_country": "US", - "customer_vault_token": null, "billing_address_2": "", - "payment_type": "credit_card", - "site_gateway_setting_id": 1, - "gateway_handle": null + "payment_type": "bank_account" } } ``` @@ -805,8 +591,8 @@ puts result { "payment_profile": { "id": 10089892, - "first_name": "Chester", - "last_name": "Tester", + "first_name": "John", + "last_name": "Doe", "customer_id": 14543792, "current_vault": "stripe_connect", "vault_token": "cus_0123abc456def", diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md index 823b2815..30e027cb 100644 --- a/doc/controllers/product-families.md +++ b/doc/controllers/product-families.md @@ -18,7 +18,7 @@ product_families_controller = client.product_families # List Products for Product Family -This method allows to retrieve a list of Products belonging to a Product Family. +Retrieves a list of Products belonging to a Product Family. ```ruby def list_products_for_product_family(options = {}) @@ -42,14 +42,14 @@ def list_products_for_product_family(options = {}) ## Response Type -[`Array`](../../doc/models/product-response.md) +[`Array[ProductResponse]`](../../doc/models/product-response.md) ## Example Usage ```ruby collect = { 'product_family_id' => 'product_family_id4', - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'date_field' => BasicDateField::UPDATED_AT, 'filter' => ListProductsFilter.new( @@ -174,7 +174,7 @@ puts result # Create Product Family -This method will create a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. +Creates a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. Full documentation on how Product Families operate within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product-Families). @@ -229,7 +229,7 @@ puts result # List Product Families -This method allows to retrieve a list of Product Families for a site. +Retrieve a list of Product Families for a site. ```ruby def list_product_families(options = {}) @@ -247,7 +247,7 @@ def list_product_families(options = {}) ## Response Type -[`Array`](../../doc/models/product-family-response.md) +[`Array[ProductFamilyResponse]`](../../doc/models/product-family-response.md) ## Example Usage @@ -292,7 +292,7 @@ puts result # Read Product Family -This method allows to retrieve a Product Family via the `product_family_id`. The response will contain a Product Family object. +Retrieves a Product Family via the `product_family_id`. The response will contain a Product Family object. The product family can be specified either with the id number, or with the `handle:my-family` format. diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md index ffc1a45c..db95360a 100644 --- a/doc/controllers/product-price-points.md +++ b/doc/controllers/product-price-points.md @@ -25,7 +25,7 @@ product_price_points_controller = client.product_price_points # Create Product Price Point -[Product Price Point Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points) +Creates a Product Price Point. See the [Product Price Point](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product-Price-Points) documentation for details. ```ruby def create_product_price_point(product_id, @@ -58,7 +58,7 @@ body = CreateProductPricePointRequest.new( trial_price_in_cents: 4900, trial_interval: 1, trial_interval_unit: IntervalUnit::MONTH, - trial_type: 'payment_expected', + trial_type: TrialType::PAYMENT_EXPECTED, initial_charge_in_cents: 120000, initial_charge_after_trial: false, expiration_interval: 12, @@ -109,7 +109,7 @@ puts result # List Product Price Points -Use this endpoint to retrieve a list of product price points. +Retrieves a list of product price points. ```ruby def list_product_price_points(options = {}) @@ -123,7 +123,7 @@ def list_product_price_points(options = {}) | `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 10. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.

**Default**: `10`

**Constraints**: `<= 200` | | `currency_prices` | `TrueClass \| FalseClass` | Query, Optional | When fetching a product's price points, if you have defined multiple currencies at the site level, you can optionally pass the ?currency_prices=true query param to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. | -| `filter_type` | [`Array`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. | +| `filter_type` | [`Array[PricePointType]`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. | | `archived` | `TrueClass \| FalseClass` | Query, Optional | Set to include archived price points in the response. | ## Response Type @@ -135,7 +135,7 @@ def list_product_price_points(options = {}) ```ruby collect = { 'product_id' => 124, - 'page' => 2, + 'page' => 1, 'per_page' => 10, 'filter_type' => Liquid error: Value cannot be null. (Parameter 'key') } @@ -176,9 +176,9 @@ puts result # Update Product Price Point -Use this endpoint to update a product price point. +Updates a product price point. -Note: Custom product price points are not able to be updated. +Note: Custom product price points cannot be updated. ```ruby def update_product_price_point(product_id, @@ -314,7 +314,7 @@ puts result # Archive Product Price Point -Use this endpoint to archive a product price point. +Archives a product price point. ```ruby def archive_product_price_point(product_id, @@ -444,9 +444,9 @@ puts result # Promote Product Price Point to Default -Use this endpoint to make a product price point the default for the product. +Sets a product price point as the default for the product. -Note: Custom product price points are not able to be set as the default for a product. +Note: Custom product price points cannot be set as the default for a product. ```ruby def promote_product_price_point_to_default(product_id, @@ -534,7 +534,7 @@ puts result # Bulk Create Product Price Points -Use this endpoint to create multiple product price points in one request. +Creates multiple product price points in one request. ```ruby def bulk_create_product_price_points(product_id, @@ -568,7 +568,7 @@ body = BulkCreateProductPricePointsRequest.new( trial_price_in_cents: 4900, trial_interval: 1, trial_interval_unit: IntervalUnit::MONTH, - trial_type: 'payment_expected', + trial_type: TrialType::PAYMENT_EXPECTED, initial_charge_in_cents: 120000, initial_charge_after_trial: false, expiration_interval: 12, @@ -583,7 +583,7 @@ body = BulkCreateProductPricePointsRequest.new( trial_price_in_cents: 4900, trial_interval: 1, trial_interval_unit: IntervalUnit::MONTH, - trial_type: 'payment_expected', + trial_type: TrialType::PAYMENT_EXPECTED, initial_charge_in_cents: 120000, initial_charge_after_trial: false, expiration_interval: 12, @@ -637,7 +637,7 @@ puts result # Create Product Currency Prices -This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings. +Creates currency prices for a given currency that has been defined on the site level in your settings. When creating currency prices, they need to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. @@ -717,11 +717,11 @@ puts result # Update Product Currency Prices -This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point. +Updates the `price`s of currency prices for a given currency that exists on the product price point. When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. -Note: Currency Prices are not able to be updated for custom product price points. +Note: Currency Prices cannot be updated for custom product price points. ```ruby def update_product_currency_prices(product_price_point_id, @@ -831,7 +831,7 @@ collect = { ] ), 'include' => ListProductsPricePointsInclude::CURRENCY_PRICES, - 'page' => 2, + 'page' => 1, 'per_page' => 50 } diff --git a/doc/controllers/products.md b/doc/controllers/products.md index 165c94cb..2f160577 100644 --- a/doc/controllers/products.md +++ b/doc/controllers/products.md @@ -20,7 +20,9 @@ products_controller = client.products # Create Product -Use this method to create a product within your Advanced Billing site. +Creates a product in your Advanced Billing site. + +See the following product docuemation for more information: + [Products Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview) + [Changing a Subscription's Product](https://maxio.zendesk.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations) @@ -126,7 +128,7 @@ puts result # Read Product -This endpoint allows you to read the current details of a product that you've created in Advanced Billing. +Reads the current details of a product. ```ruby def read_product(product_id) @@ -197,7 +199,7 @@ puts result # Update Product -Use this method to change aspects of an existing product. +Updates aspects of an existing product. ### Input Attributes Update Notes @@ -289,7 +291,7 @@ puts result # Archive Product -Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. +Archives the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly. This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product. @@ -368,7 +370,7 @@ puts result # Read Product by Handle -This method allows to retrieve a Product object by its `api_handle`. +Retrieves a Product object by its `api_handle`. ```ruby def read_product_by_handle(api_handle) @@ -487,7 +489,7 @@ def list_products(options = {}) ## Response Type -[`Array`](../../doc/models/product-response.md) +[`Array[ProductResponse]`](../../doc/models/product-response.md) ## Example Usage @@ -501,7 +503,7 @@ collect = { 3 ] ), - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'include_archived' => true, 'include' => ListProductsInclude::PREPAID_PRODUCT_PRICE_POINT diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md index 4f122cff..3cc83ddb 100644 --- a/doc/controllers/proforma-invoices.md +++ b/doc/controllers/proforma-invoices.md @@ -152,7 +152,7 @@ puts result This endpoint will create a proforma invoice and return it as a response. If the information becomes outdated, simply void the old proforma invoice and generate a new one. -If you would like to preview the next billing amounts without generating a full proforma invoice, please use the renewal preview endpoint. +If you would like to preview the next billing amounts without generating a full proforma invoice, use the renewal preview endpoint. ## Restrictions @@ -223,7 +223,7 @@ def list_proforma_invoices(options = {}) ```ruby collect = { 'subscription_id' => 222, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'direction' => Direction::DESC, 'line_items' => false, diff --git a/doc/controllers/reason-codes.md b/doc/controllers/reason-codes.md index 641e8cf0..7515fe26 100644 --- a/doc/controllers/reason-codes.md +++ b/doc/controllers/reason-codes.md @@ -88,13 +88,13 @@ def list_reason_codes(options = {}) ## Response Type -[`Array`](../../doc/models/reason-code-response.md) +[`Array[ReasonCodeResponse]`](../../doc/models/reason-code-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50 } diff --git a/doc/controllers/sales-commissions.md b/doc/controllers/sales-commissions.md index e31db29f..046e8959 100644 --- a/doc/controllers/sales-commissions.md +++ b/doc/controllers/sales-commissions.md @@ -23,7 +23,7 @@ Endpoint returns subscriptions with associated sales reps The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). -Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. +Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. > Note: The request is at seller level, it means `<>` variable will be replaced by `app` @@ -43,7 +43,7 @@ def list_sales_commission_settings(options = {}) ## Response Type -[`Array`](../../doc/models/sale-rep-settings.md) +[`Array[SaleRepSettings]`](../../doc/models/sale-rep-settings.md) ## Example Usage @@ -51,7 +51,7 @@ def list_sales_commission_settings(options = {}) collect = { 'seller_id' => 'seller_id8', 'authorization' => 'Bearer <>', - 'page' => 2, + 'page' => 1, 'per_page' => 100 } @@ -102,7 +102,7 @@ Endpoint returns sales rep list with details The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). -Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. +Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. > Note: The request is at seller level, it means `<>` variable will be replaced by `app` @@ -122,7 +122,7 @@ def list_sales_reps(options = {}) ## Response Type -[`Array`](../../doc/models/list-sale-rep-item.md) +[`Array[ListSaleRepItem]`](../../doc/models/list-sale-rep-item.md) ## Example Usage @@ -130,7 +130,7 @@ def list_sales_reps(options = {}) collect = { 'seller_id' => 'seller_id8', 'authorization' => 'Bearer <>', - 'page' => 2, + 'page' => 1, 'per_page' => 100 } @@ -230,7 +230,7 @@ Endpoint returns sales rep and attached subscriptions details. The Sales Commission API differs from other Chargify API endpoints. This resource is associated with the seller itself. Up to now all available resources were at the level of the site, therefore creating the API Key per site was a sufficient solution. To share resources at the seller level, a new authentication method was introduced, which is user authentication. Creating an API Key for a user is a required step to correctly use the Sales Commission API, more details [here](https://developers.chargify.com/docs/developer-docs/ZG9jOjMyNzk5NTg0-2020-04-20-new-api-authentication). -Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics please contact Maxio support. +Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. > Note: The request is at seller level, it means `<>` variable will be replaced by `app` @@ -267,7 +267,7 @@ sales_rep_id = 'sales_rep_id4' authorization = 'Bearer <>' -page = 2 +page = 1 per_page = 100 diff --git a/doc/controllers/sites.md b/doc/controllers/sites.md index 08315377..a7d6e768 100644 --- a/doc/controllers/sites.md +++ b/doc/controllers/sites.md @@ -153,7 +153,7 @@ def list_chargify_js_public_keys(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50 } diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index db2bc3bc..d9e00639 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -112,16 +112,16 @@ def list_subscription_components(options = {}) | `end_date` | `String` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. | | `end_datetime` | `String` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of end_date. | | `price_point_ids` | [`IncludeNotNull`](../../doc/models/include-not-null.md) | Query, Optional | Allows fetching components allocation only if price point id is present. Use in query `price_point_ids=not_null`. | -| `product_family_ids` | `Array` | Query, Optional | Allows fetching components allocation with matching product family id based on provided ids. Use in query `product_family_ids=1,2,3`. | +| `product_family_ids` | `Array[Integer]` | Query, Optional | Allows fetching components allocation with matching product family id based on provided ids. Use in query `product_family_ids=1,2,3`. | | `sort` | [`ListSubscriptionComponentsSort`](../../doc/models/list-subscription-components-sort.md) | Query, Optional | The attribute by which to sort. Use in query `sort=updated_at`. | | `start_date` | `String` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. | | `start_datetime` | `String` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of start_date. | -| `include` | [`Array`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription,historic_usages`. | +| `include` | [`Array[ListSubscriptionComponentsInclude]`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription,historic_usages`. | | `in_use` | `TrueClass \| FalseClass` | Query, Optional | If in_use is set to true, it returns only components that are currently in use. However, if it's set to false or not provided, it returns all components connected with the subscription. | ## Response Type -[`Array`](../../doc/models/subscription-component-response.md) +[`Array[SubscriptionComponentResponse]`](../../doc/models/subscription-component-response.md) ## Example Usage @@ -558,7 +558,7 @@ def list_allocations(subscription_id, ## Response Type -[`Array`](../../doc/models/allocation-response.md) +[`Array[AllocationResponse]`](../../doc/models/allocation-response.md) ## Example Usage @@ -567,7 +567,7 @@ subscription_id = 222 component_id = 222 -page = 2 +page = 1 result = subscription_components_controller.list_allocations( subscription_id, @@ -652,7 +652,7 @@ def allocate_components(subscription_id, ## Response Type -[`Array`](../../doc/models/allocation-response.md) +[`Array[AllocationResponse]`](../../doc/models/allocation-response.md) ## Example Usage @@ -1024,34 +1024,35 @@ subscription_components_controller.delete_prepaid_usage_allocation( # Create Usage -## Documentation +Records an instance of metered or prepaid usage for a subscription. + +You can report metered or prepaid usage to Advanced Billing as often as you wish. You can report usage as it happens or periodically, such as each night or once per billing period. -Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, please see the following resources: +Full documentation on how to create Components in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). Additionally, for information on how to record component usage against a subscription, see the following resources: -+ [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage) -+ [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status) +It is not possible to record metered usage for more than one component at a time Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. -You may choose to report metered or prepaid usage to Advanced Billing as often as you wish. You may report usage as it happens. You may also report usage periodically, such as each night or once per billing period. If usage events occur in your system very frequently (on the order of thousands of times an hour), it is best to accumulate usage into batches on your side, and then report those batches less frequently, such as daily. This will ensure you remain below any API throttling limits. If your use case requires higher rates of usage reporting, we recommend utilizing Events Based Components. +See the following product documention articles for more information: -## Create Usage for Subscription +- [Create and Manage Components](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-Edit-and-Archive-Components). A +- [Recording Metered Component Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-metered-component-usage) +- [Reporting Prepaid Component Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporting-Component-Allocations#reporting-prepaid-component-status) -This endpoint allows you to record an instance of metered or prepaid usage for a subscription. The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](./b3A6MTQxMDgzNzQ-read-subscription-component) for the subscription. +The `quantity` from usage for each component is accumulated to the `unit_balance` on the [Component Line Item](../../doc/controllers/subscription-components.md#read-subscription-component) for the subscription. ## Price Point ID usage -If you are using price points, for metered and prepaid usage components, Advanced Billing gives you the option to specify a price point in your request. +If you are using price points, for metered and prepaid usage components Advanced Billing gives you the option to specify a price point in your request. You do not need to specify a price point ID. If a price point is not included, the default price point for the component will be used when the usage is recorded. -If an invalid `price_point_id` is submitted, the endpoint will return an error. - ## Deducting Usage -In the event that you need to reverse a previous usage report or otherwise deduct from the current usage balance, you may provide a negative quantity. +If you need to reverse a previous usage report or otherwise deduct from the current usage balance, you can provide a negative quantity. Example: -Previously recorded: +Previously recorded quantity was 5000: ```json { @@ -1062,7 +1063,7 @@ Previously recorded: } ``` -At this point, `unit_balance` would be `5000`. To reduce the balance to `0`, POST the following payload: +To reduce the quantity to `0`, POST the following payload: ```json { @@ -1075,12 +1076,6 @@ At this point, `unit_balance` would be `5000`. To reduce the balance to `0`, POS The `unit_balance` has a floor of `0`; negative unit balances are never allowed. For example, if the usage balance is 100 and you deduct 200 units, the unit balance would then be `0`, not `-100`. -## FAQ - -Q. Is it possible to record metered usage for more than one component at a time? - -A. No. Usage should be reported as one API call per component on a single subscription. For example, to record that a subscriber has sent both an SMS Message and an Email, send an API call for each. - ```ruby def create_usage(subscription_id_or_reference, component_id, @@ -1183,7 +1178,7 @@ def list_usages(options = {}) ## Response Type -[`Array`](../../doc/models/usage-response.md) +[`Array[UsageResponse]`](../../doc/models/usage-response.md) ## Example Usage @@ -1191,7 +1186,7 @@ def list_usages(options = {}) collect = { 'subscription_id_or_reference' => 234, 'component_id' => 144, - 'page' => 2, + 'page' => 1, 'per_page' => 50 } @@ -1411,7 +1406,7 @@ def bulk_record_events(api_handle, | --- | --- | --- | --- | | `api_handle` | `String` | Template, Required | Identifies the Stream for which the events should be published. | | `store_uid` | `String` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. | -| `body` | [`Array`](../../doc/models/ebb-event.md) | Body, Optional | - | +| `body` | [`Array[EBBEvent]`](../../doc/models/ebb-event.md) | Body, Optional | - | ## Server @@ -1464,9 +1459,9 @@ def list_subscription_components_for_site(options = {}) | `start_datetime` | `String` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of start_date. Use in query `start_datetime=2022-07-01 09:00:05`. | | `end_date` | `String` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. Use in query `end_date=2011-12-16`. | | `end_datetime` | `String` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of end_date. Use in query `end_datetime=2022-07-01 09:00:05`. | -| `subscription_ids` | `Array` | Query, Optional | Allows fetching components allocation with matching subscription id based on provided ids. Use in query `subscription_ids=1,2,3`.

**Constraints**: *Minimum Items*: `1`, *Maximum Items*: `200` | +| `subscription_ids` | `Array[Integer]` | Query, Optional | Allows fetching components allocation with matching subscription id based on provided ids. Use in query `subscription_ids=1,2,3`.

**Constraints**: *Minimum Items*: `1`, *Maximum Items*: `200` | | `price_point_ids` | [`IncludeNotNull`](../../doc/models/include-not-null.md) | Query, Optional | Allows fetching components allocation only if price point id is present. Use in query `price_point_ids=not_null`. | -| `product_family_ids` | `Array` | Query, Optional | Allows fetching components allocation with matching product family id based on provided ids. Use in query `product_family_ids=1,2,3`. | +| `product_family_ids` | `Array[Integer]` | Query, Optional | Allows fetching components allocation with matching product family id based on provided ids. Use in query `product_family_ids=1,2,3`. | | `include` | [`ListSubscriptionComponentsInclude`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription,historic_usages`. | ## Response Type @@ -1477,7 +1472,7 @@ def list_subscription_components_for_site(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'sort' => ListSubscriptionComponentsSort::UPDATED_AT, 'filter' => ListSubscriptionComponentsForSiteFilter.new( diff --git a/doc/controllers/subscription-group-invoice-account.md b/doc/controllers/subscription-group-invoice-account.md index c9ce2d62..27fa044d 100644 --- a/doc/controllers/subscription-group-invoice-account.md +++ b/doc/controllers/subscription-group-invoice-account.md @@ -90,7 +90,7 @@ def list_prepayments_for_subscription_group(options = {}) ```ruby collect = { 'uid' => 'uid0', - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListPrepaymentsFilter.new( date_field: ListPrepaymentDateField::CREATED_AT, diff --git a/doc/controllers/subscription-group-status.md b/doc/controllers/subscription-group-status.md index b440eb83..e94842c4 100644 --- a/doc/controllers/subscription-group-status.md +++ b/doc/controllers/subscription-group-status.md @@ -18,9 +18,9 @@ subscription_group_status_controller = client.subscription_group_status # Cancel Subscriptions in Group -This endpoint will immediately cancel all subscriptions within the specified group. The group is identified by it's `uid` passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members as well must be on automatic billing or they must be prepaid. +Cancels all subscriptions within the specified group immediately. The group is identified by the `uid` that is passed in the URL. To successfully cancel the group, the primary subscription must be on automatic billing. The group members must be on automatic billing or prepaid. -In order to cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. +To cancel a subscription group while also charging for any unbilled usage on metered or prepaid components, the `charge_unbilled_usage=true` parameter must be included in the request. ```ruby def cancel_subscriptions_in_group(uid, @@ -62,7 +62,7 @@ subscription_group_status_controller.cancel_subscriptions_in_group( # Initiate Delayed Cancellation for Group -This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by it's uid passed in the URL. +This endpoint will schedule all subscriptions within the specified group to be canceled at the end of their billing period. The group is identified by its uid passed in the URL. All subscriptions in the group must be on automatic billing in order to successfully cancel them, and the group must not be in a "past_due" state. diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md index d0ca5f29..b64f6145 100644 --- a/doc/controllers/subscription-groups.md +++ b/doc/controllers/subscription-groups.md @@ -32,6 +32,8 @@ You must provide one and only one of the `payment_profile_id`/`credit_card_attri Only one of the `subscriptions` can have `"primary": true` attribute set. When passing product to a subscription you can use either `product_id` or `product_handle` or `offer_id`. You can also use `custom_price` instead. +The subscription request examples below will be split into two sections. +The first section, "Subscription Customization", will focus on passing different information with a subscription, such as components, calendar billing, and custom fields. These examples will presume you are using a secure chargify_token generated by Chargify.js. ```ruby def signup_with_subscription_group(body: nil) @@ -163,7 +165,7 @@ def list_subscription_groups(options = {}) | --- | --- | --- | --- | | `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` | -| `include` | [`Array`](../../doc/models/subscription-groups-list-include.md) | Query, Optional | A list of additional information to include in the response. The following values are supported:

- `account_balances`: Account balance information for the subscription groups. Use in query: `include[]=account_balances` | +| `include` | [`Array[SubscriptionGroupsListInclude]`](../../doc/models/subscription-groups-list-include.md) | Query, Optional | A list of additional information to include in the response. The following values are supported:

- `account_balances`: Account balance information for the subscription groups. Use in query: `include[]=account_balances` | ## Response Type @@ -173,7 +175,7 @@ def list_subscription_groups(options = {}) ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'include' => [ SubscriptionGroupsListInclude::ACCOUNT_BALANCES @@ -241,7 +243,7 @@ def read_subscription_group(uid, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `uid` | `String` | Template, Required | The uid of the subscription group | -| `include` | [`Array`](../../doc/models/subscription-group-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=current_billing_amount_in_cents`. | +| `include` | [`Array[SubscriptionGroupInclude]`](../../doc/models/subscription-group-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=current_billing_amount_in_cents`. | ## Response Type @@ -504,7 +506,7 @@ For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/ Passing `group` parameters with a `target` containing a `type` and optional `id` is all that's needed. When the `target` parameter specifies a `"customer"` or `"subscription"` that is already part of a hierarchy, the subscription will become a member of the customer's subscription group. If the target customer or subscription is not part of a subscription group, a new group will be created and the subscription will become part of the group with the specified target customer set as the responsible payer for the group's subscriptions. -**Please Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. +**Note:** In order to add an existing subscription to a subscription group, it must belong to either the same customer record as the target, or be within the same customer hierarchy. Rather than specifying a customer, the `target` parameter could instead simply have a value of @@ -512,7 +514,7 @@ Rather than specifying a customer, the `target` parameter could instead simply h * `"parent"` which indicates the subscription will be paid for by the subscribing customer's parent within a customer hierarchy, or * `"eldest"` which indicates the subscription will be paid for by the root-level customer in the subscribing customer's hierarchy. -To create a new subscription into a subscription group, please reference the following: +To create a new subscription into a subscription group, reference the following: [Create Subscription in a Subscription Group](https://developers.chargify.com/docs/api-docs/d571659cf0f24-create-subscription#subscription-in-a-subscription-group) ```ruby diff --git a/doc/controllers/subscription-invoice-account.md b/doc/controllers/subscription-invoice-account.md index fb18368d..219d3329 100644 --- a/doc/controllers/subscription-invoice-account.md +++ b/doc/controllers/subscription-invoice-account.md @@ -55,7 +55,7 @@ In order to specify a prepayment made against a subscription, specify the `amoun When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. -Please note that you **can't** pass `amount_in_cents`. +Note that passing `amount_in_cents` is now allowed. ```ruby def create_prepayment(subscription_id, @@ -143,7 +143,7 @@ def list_prepayments(options = {}) ```ruby collect = { 'subscription_id' => 222, - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'filter' => ListPrepaymentsFilter.new( date_field: ListPrepaymentDateField::CREATED_AT, @@ -315,7 +315,7 @@ def list_service_credits(subscription_id, ```ruby subscription_id = 222 -page = 2 +page = 1 per_page = 50 diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md index 8d1e9ed1..ea70da7d 100644 --- a/doc/controllers/subscription-notes.md +++ b/doc/controllers/subscription-notes.md @@ -89,14 +89,14 @@ def list_subscription_notes(options = {}) ## Response Type -[`Array`](../../doc/models/subscription-note-response.md) +[`Array[SubscriptionNoteResponse]`](../../doc/models/subscription-note-response.md) ## Example Usage ```ruby collect = { 'subscription_id' => 222, - 'page' => 2, + 'page' => 1, 'per_page' => 50 } diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md index 1d789749..16e73251 100644 --- a/doc/controllers/subscription-products.md +++ b/doc/controllers/subscription-products.md @@ -30,11 +30,11 @@ Full documentation on how to record Migrations in the Advanced Billing UI can be ## Failed Migrations -One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to it's current product. Please be aware of this issue! +Importaint note: One of the most common ways that a migration can fail is when the attempt is made to migrate a subscription to its current product. ## Migration 3D Secure - Stripe -It may happen that a payment needs 3D Secure Authentication when the subscription is migrated to a new product; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: +When a payment requires 3D Secure Authentication to adhear to Strong Customer Authentication (SCA) when the subscription is migrated to a new product, the request enters a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: ```json { @@ -62,7 +62,7 @@ The final URL that you send a customer to to complete 3D Secure may resemble the ### Example Redirect Flow -You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference: +You may wish to redirect customers to different pages depending on whether SCA was performed successfully. Here's an example flow to use as a reference: 1. Create a migration via API; it requires 3DS 2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 8a6d1fec..6f9722e6 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -524,7 +524,7 @@ This will place the subscription in the on_hold state and it will not renew. ## Limitations -You may not place a subscription on hold if the `next_billing` date is within 24 hours. +You may not place a subscription on hold if the `next_billing_at` date is within 24 hours. ```ruby def pause_subscription(subscription_id, @@ -851,8 +851,7 @@ puts result Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). -**Please note: The term -"resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.** +**Note: The term "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.** + The response returns the subscription object in the `active` or `trialing` state. + The `canceled_at` and `cancellation_message` fields do not have values. @@ -1288,7 +1287,7 @@ puts result The Chargify API allows you to preview a renewal by posting to the renewals endpoint. Renewal Preview is an object representing a subscription’s next assessment. You can retrieve it to see a snapshot of how much your customer will be charged on their next renewal. -The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). +The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). ## Optional Component Fields diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 6c9abfe4..c30f7916 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -26,624 +26,21 @@ subscriptions_controller = client.subscriptions # Create Subscription -Full documentation on how subscriptions operate within Advanced Billing can be located under the following topics: +Creates a Subscription for a customer and product -+ [Subscriptions Reference](https://maxio.zendesk.com/hc/en-us/articles/24251526991757-Subscription-Overview) -+ [Subscriptions Actions](https://maxio.zendesk.com/hc/en-us/articles/24251983024653-Subscription-Actions-Overview) -+ [Subscription Cancellation](https://maxio.zendesk.com/hc/en-us/articles/24251957778829-Cancel-Subscriptions) -+ [Subscription Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming) -+ [Subscription Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) +Specify the product with `product_id` or `product_handle`. To set a specific product pricepPoint, use `product_price_point_handle` or `product_price_point_id`. -When creating a subscription, you must specify a product and a customer. Credit card details may be required, depending on the options for the Product being subscribed ([see Product Options](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing)). +Identify an existing customer with `customer_id` or `customer_reference`. Optionally, include an existing payment profile using `payment_profile_id`. To create a new customer, pass customer_attributes. -The product may be specified by `product_id` or by `product_handle` (API Handle). In similar fashion, to pass a particular product price point, you may either use `product_price_point_handle` or `product_price_point_id`. +Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating subscriptions. -An existing customer may be specified by a `customer_id` (ID within Advanced Billing) or a `customer_reference` (unique value within your app that you have shared with Advanced Billing via the reference attribute on a customer). You may also pass in an existing payment profile for that customer with `payment_profile_id`. A new customer may be created by providing `customer_attributes`. +Payment information may be required to create a subscription, depending on the options for the Product being subscribed. See [product options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Products) for more information. See the [Payments Profile](../../doc/controllers/payment-profiles.md#create-payment-profile) endpoint for details on payment parameters. -Credit card details may be required, depending on the options for the product being subscribed. The product can be specified by `product_id` or by `product_handle` (API Handle). +Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. -If you are creating a subscription with a payment profile, the attribute to send will be `credit_card_attributes` or `bank_account_attributes` for ACH and Direct Debit. That said, when you read the subscription after creation, we return the profile details under `credit_card` or `bank_account`. +Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. -## Bulk creation of subscriptions - -Bulk creation of subscriptions is currently not supported. For scenarios where multiple subscriptions must be added, particularly when assigning to the same subscription group, it is essential to switch to a single-threaded approach. - -To avoid data conflicts or inaccuracies, incorporate a sleep interval between requests. - -While this single-threaded approach may impact performance, it ensures data consistency and accuracy in cases where concurrent creation attempts could otherwise lead to issues with subscription alignment and integrity. - -## Taxable Subscriptions - -If your intent is to charge your subscribers tax via [Avalara Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara-VAT-Tax) or [Custom Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-Taxes), there are a few considerations to be made regarding collecting subscription data. -For subscribers to be eligible to be taxed, the following information for the `customer` object or `payment_profile` object must by supplied: - -+ A subscription to a [taxable product](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing#tax-settings) -+ [Full valid billing or shipping address](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanced-Billing-Managed-Sales-Tax#full-address-required-for-taxable-subscriptions) to identify the tax locale -+ The portion of the address that houses the [state information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanced-Billing-Managed-Sales-Tax#required-state-format-for-taxable-subscriptions) of either adddress must adhere to the ISO standard of a 2-3 character limit/format. -+ The portion of the address that houses the [country information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanced-Billing-Managed-Sales-Tax#required-country-format-for-taxable-subscriptions) must adhere to the ISO standard of a 2 character limit/format. - -## Subscription Request Examples - -The subscription examples below will be split into two sections. - -The first section, "Subscription Customization", will focus on passing different information with a subscription, such as components, calendar billing, and custom fields. These examples will presume you are using a secure `chargify_token` generated by Chargify.js. - -The second section, "Passing Payment Information", will focus on passing payment information into Advanced Billing. Please be aware that collecting and sending Advanced Billing raw card details requires PCI compliance on your end; these examples are provided as guidance. If your business is not PCI compliant, we recommend using Chargify.js to collect credit cards or bank accounts. - -# Subscription Customization - -## With Components - -Different components require slightly different data. For example, quantity-based and on/off components accept `allocated_quantity`, while metered components accept `unit_balance`. - -When creating a subscription with a component, a `price_point_id` can be passed in along with the `component_id` to specify which price point to use. If not passed in, the default price point will be used. - -Note: if an invalid `price_point_id` is used, the subscription will still proceed but will use the component's default price point. - -Components and their price points may be added by ID or by handle. See the example request body labeled "Components By Handle (Quantity-Based)"; the format will be the same for other component types. - -## With Coupon(s) - -Pass an array of `coupon_codes`. See the example request body "With Coupon". - -## With Manual Invoice Collection - -The `invoice` collection method works only on legacy Statement Architecture. - -On Relationship Invoicing Architecture use the `remittance` collection method. - -## Prepaid Subscription - -A prepaid subscription can be created with the usual subscription creation parameters, specifying `prepaid` as the `payment_collection_method` and including a nested `prepaid_configuration`. - -After a prepaid subscription has been created, additional funds can be manually added to the prepayment account through the [Create Prepayment Endpoint](https://developers.chargify.com/docs/api-docs/7ec482de77ba7-create-prepayment). - -Prepaid subscriptions do not work on legacy Statement Architecture. - -## With Metafields - -Metafields can either attach to subscriptions or customers. Metafields are popuplated with the supplied metadata to the resource specified. - -If the metafield doesn't exist yet, it will be created on-the-fly. - -## With Custom Pricing - -Custom pricing is pricing specific to the subscription in question. -Create a subscription with custom pricing by passing pricing information instead of a price point. -For a custom priced product, pass the custom_price object in place of `product_price_point_id`. For a custom priced component, pass the `custom_price` object within the component object. -Custom prices and price points can exist in harmony on a subscription. - -# Passing Payment Information - -## Subscription with Chargify.js token - -The `chargify_token` can be obtained using [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0). The token represents payment profile attributes that were provided by the customer in their browser and stored at the payment gateway. - -The `payment_type` attribute may either be `credit_card` or `bank_account`, depending on the type of payment method being added. If a bank account is being passed, the payment attributes should be changed to `bank_account_attributes`. - -```json -{ - "subscription": { - "product_handle": "pro-plan", - "customer_attributes": { - "first_name": "Joe", - "last_name": "Smith", - "email": "j.smith@example.com" - }, - "credit_card_attributes": { - "chargify_token": "tok_cwhvpfcnbtgkd8nfkzf9dnjn", - "payment_type": "credit_card" - } - } -} -``` - -## Subscription with vault token - -If you already have a customer and card stored in your payment gateway, you may create a subscription with a `vault_token`. Providing the last_four, card type and expiration date will allow the card to be displayed properly in the Advanced Billing UI. - -```json -{ - "subscription": { - "product_handle": "pro-plan", - "customer_attributes": { - "first_name": "Joe", - "last_name": "Smith", - "email": "j.smith@example.com" - }, - "credit_card_attributes": { - first_name: "Joe, - last_name: "Smith", - card_type: "visa", - expiration_month: "05", - expiration_year: "2025", - last_four: "1234", - vault_token: "12345abc", - current_vault: "braintree_blue" - } -} -``` - -## Subscription with ACH as Payment Profile - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Joe", - "last_name": "Blow", - "email": "joe@example.com", - "zip": "02120", - "state": "MA", - "reference": "XYZ", - "phone": "(617) 111 - 0000", - "organization": "Acme", - "country": "US", - "city": "Boston", - "address_2": null, - "address": "123 Mass Ave." - }, - "bank_account_attributes": { - "bank_name": "Best Bank", - "bank_routing_number": "021000089", - "bank_account_number": "111111111111", - "bank_account_type": "checking", - "bank_account_holder_type": "business", - "payment_type": "bank_account" - } - } -} -``` - -## Subscription with PayPal payment profile - -### With the nonce from Braintree JS - -```json -{ "subscription": { - "product_handle":"test-product-b", - "customer_attributes": { - "first_name":"Amelia", - "last_name":"Johnson", - "email":"amelia@example.com", - "organization":"My Awesome Company" - }, - "payment_profile_attributes":{ - "paypal_email": "amelia@example.com", - "current_vault": "braintree_blue", - "payment_method_nonce":"abc123", - "payment_type":"paypal_account" - } - } -``` - -### With the Braintree Customer ID as the vault token: - -```json -{ "subscription": { - "product_handle":"test-product-b", - "customer_attributes": { - "first_name":"Amelia", - "last_name":"Johnson", - "email":"amelia@example.com", - "organization":"My Awesome Company" - }, - "payment_profile_attributes":{ - "paypal_email": "amelia@example.com", - "current_vault": "braintree_blue", - "vault_token":"58271347", - "payment_type":"paypal_account" - } - } -``` - -## Subscription using GoCardless Bank Number - -These examples creates a customer, bank account and mandate in GoCardless. - -For more information on GoCardless, please view the following two resources: - -+ [Payment Profiles via API for GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#gocardless) - -+ [Full documentation on GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoCardless) - -+ [Using Chargify.js with GoCardless - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQZKCER8CFK40MR6XJ) - -+ [Using Chargify.js with GoCardless - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Royal Bank of France", - "bank_account_number": "0000000", - "bank_routing_number": "0003", - "bank_branch_code": "00006", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } - } -} -``` - -## Subscription using GoCardless IBAN Number - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "French Bank", - "bank_iban": "FR1420041010050500013M02606", - "payment_type": "bank_account", - "billing_address": "20 Place de la Gare", - "billing_city": "Colombes", - "billing_state": "Île-de-France", - "billing_zip": "92700", - "billing_country": "FR" - } - } -} -``` - -## Subscription using Stripe SEPA Direct Debit - -For more information on Stripe Direct Debit, please view the following two resources: - -+ [Payment Profiles via API for Stripe SEPA Direct Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#sepa-direct-debit) - -+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe SEPA Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR09JVHWW0MCA7HVJV) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_iban": "DE89370400440532013000", - "payment_type": "bank_account" - } - } -} -``` - -## Subscription using Stripe BECS Direct Debit - -For more information on Stripe Direct Debit, please view the following two resources: - -+ [Payment Profiles via API for Stripe BECS Direct Debit](../../doc/controllers/payment-profiles.md#create-payment-profile) - -+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe BECS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QRX4B1TYZKZD8ZND6D) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_branch_code": "000000", - "bank_account_number": "000123456", - "payment_type": "bank_account" - } - } -} -``` - -## Subscription using Stripe BACS Direct Debit - -For more information on Stripe Direct Debit, please view the following two resources: - -+ [Payment Profiles via API for Stripe BACS Direct Debit](../../doc/controllers/payment-profiles.md#create-payment-profile) - -+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit) - -+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - -+ [Using Chargify.js with Stripe BACS Direct Debit - full example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples#h_01K0PJ15QR7PA1DJ3XE9MD05FM) - -```json -{ - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_branch_code": "108800", - "bank_account_number": "00012345", - "payment_type": "bank_account", - "billing_address": "123 Main St.", - "billing_city": "London", - "billing_state": "LND", - "billing_zip": "W1A 1AA", - "billing_country": "GB" - } - } -} -``` - -## 3D Secure - Stripe - -It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: - -```json -{ - "errors": [ - "Your card was declined. This transaction requires 3D secure authentication." - ], - "gateway_payment_id": "pi_1F0aGoJ2UDb3Q4av7zU3sHPh", - "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.", - "action_link": "http://acme.chargify.com/3d-secure/pi_1F0aGoJ2UDb3Q4av7zU3sHPh?one_time_token_id=242" -} -``` - -To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. -Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information: - -- whether the authentication was successful (`success`) -- the gateway ID for the payment (`gateway_payment_id`) -- the subscription ID (`subscription_id`) - -Lastly, you can also specify a `redirect_url` within the `action_link` URL if you’d like to redirect a customer back to your site. - -It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - -The final URL that you send a customer to to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yourpage.com` - -## 3D Secure - Checkout - -It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-Implementing-3D-Secure#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response: - -```json -{ - "errors": [ - "Your card was declined. This transaction requires 3D secure authentication." - ], - "gateway_payment_id": "pay_6gjofv7dlyrkpizlolsuspvtiu", - "description": "This card requires 3D secure authentication. Redirect the customer to the URL from the action_link attribute to authenticate. Attach callback_url param to this URL if you want to be notified about the result of 3D Secure authentication. Attach redirect_url param to this URL if you want to redirect a customer back to your page after 3D Secure authentication. Example: https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com will do a POST request to https://localhost:4000 after payment is authenticated and will redirect a customer to https://yourpage.com after 3DS authentication.", - "action_link": "http://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123" -} -``` - -To let the customer go through 3D Secure Authentication, they need to be redirected to the URL specified in `action_link`. -Optionally, you can specify `callback_url` parameter in the `action_link` URL if you’d like to be notified about the result of 3D Secure Authentication. The `callback_url` will return the following information: - -- whether the authentication was successful (`success`) -- the gateway ID for the payment (`gateway_payment_id`) -- the subscription ID (`subscription_id`) - -Lastly, you can also specify a `redirect_url` parameter within the `action_link` URL if you’d like to redirect a customer back to your site. - -It is not possible to use `action_link` in an iframe inside a custom application. You have to redirect the customer directly to the `action_link`, then, to be notified about the result, use `redirect_url` or `callback_url`. - -The final URL that you send a customer to complete 3D Secure may resemble the following, where the first half is the `action_link` and the second half contains a `redirect_url` and `callback_url`: `https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_time_token_id=123&callback_url=https://localhost:4000&redirect_url=https://yourpage.com` - -### Example Redirect Flow - -You may wish to redirect customers to different pages depending on whether their SCA was performed successfully. Here's an example flow to use as a reference: - -1. Create a subscription via API; it requires 3DS -2. You receive a `gateway_payment_id` in the `action_link` along other params in the response. -3. Use this `gateway_payment_id` to, for example, connect with your internal resources or generate a session_id -4. Include 1 of those attributes inside the `callback_url` and `redirect_url` to be aware which “session” this applies to -5. Redirect the customer to the `action_link` with `callback_url` and `redirect_url` applied -6. After the customer finishes 3DS authentication, we let you know the result by making a request to applied `callback_url`. -7. After that, we redirect the customer to the `redirect_url`; at this point the result of authentication is known -8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not - -## Subscriptions Import - -Subscriptions can be “imported” via the API to handle the following scenarios: - -+ You already have existing subscriptions with specific start and renewal dates that you would like to import to Advanced Billing -+ You already have credit cards stored in your provider’s vault and you would like to create subscriptions using those tokens - -Before importing, you should have already set up your products to match your offerings. Then, you can create Subscriptions via the API just like you normally would, but using a few special attributes. - -Full documentation on how import Subscriptions using the **import tool** in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports). - -### Important Notices and Disclaimers regarding Imports - -Before performing a bulk import of subscriptions via the API, we suggest reading the [Subscriptions Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) instructions to understand the repurcussions of a large import. - -### Subscription Input Attributes - -The following _additional_ attributes to the subscription input attributes make imports possible: `next_billing_at`, `previous_billing_at`, and `import_mrr`. - -### Current Vault - -If you are using a Legacy gateway such as "eWAY Rapid (Legacy)" or "Stripe (Legacy)" then please contact Support for further instructions on subscription imports. - -### Braintree Blue (Braintree v2) Imports - -Braintree Blue is Braintree’s newer (version 2) API. For this gateway, please provide the `vault_token` parameter with the value from Braintree’s “Customer ID” rather than the “Payment Profile Token”. At this time we do not use `current_vault_token` with the Braintree Blue gateway, and we only support a single payment profile per Braintree Customer. - -When importing PayPal type payment profiles, please set `payment_type` to `paypal_account`. - -### Stripe ACH Imports - -If the bank account has already been verified, currently you will need to create the customer, create the payment profile in Advanced Billing - setting verified=true, then create a subscription using the customer_id and payment_profile_id. - -### Webhooks During Import - -If no `next_billing_at` is provided, webhooks will be fired as normal. If you do set a future `next_billing_at`, only a subset of the webhooks are fired when the subscription is created. Keep reading for more information as to what webhooks will be fired under which scenarios. - -#### Successful creation with Billing Date - -Scenario: If `next_billing_at` provided - -+ `signup_success` -+ `billing_date_change` - -#### Successful creation without Billing Date - -Scenario: If no `next_billing_at` provided - -+ `signup_success` -+ `payment_success` - -#### Unsuccessful creation - -Scenario: If card can’t be charged, and no `next_billing_at` provided - -+ signup_failure - -#### Webhooks fired when next_billing_at is reached: - -+ `renewal_success or renewal_failure` -+ `payment_success or payment_failure` - -### Date and Time Formats - -We will attempt to parse any string you send as the value of next_billing_at in to a date or time. For best results, use a known format like described in “Date and Time Specification” of RFC 2822 or ISO 8601 . - -The following are all equivalent and will work as input to `next_billing_at`: - -``` -Aug 06 2030 11:34:00 -0400 -Aug 06 2030 11:34 -0400 -2030-08-06T11:34:00-04:00 -8/6/2030 11:34:00 EDT -8/6/2030 8:34:00 PDT -2030-08-06T15:34:00Z -``` - -You may also pass just a date, in which case we will assume the time to be noon - -``` -2010-08-06 -``` - -## Subscription Hierarchies & WhoPays - -When subscription groups were first added to our Relationship Invoicing architecture, to group together invoices for related subscriptions and allow for complex customer hierarchies and WhoPays scenarios, they were designed to consist of a primary and a collection of group members. The primary would control many aspects of the group, such as when the consolidated invoice is generated. As of today, groups still function this way. - -In the future, the concept of a "primary" will be removed in order to offer more flexibility into group management and reduce confusion concerning what actions must be done on a primary level, rather than a member level. - -We have introduced a two scheme system as a bridge between these two group organizations. Scheme 1, which is relevant to all subscription groups today, marks the group as being "ruled" by a primary. - -When reading a subscription via API, they will return a top-level attribute called `group`, which will denote which scheme is being used. At this time, the `scheme` attribute will always be 1. - -### Subscription in a Customer Hierarchy - -For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays) features, it is possible to create subscriptions within a customer hierarchy. This can be achieved through the API by passing group parameters in the **Create Subscription** request. - -+ The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - -When the `target` parameter specifies a customer that is already part of a hierarchy, the new subscription will become a member of the customer hierarchy as well. If the target customer is not part of a hierarchy, a new customer hierarchy will be created and both the target customer and the new subscription will become part of the hierarchy with the specified target customer set as the responsible payer for the hierarchy's subscriptions. - -Rather than specifying a customer, the `target` parameter could instead simply have a value of `self` which indicates the subscription will be paid for not by some other customer, but by the subscribing customer. This will be true whether the customer is being created new, is already part of a hierarchy, or already exists outside a hierarchy. A valid payment method must also be specified in the subscription parameters. - -Note that when creating subscriptions in a customer hierarchy, if the customer hierarchy does not already have a payment method, passing valid credit card attributes in the subscription parameters will also result in the payment method being established as the default payment method for the customer hierarchy irrespective of the responsible payer. - -The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the default subscription group in the customer hierarchy. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the default subscription group in the customer hierarchy also. - -### Subscription in a Subscription Group - -For sites making use of [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) it may be desireable to create a subscription as part of a [subscription group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscription-Groups-Overview) in order to rely on [invoice consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). This can be achieved through the API by passing group parameters in the Create Subscription request. The `group` parameters are optional and consist of the required `target` and optional `billing` parameters. - -The `target` parameters specify an existing subscription with which the newly created subscription should be grouped. If the target subscription is already part of a group, the new subscription will become a member of the group as well. If the target subscription is not part of a group, a new group will be created and both the target and the new subscription will become part of the group with the target as the group's primary subscription. - -The optional `billing` parameters specify how some aspects of the billing for the new subscription should be handled. Rather than capturing payment immediately, the `accrue` parameter can be included so that the new subscription charges accrue until the next assessment date. Regarding the date, the `align_date` parameter can be included so that the billing date of the new subscription matches up with the target subscription. When choosing to align the dates, the `prorate` parameter can also be specified so that the new subscription charges are prorated based on the billing period of the target subscription also. - -## Providing Agreement Acceptance Params - -It is possible to provide a proof of customer's acceptance of terms and policies. -We will be storing this proof in case it might be required (i.e. chargeback). -Currently, we already keep it for subscriptions created via Public Signup Pages. -In order to create a subscription with the proof of agreement acceptance, you must provide additional parameters `agreement acceptance` with `ip_address` and at least one url to the policy that was accepted: `terms_url` or `privacy_policy_url`. Additional urls that can be provided: `return_refund_policy_url`, `delivery_policy_url` and -`secure_checkout_policy_url`. - -```json - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "agreement_acceptance": { - "ip_address": "1.2.3.4", - "terms_url": "https://terms.url", - "privacy_policy_url": "https://privacy_policy.url", - "return_refund_policy_url": "https://return_refund_policy.url", - "delivery_policy_url": "https://delivery_policy.url", - "secure_checkout_policy_url": "https://secure_checkout_policy.url" - } - } -} -``` - -**For Maxio Payments subscriptions, the agreement acceptance params are required, with at least terms_url provided.** - -## Providing ACH Agreement params - -It is also possible to provide a proof that a customer authorized ACH agreement terms. -The proof will be stored and the email will be sent to the customer with a copy of the terms (if enabled). -In order to create a subscription with the proof of authorized ACH agreement terms, you must provide the additional parameter `ach_agreement` with the following nested parameters: `agreement_terms`, `authorizer_first_name`, `authorizer_last_name` and `ip_address`. -Each of them is required. - -```json - "subscription": { - "product_handle": "gold-product", - "customer_attributes": { - "first_name": "Jane", - "last_name": "Doe", - "email": "jd@chargify.test" - }, - "bank_account_attributes": { - "bank_name": "Test Bank", - "bank_routing_number": "021000089", - "bank_account_number": "111111111111", - "bank_account_type": "checking", - "bank_account_holder_type": "business", - "payment_type": "bank_account" - }, - "ach_agreement": { - "agreement_terms": "ACH agreement terms", - "authorizer_first_name": "Jane", - "authorizer_last_name": "Doe", - "ip_address": "1.2.3.4" - } - } -``` +See the [Subscription Signups](page:introduction/basic-concepts/subscription-signup) article for more information on working with subscriptions in Advanced Billing. ```ruby def create_subscription(body: nil) @@ -668,7 +65,7 @@ body = CreateSubscriptionRequest.new( payment_collection_method: CollectionMethod::REMITTANCE, customer_attributes: CustomerAttributes.new( first_name: 'Joe', - last_name: 'Blow', + last_name: 'Smith', email: 'joe@example.com', organization: 'Acme', reference: 'XYZ', @@ -868,17 +265,17 @@ def list_subscriptions(options = {}) | `metadata` | `Hash[String, String]` | Query, Optional | The value of the metadata field specified in the parameter. Use in query `metadata[my-field]=value&metadata[other-field]=another_value`. | | `direction` | [`SortingDirection`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | | `sort` | [`SubscriptionSort`](../../doc/models/subscription-sort.md) | Query, Optional | The attribute by which to sort

**Default**: `SubscriptionSort::SIGNUP_DATE` | -| `include` | [`Array`](../../doc/models/subscription-list-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=self_service_page_token`. | +| `include` | [`Array[SubscriptionListInclude]`](../../doc/models/subscription-list-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=self_service_page_token`. | ## Response Type -[`Array`](../../doc/models/subscription-response.md) +[`Array[SubscriptionResponse]`](../../doc/models/subscription-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50, 'start_date' => Date.iso8601('2022-07-01'), 'end_date' => Date.iso8601('2022-08-01'), @@ -897,47 +294,55 @@ puts result # Update Subscription -The subscription endpoint allows you to instantly update one or many attributes about a subscription in a single call. +Updates one or more attributes of a subscription. ## Update Subscription Payment Method -Change the card that your Subscriber uses for their subscription. You can also use this method to simply change the expiration date of the card **if your gateway allows**. +Change the card that your subscriber uses for their subscription. You can also use this method to change the expiration date of the card **if your gateway allows**. -Note that partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. +Do not use real card information for testing. See the Sites articles that cover [testing your site setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Overview#testing-overview-0-0) for more details on testing in your sandbox. + +Note that collecting and sending raw card details in production requires [PCI compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Compliance#pci-compliance-0-0) on your end. If your business is not PCI compliant, use [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Chargify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank account information. + +> Note: Partial card updates for **Authorize.Net** are not allowed via this endpoint. The existing Payment Profile must be directly updated instead. + +## Update Product You also use this method to change the subscription to a different product by setting a new value for product_handle. A product change can be done in two different ways, **product change** or **delayed product change**. -## Product Change +### Product Change -This endpoint may be used to change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you desire complex product changes or prorated upgrades and downgrades instead, please see the documentation on Migrating Subscription Products. +You can change a subscription's product. The new payment amount is calculated and charged at the normal start of the next period. If you require complex product changes or prorated upgrades and downgrades instead, please see the documentation on [Migrating Subscription Products](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations#product-changes-and-migrations-0-0). -To perform a product change, simply set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point will be used. +To perform a product change, set either the `product_handle` or `product_id` attribute to that of a different product from the same site as the subscription. You can also change the price point by passing in either `product_price_point_id` or `product_price_point_handle` - otherwise the new product's default price point is used. ### Delayed Product Change This method also changes the product and/or price point, and the new payment amount is calculated and charged at the normal start of the next period. -This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a Delayed Product Change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. +This method schedules the product change to happen automatically at the subscription’s next renewal date. To perform a delayed product change, set the `product_handle` attribute as you would in a regular product change, but also set the `product_change_delayed` attribute to `true`. No proration applies in this case. You can also perform a delayed change to the price point by passing in either `product_price_point_id` or `product_price_point_handle` -**Note: To cancel a delayed product change, set `next_product_id` to an empty string.** +> **Note:** To cancel a delayed product change, set `next_product_id` to an empty string. ## Billing Date Changes +You can update dates for a subscrption. + ### Regular Billing Date Changes Send the `next_billing_at` to set the next billing date for the subscription. After that date passes and the subscription is processed, the following billing date will be set according to the subscription's product period. -Note that if you pass an invalid date, we will automatically interpret and set the correct date. For example, when February 30 is entered, the next billing will be set to March 2nd in a non-leap year. +> Note: If you pass an invalid date, the correct date is automatically set to he correct date. For example, if February 30 is passed, the next billing would be set to March 2nd in a non-leap year. -The server response will not return data under the key/value pair of `next_billing`. Please view the key/value pair of `current_period_ends_at` to verify that the `next_billing` date has been changed successfully. +The server response will not return data under the key/value pair of `next_billing_at`. View the key/value pair of `current_period_ends_at` to verify that the `next_billing_at` date has been changed successfully. -### Snap Day Changes +### Calendar Billing and Snap Day Changes For a subscription using Calendar Billing, setting the next billing date is a bit different. Send the `snap_day` attribute to change the calendar billing date for **a subscription using a product eligible for calendar billing**. -Note: If you change the product associated with a subscription that contains a `snap_date` and immediately `READ/GET` the subscription data, it will still contain evidence of the existing `snap_date`. This is due to the fact that a product change is instantanous and only affects the product associated with a subscription. After the `next_billing` date arrives, the `snap_day` associated with the subscription will return to `null.` Another way of looking at this is that you willl have to wait for the next billing cycle to arrive before the `snap_date` will reset to `null`. +> Note: If you change the product associated with a subscription that contains a `snap_day` and immediately `READ/GET` the subscription data, it will still contain original `snap_day`. The `snap_day`will will reset to 'null on the next billing cycle. This is because a product change is instantanous and only affects the product associated with a subscription. ```ruby def update_subscription(subscription_id, @@ -1109,7 +514,7 @@ def read_subscription(subscription_id, | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | -| `include` | [`Array`](../../doc/models/subscription-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=coupons&include[]=self_service_page_token`. | +| `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 @@ -1375,7 +780,7 @@ For sites in test mode, you may purge individual subscriptions. Provide the subscription ID in the url. To confirm, supply the customer ID in the query string `ack` parameter. You may also delete the customer record and/or payment profiles by passing `cascade` parameters. For example, to delete just the customer record, the query params would be: `?ack={customer_id}&cascade[]=customer` -If you need to remove subscriptions from a live site, please contact support to discuss your use case. +If you need to remove subscriptions from a live site, contact support to discuss your use case. ### Delete customer and payment profile @@ -1393,7 +798,7 @@ def purge_subscription(subscription_id, | --- | --- | --- | --- | | `subscription_id` | `Integer` | Template, Required | The Chargify id of the subscription | | `ack` | `Integer` | Query, Required | id of the customer. | -| `cascade` | [`Array`](../../doc/models/subscription-purge-type.md) | Query, Optional | Options are "customer" or "payment_profile".
Use in query: `cascade[]=customer&cascade[]=payment_profile`. | +| `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`. | ## Response Type @@ -1496,7 +901,7 @@ The "Next Billing" amount and "Next Billing" date are represented in each Subscr A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction. -For more information, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). +For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). ## Taxable Subscriptions @@ -1506,15 +911,15 @@ This endpoint will preview taxes applicable to a purchase. In order for taxes to + The preview must be for the purchase of a taxable product or component, or combination of the two. + The subscription payload must contain a full billing or shipping address in order to calculate tax -For more information about creating taxable previews, please see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes) +For more information about creating taxable previews, see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes) -You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, please note that when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. +You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` attribute. ## Non-taxable Subscriptions -If you'd like to calculate subscriptions that do not include tax, please feel free to leave off the billing information. +If you'd like to calculate subscriptions that do not include tax you may leave off the billing information. ```ruby def preview_subscription(body: nil) @@ -1872,7 +1277,7 @@ puts result Use this endpoint to remove a coupon from an existing subscription. -For more information on the expected behaviour of removing a coupon from a subscription, please see our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon) +For more information on the expected behaviour of removing a coupon from a subscription, See our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon) ```ruby def remove_coupon_from_subscription(subscription_id, diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md index d728e3d0..b16e72f4 100644 --- a/doc/controllers/webhooks.md +++ b/doc/controllers/webhooks.md @@ -40,13 +40,13 @@ def list_webhooks(options = {}) ## Response Type -[`Array`](../../doc/models/webhook-response.md) +[`Array[WebhookResponse]`](../../doc/models/webhook-response.md) ## Example Usage ```ruby collect = { - 'page' => 2, + 'page' => 1, 'per_page' => 50 } @@ -243,7 +243,7 @@ def list_endpoints ## Response Type -[`Array`](../../doc/models/endpoint.md) +[`Array[Endpoint]`](../../doc/models/endpoint.md) ## Example Usage diff --git a/doc/environment-based-client-initialization.md b/doc/environment-based-client-initialization.md new file mode 100644 index 00000000..9fcd9358 --- /dev/null +++ b/doc/environment-based-client-initialization.md @@ -0,0 +1,68 @@ + +# Environment-Based Client Initialization + +The SDK client can also be initialized directly from environment variables using the `from_env` class method. This allows the SDK to automatically read configuration values from the runtime environment or a `.env` file. + +```ruby +require 'advanced_billing' +include AdvancedBilling + +# Create client from environment +client = Client.from_env +``` + +You can also load values from a `.env` file before creating the client. +To do this, install and use the dotenv +gem: + +``` +gem install dotenv +``` + +Now require 'dotenv/load' automatically loads all variables from a `.env` file into `ENV`, +so the `from_env` method can access them. + +```ruby +require 'dotenv/load' +require 'advanced_billing' +include AdvancedBilling + +# Create client from environment +client = Client.from_env +``` + +The same method can accept keyword arguments to override any values read from the environment. + +```ruby +# To override or fill in values that are not set in the environment, pass them +# as keyword arguments when calling `from_env` +client = Client.from_env(environment: 'us', timeout: 30) +``` + +Values provided through arguments take precedence over those defined in environment variables. + +## Example .env File + +```ruby +SITE='subdomain' +ENVIRONMENT='us' + +USERNAME='username' +PASSWORD='password' + +TIMEOUT=60 +MAX_RETRIES=3 +BACKOFF_FACTOR=2 +RETRY_INTERVAL=1 +RETRY_STATUSES=408,413 +RETRY_METHODS=GET,PUT,DELETE +PROXY_ADDRESS='http://localhost:3000' +PROXY_PORT=8080 +PROXY_USERNAME='username' +PROXY_PASSWORD='password' +``` + +## Note + +- If an environment variable is not defined, the default SDK configuration value will be used. + diff --git a/doc/models/activate-event-based-component.md b/doc/models/activate-event-based-component.md index 2133f772..143bc7ea 100644 --- a/doc/models/activate-event-based-component.md +++ b/doc/models/activate-event-based-component.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `price_point_id` | `Integer` | Optional | The Chargify id of the price point | -| `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. Please note this only works for site with Multifrequency enabled | +| `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) @@ -37,7 +37,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } } ``` diff --git a/doc/models/add-coupons-request.md b/doc/models/add-coupons-request.md index 50f5a0d1..bee9a51c 100644 --- a/doc/models/add-coupons-request.md +++ b/doc/models/add-coupons-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `codes` | `Array` | Optional | - | +| `codes` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/allocate-components.md b/doc/models/allocate-components.md index daa6a5ba..f2afbea0 100644 --- a/doc/models/allocate-components.md +++ b/doc/models/allocate-components.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | | `proration_upgrade_scheme` | `String` | Optional | - | | `proration_downgrade_scheme` | `String` | Optional | - | -| `allocations` | [`Array`](../../doc/models/create-allocation.md) | 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`. | diff --git a/doc/models/allocation-preview.md b/doc/models/allocation-preview.md index 4e52b476..978182c1 100644 --- a/doc/models/allocation-preview.md +++ b/doc/models/allocation-preview.md @@ -17,9 +17,9 @@ | `total_in_cents` | `Integer` | Optional | - | | `direction` | [`AllocationPreviewDirection`](../../doc/models/allocation-preview-direction.md) | Optional | - | | `proration_scheme` | `String` | Optional | - | -| `line_items` | [`Array`](../../doc/models/allocation-preview-line-item.md) | Optional | - | +| `line_items` | [`Array[AllocationPreviewLineItem]`](../../doc/models/allocation-preview-line-item.md) | Optional | - | | `accrue_charge` | `TrueClass \| FalseClass` | Optional | - | -| `allocations` | [`Array`](../../doc/models/allocation-preview-item.md) | Optional | - | +| `allocations` | [`Array[AllocationPreviewItem]`](../../doc/models/allocation-preview-item.md) | Optional | - | | `period_type` | `String` | Optional | - | | `existing_balance_in_cents` | `Integer` | Optional | An integer representing the amount of the subscription's current balance | diff --git a/doc/models/apply-credit-note-event-data.md b/doc/models/apply-credit-note-event-data.md index 5963a504..446c6472 100644 --- a/doc/models/apply-credit-note-event-data.md +++ b/doc/models/apply-credit-note-event-data.md @@ -20,7 +20,7 @@ Example schema for an `apply_credit_note` event | `memo` | `String` | Optional | The credit note memo. | | `role` | `String` | Optional | The role of the credit note (e.g. 'general') | | `consolidated_invoice` | `TrueClass \| FalseClass` | Optional | Shows whether it was applied to consolidated invoice or not | -| `applied_credit_notes` | [`Array`](../../doc/models/applied-credit-note-data.md) | Optional | List of credit notes applied to children invoices (if consolidated invoice) | +| `applied_credit_notes` | [`Array[AppliedCreditNoteData]`](../../doc/models/applied-credit-note-data.md) | Optional | List of credit notes applied to children invoices (if consolidated invoice) | ## Example (as JSON) diff --git a/doc/models/attribute-error.md b/doc/models/attribute-error.md index 5a0bde9a..fb0f364b 100644 --- a/doc/models/attribute-error.md +++ b/doc/models/attribute-error.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `attribute` | `Array` | Required | - | +| `attribute` | `Array[String]` | Required | - | ## Example (as JSON) diff --git a/doc/models/base-refund-error.md b/doc/models/base-refund-error.md index 558e2275..1520cb15 100644 --- a/doc/models/base-refund-error.md +++ b/doc/models/base-refund-error.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `base` | `Array` | Optional | - | +| `base` | `Array[Object]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/base-string-error.md b/doc/models/base-string-error.md index 52436884..dd5c105d 100644 --- a/doc/models/base-string-error.md +++ b/doc/models/base-string-error.md @@ -11,7 +11,7 @@ The error is base if it is not directly associated with a single attribute. | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `base` | `Array` | Optional | - | +| `base` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/billing-manifest.md b/doc/models/billing-manifest.md index 9fc02a87..6c19761f 100644 --- a/doc/models/billing-manifest.md +++ b/doc/models/billing-manifest.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `line_items` | [`Array`](../../doc/models/billing-manifest-item.md) | Optional | - | +| `line_items` | [`Array[BillingManifestItem]`](../../doc/models/billing-manifest-item.md) | Optional | - | | `total_in_cents` | `Integer` | Optional | - | | `total_discount_in_cents` | `Integer` | Optional | - | | `total_tax_in_cents` | `Integer` | Optional | - | diff --git a/doc/models/billing-schedule.md b/doc/models/billing-schedule.md index 25df5c3c..e49e2e78 100644 --- a/doc/models/billing-schedule.md +++ b/doc/models/billing-schedule.md @@ -1,7 +1,7 @@ # Billing Schedule -This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled +This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. ## Structure diff --git a/doc/models/bulk-components-price-point-assignment.md b/doc/models/bulk-components-price-point-assignment.md index b1b70398..b205868d 100644 --- a/doc/models/bulk-components-price-point-assignment.md +++ b/doc/models/bulk-components-price-point-assignment.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `components` | [`Array`](../../doc/models/component-price-point-assignment.md) | Optional | - | +| `components` | [`Array[ComponentPricePointAssignment]`](../../doc/models/component-price-point-assignment.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/bulk-create-product-price-points-request.md b/doc/models/bulk-create-product-price-points-request.md index 8eb27597..efad1a89 100644 --- a/doc/models/bulk-create-product-price-points-request.md +++ b/doc/models/bulk-create-product-price-points-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `price_points` | [`Array`](../../doc/models/create-product-price-point.md) | Required | - | +| `price_points` | [`Array[CreateProductPricePoint]`](../../doc/models/create-product-price-point.md) | Required | - | ## Example (as JSON) @@ -26,7 +26,7 @@ "trial_price_in_cents": 196, "trial_interval": 250, "trial_interval_unit": "day", - "trial_type": "trial_type6" + "trial_type": "no_obligation" } ] } diff --git a/doc/models/bulk-create-product-price-points-response.md b/doc/models/bulk-create-product-price-points-response.md index 1254866e..e143c625 100644 --- a/doc/models/bulk-create-product-price-points-response.md +++ b/doc/models/bulk-create-product-price-points-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `price_points` | [`Array`](../../doc/models/product-price-point.md) | Optional | - | +| `price_points` | [`Array[ProductPricePoint]`](../../doc/models/product-price-point.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/bulk-create-segments.md b/doc/models/bulk-create-segments.md index 4524063b..3e4e7e0e 100644 --- a/doc/models/bulk-create-segments.md +++ b/doc/models/bulk-create-segments.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `segments` | [`Array`](../../doc/models/create-segment.md) | Optional | **Constraints**: *Maximum Items*: `2000` | +| `segments` | [`Array[CreateSegment]`](../../doc/models/create-segment.md) | Optional | **Constraints**: *Maximum Items*: `2000` | ## Example (as JSON) diff --git a/doc/models/bulk-update-segments-item.md b/doc/models/bulk-update-segments-item.md index 58159fe6..495e8a65 100644 --- a/doc/models/bulk-update-segments-item.md +++ b/doc/models/bulk-update-segments-item.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | | `id` | `Integer` | Required | The ID of the segment you want to update. | | `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`](../../doc/models/create-or-update-segment-price.md) | Required | - | +| `prices` | [`Array[CreateOrUpdateSegmentPrice]`](../../doc/models/create-or-update-segment-price.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/bulk-update-segments.md b/doc/models/bulk-update-segments.md index f47d5275..7d1a90fb 100644 --- a/doc/models/bulk-update-segments.md +++ b/doc/models/bulk-update-segments.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `segments` | [`Array`](../../doc/models/bulk-update-segments-item.md) | Optional | **Constraints**: *Maximum Items*: `1000` | +| `segments` | [`Array[BulkUpdateSegmentsItem]`](../../doc/models/bulk-update-segments-item.md) | Optional | **Constraints**: *Maximum Items*: `1000` | ## Example (as JSON) diff --git a/doc/models/calendar-billing.md b/doc/models/calendar-billing.md index 8b8ff4b6..fa3fce8e 100644 --- a/doc/models/calendar-billing.md +++ b/doc/models/calendar-billing.md @@ -11,14 +11,14 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `snap_day` | Integer \| String \| nil | Optional | This is a container for one-of cases. | +| `snap_day` | Integer \| [SnapDay](../../doc/models/snap-day.md) \| 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": 210, + "snap_day": 28, "calendar_billing_first_charge": "prorated" } ``` diff --git a/doc/models/chargify-ebb.md b/doc/models/chargify-ebb.md index 4505090e..606deee5 100644 --- a/doc/models/chargify-ebb.md +++ b/doc/models/chargify-ebb.md @@ -10,8 +10,8 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `timestamp` | `DateTime` | Optional | This timestamp determines what billing period the event will be billed in. If your request payload does not include it, Chargify will add `chargify.timestamp` to the event payload and set the value to `now`. | -| `id` | `String` | Optional | A unique ID set by Chargify. Please note that this field is reserved. If `chargify.id` is present in the request payload, it will be overwritten. | -| `created_at` | `DateTime` | Optional | An ISO-8601 timestamp, set by Chargify at the time each event is recorded. Please note that this field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten. | +| `id` | `String` | Optional | A unique ID set by Chargify. This field is reserved. If `chargify.id` is present in the request payload, it will be overwritten. | +| `created_at` | `DateTime` | Optional | An ISO-8601 timestamp, set by Chargify at the time each event is recorded. This field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten. | | `uniqueness_token` | `String` | Optional | User-defined string scoped per-stream. Duplicate events within a stream will be silently ignored. Tokens expire after 31 days.

**Constraints**: *Maximum Length*: `64` | | `subscription_id` | `Integer` | Optional | Id of Maxio Advanced Billing Subscription which is connected to this event.
Provide `subscription_id` if you configured `chargify.subscription_id` as Subscription Identifier in your Event Stream. | | `subscription_reference` | `String` | Optional | Reference of Maxio Advanced Billing Subscription which is connected to this event.
Provide `subscription_reference` if you configured `chargify.subscription_reference` as Subscription Identifier in your Event Stream. | diff --git a/doc/models/component-allocation-error-exception.md b/doc/models/component-allocation-error-exception.md index eac8e128..a7de6284 100644 --- a/doc/models/component-allocation-error-exception.md +++ b/doc/models/component-allocation-error-exception.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `errors` | [`Array`](../../doc/models/component-allocation-error-item.md) | Optional | - | +| `errors` | [`Array[ComponentAllocationErrorItem]`](../../doc/models/component-allocation-error-item.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/component-cost-data.md b/doc/models/component-cost-data.md index e39b7c67..0f6b8804 100644 --- a/doc/models/component-cost-data.md +++ b/doc/models/component-cost-data.md @@ -15,7 +15,7 @@ | `quantity` | `String` | Optional | - | | `amount` | `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. | -| `tiers` | [`Array`](../../doc/models/component-cost-data-rate-tier.md) | Optional | - | +| `tiers` | [`Array[ComponentCostDataRateTier]`](../../doc/models/component-cost-data-rate-tier.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/component-currency-prices-response.md b/doc/models/component-currency-prices-response.md index d052f005..4f1686ba 100644 --- a/doc/models/component-currency-prices-response.md +++ b/doc/models/component-currency-prices-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/component-currency-price.md) | Required | - | +| `currency_prices` | [`Array[ComponentCurrencyPrice]`](../../doc/models/component-currency-price.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index 36a98f41..da84a323 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -15,7 +15,11 @@ 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`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1 | +| `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. | +| `expiration_interval_unit` | [`ExpirationIntervalUnit`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only when rollover is enabled. Interval unit for rollover expiration (month or day). | ## Example (as JSON) @@ -31,7 +35,8 @@ Create or update custom pricing unique to the subscription. Used in place of `pr "tax_included": false, "pricing_scheme": "stairstep", "interval": 162, - "interval_unit": "day" + "interval_unit": "day", + "renew_prepaid_allocation": false } ``` diff --git a/doc/models/component-price-point-error-exception.md b/doc/models/component-price-point-error-exception.md index 971c0968..87f0a0c2 100644 --- a/doc/models/component-price-point-error-exception.md +++ b/doc/models/component-price-point-error-exception.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `errors` | [`Array`](../../doc/models/component-price-point-error-item.md) | Optional | - | +| `errors` | [`Array[ComponentPricePointErrorItem]`](../../doc/models/component-price-point-error-item.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/component-price-point-item.md b/doc/models/component-price-point-item.md index d83312c3..ee68f4e8 100644 --- a/doc/models/component-price-point-item.md +++ b/doc/models/component-price-point-item.md @@ -14,7 +14,7 @@ | `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. | | `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`](../../doc/models/price.md) | Optional | - | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md index 5d182e7b..b9739951 100644 --- a/doc/models/component-price-point.md +++ b/doc/models/component-price-point.md @@ -19,14 +19,14 @@ | `archived_at` | `DateTime` | Optional | - | | `created_at` | `DateTime` | Optional | - | | `updated_at` | `DateTime` | Optional | - | -| `prices` | [`Array`](../../doc/models/component-price.md) | 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`](../../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. | -| `overage_prices` | [`Array`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | +| `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. | +| `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. | diff --git a/doc/models/component-price-points-response.md b/doc/models/component-price-points-response.md index 1b5b24a7..679b8d94 100644 --- a/doc/models/component-price-points-response.md +++ b/doc/models/component-price-points-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `price_points` | [`Array`](../../doc/models/component-price-point.md) | Optional | - | +| `price_points` | [`Array[ComponentPricePoint]`](../../doc/models/component-price-point.md) | Optional | - | | `meta` | [`ListPublicKeysMeta`](../../doc/models/list-public-keys-meta.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/component.md b/doc/models/component.md index d1c4fcf5..fae88d9c 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -21,15 +21,15 @@ | `price_per_unit_in_cents` | `Integer` | Optional | deprecated - use unit_price instead | | `kind` | [`ComponentKind`](../../doc/models/component-kind.md) | Optional | A handle for the component type | | `archived` | `TrueClass \| FalseClass` | Optional | Boolean flag describing whether a component is archived or not. | -| `taxable` | `TrueClass \| FalseClass` | Optional | Boolean flag describing whether a component is taxable or not. | | `description` | `String` | Optional | The description of the component. | | `default_price_point_id` | `Integer` | Optional | - | -| `overage_prices` | [`Array`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | -| `prices` | [`Array`](../../doc/models/component-price.md) | Optional | An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty. | +| `overage_prices` | [`Array[ComponentPrice]`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | +| `prices` | [`Array[ComponentPrice]`](../../doc/models/component-price.md) | Optional | An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty. | | `price_point_count` | `Integer` | Optional | Count for the number of price points associated with the component | | `price_points_url` | `String` | Optional | URL that points to the location to read the existing price points via GET request | | `default_price_point_name` | `String` | Optional | - | -| `tax_code` | `String` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `taxable` | `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`. | diff --git a/doc/models/consolidated-invoice.md b/doc/models/consolidated-invoice.md index f11f07b4..ef02b81e 100644 --- a/doc/models/consolidated-invoice.md +++ b/doc/models/consolidated-invoice.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `invoices` | [`Array`](../../doc/models/invoice.md) | Optional | - | +| `invoices` | [`Array[Invoice]`](../../doc/models/invoice.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/containers/calendar-billing-snap-day.md b/doc/models/containers/calendar-billing-snap-day.md index 6e04756e..c36a3be2 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 | String` +`Integer | SnapDay` ## Cases | Type | | --- | | `Integer` | -| `String` | +| [`SnapDay`](../../../doc/models/snap-day.md) | diff --git a/doc/models/containers/subscription-snap-day.md b/doc/models/containers/subscription-snap-day.md new file mode 100644 index 00000000..9fd992fc --- /dev/null +++ b/doc/models/containers/subscription-snap-day.md @@ -0,0 +1,14 @@ + +# 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 90030cdb..d7dd7ede 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 -`SnapDay | Integer` +`Integer | SnapDay` ## Cases | Type | | --- | -| [`SnapDay`](../../../doc/models/snap-day.md) | | `Integer` | +| [`SnapDay`](../../../doc/models/snap-day.md) | diff --git a/doc/models/coupon-currency-request.md b/doc/models/coupon-currency-request.md index b44bab2d..d7ec7865 100644 --- a/doc/models/coupon-currency-request.md +++ b/doc/models/coupon-currency-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/update-coupon-currency.md) | Required | - | +| `currency_prices` | [`Array[UpdateCouponCurrency]`](../../doc/models/update-coupon-currency.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/coupon-currency-response.md b/doc/models/coupon-currency-response.md index 0faf3b83..cceaffc3 100644 --- a/doc/models/coupon-currency-response.md +++ b/doc/models/coupon-currency-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/coupon-currency.md) | Optional | - | +| `currency_prices` | [`Array[CouponCurrency]`](../../doc/models/coupon-currency.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/coupon-subcodes-response.md b/doc/models/coupon-subcodes-response.md index 38b22b1a..47053340 100644 --- a/doc/models/coupon-subcodes-response.md +++ b/doc/models/coupon-subcodes-response.md @@ -9,9 +9,9 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `created_codes` | `Array` | Optional | - | -| `duplicate_codes` | `Array` | Optional | - | -| `invalid_codes` | `Array` | Optional | - | +| `created_codes` | `Array[String]` | Optional | - | +| `duplicate_codes` | `Array[String]` | Optional | - | +| `invalid_codes` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/coupon-subcodes.md b/doc/models/coupon-subcodes.md index e6c06c70..2935c369 100644 --- a/doc/models/coupon-subcodes.md +++ b/doc/models/coupon-subcodes.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `codes` | `Array` | Optional | - | +| `codes` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/coupon.md b/doc/models/coupon.md index e22f2976..655c6eb4 100644 --- a/doc/models/coupon.md +++ b/doc/models/coupon.md @@ -38,8 +38,8 @@ | `exclude_mid_period_allocations` | `TrueClass \| FalseClass` | Optional | - | | `apply_on_cancel_at_end_of_period` | `TrueClass \| FalseClass` | Optional | - | | `apply_on_subscription_expiration` | `TrueClass \| FalseClass` | Optional | - | -| `coupon_restrictions` | [`Array`](../../doc/models/coupon-restriction.md) | Optional | - | -| `currency_prices` | [`Array`](../../doc/models/coupon-currency.md) | Optional | Returned in read, find, and list endpoints if the query parameter is provided. | +| `coupon_restrictions` | [`Array[CouponRestriction]`](../../doc/models/coupon-restriction.md) | Optional | - | +| `currency_prices` | [`Array[CouponCurrency]`](../../doc/models/coupon-currency.md) | Optional | Returned in read, find, and list endpoints if the query parameter is provided. | ## Example (as JSON) diff --git a/doc/models/create-allocation.md b/doc/models/create-allocation.md index c4921d85..57f4e429 100644 --- a/doc/models/create-allocation.md +++ b/doc/models/create-allocation.md @@ -19,7 +19,7 @@ | `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`. | | `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. Please note this only works for site with Multifrequency enabled | +| `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. | ## Example (as JSON) diff --git a/doc/models/create-component-price-point.md b/doc/models/create-component-price-point.md index 237ea218..2c775918 100644 --- a/doc/models/create-component-price-point.md +++ b/doc/models/create-component-price-point.md @@ -12,7 +12,7 @@ | `name` | `String` | Required | - | | `handle` | `String` | Optional | - | | `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`](../../doc/models/price.md) | Required | - | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Required | - | | `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. Setting not supported when creating price points in bulk.

**Default**: `true` | | `tax_included` | `TrueClass \| FalseClass` | Optional | Whether or not the price point includes tax. Setting not supported when creating price points in bulk. | | `interval` | `Integer` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/create-currency-prices-request.md b/doc/models/create-currency-prices-request.md index ac723d6e..adce7a12 100644 --- a/doc/models/create-currency-prices-request.md +++ b/doc/models/create-currency-prices-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/create-currency-price.md) | Required | - | +| `currency_prices` | [`Array[CreateCurrencyPrice]`](../../doc/models/create-currency-price.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/create-invoice-coupon.md b/doc/models/create-invoice-coupon.md index 59393da2..a2b42203 100644 --- a/doc/models/create-invoice-coupon.md +++ b/doc/models/create-invoice-coupon.md @@ -10,6 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `code` | `String` | Optional | - | +| `subcode` | `String` | Optional | - | | `percentage` | String \| Float \| nil | Optional | This is a container for one-of cases. | | `amount` | String \| Float \| nil | Optional | This is a container for one-of cases. | | `description` | `String` | Optional | **Constraints**: *Maximum Length*: `255` | @@ -22,9 +23,9 @@ { "percentage": 50.0, "code": "code4", + "subcode": "subcode8", "amount": "String9", - "description": "description4", - "product_family_id": "String3" + "description": "description4" } ``` diff --git a/doc/models/create-invoice-item.md b/doc/models/create-invoice-item.md index 9603e7ae..bcb0dcb8 100644 --- a/doc/models/create-invoice-item.md +++ b/doc/models/create-invoice-item.md @@ -12,8 +12,8 @@ | `title` | `String` | Optional | - | | `quantity` | Float \| String \| nil | Optional | This is a container for one-of cases. | | `unit_price` | Float \| String \| nil | Optional | This is a container for one-of cases. | -| `taxable` | `TrueClass \| FalseClass` | Optional | Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes.

If using Avalara, a tax_code parameter must also be sent. | -| `tax_code` | `String` | Optional | - | +| `taxable` | `TrueClass \| FalseClass` | Optional | Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. If using AvaTax, a tax_code parameter must also be sent. | +| `tax_code` | `String` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `period_range_start` | `String` | Optional | YYYY-MM-DD | | `period_range_end` | `String` | Optional | YYYY-MM-DD | | `product_id` | String \| Integer \| nil | Optional | This is a container for one-of cases. | diff --git a/doc/models/create-invoice.md b/doc/models/create-invoice.md index c33aaa7c..0613f2b2 100644 --- a/doc/models/create-invoice.md +++ b/doc/models/create-invoice.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `line_items` | [`Array`](../../doc/models/create-invoice-item.md) | Optional | - | +| `line_items` | [`Array[CreateInvoiceItem]`](../../doc/models/create-invoice-item.md) | Optional | - | | `issue_date` | `Date` | Optional | - | | `net_terms` | `Integer` | Optional | By default, invoices will be created with a due date matching the date of invoice creation. If a different due date is desired, the net_terms parameter can be sent indicating the number of days in advance the due date should be. | | `payment_instructions` | `String` | Optional | - | @@ -17,7 +17,7 @@ | `seller_address` | [`CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the defaults for the site | | `billing_address` | [`CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer | | `shipping_address` | [`CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer | -| `coupons` | [`Array`](../../doc/models/create-invoice-coupon.md) | Optional | - | +| `coupons` | [`Array[CreateInvoiceCoupon]`](../../doc/models/create-invoice-coupon.md) | Optional | - | | `status` | [`CreateInvoiceStatus`](../../doc/models/create-invoice-status.md) | Optional | **Default**: `CreateInvoiceStatus::OPEN` | ## Example (as JSON) diff --git a/doc/models/create-metadata-request.md b/doc/models/create-metadata-request.md index 8c4d37d7..1a3b437f 100644 --- a/doc/models/create-metadata-request.md +++ b/doc/models/create-metadata-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `metadata` | [`Array`](../../doc/models/create-metadata.md) | Required | - | +| `metadata` | [`Array[CreateMetadata]`](../../doc/models/create-metadata.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/create-metafield.md b/doc/models/create-metafield.md index 555a176f..6689b549 100644 --- a/doc/models/create-metafield.md +++ b/doc/models/create-metafield.md @@ -11,8 +11,8 @@ | --- | --- | --- | --- | | `name` | `String` | Optional | - | | `scope` | [`MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | -| `input_type` | [`MetafieldInput`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' | -| `enum` | `Array` | Optional | Only applicable when input_type is radio or dropdown. Empty strings will not be submitted. | +| `input_type` | [`MetafieldInput`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | +| `enum` | `Array[String]` | Optional | Only applicable when input_type is radio or dropdown. Empty strings will not be submitted. | ## Example (as JSON) diff --git a/doc/models/create-multi-invoice-payment.md b/doc/models/create-multi-invoice-payment.md index 807a078e..62ab0c6a 100644 --- a/doc/models/create-multi-invoice-payment.md +++ b/doc/models/create-multi-invoice-payment.md @@ -14,7 +14,7 @@ | `method` | [`InvoicePaymentMethodType`](../../doc/models/invoice-payment-method-type.md) | Optional | The type of payment method used. Defaults to other. | | `amount` | String \| Float | Required | This is a container for one-of cases. | | `received_on` | `String` | Optional | Date reflecting when the payment was received from a customer. Must be in the past. | -| `applications` | [`Array`](../../doc/models/create-invoice-payment-application.md) | Required | - | +| `applications` | [`Array[CreateInvoicePaymentApplication]`](../../doc/models/create-invoice-payment-application.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/create-offer.md b/doc/models/create-offer.md index d18e2356..e654e7c4 100644 --- a/doc/models/create-offer.md +++ b/doc/models/create-offer.md @@ -14,8 +14,8 @@ | `description` | `String` | Optional | - | | `product_id` | `Integer` | Required | - | | `product_price_point_id` | `Integer` | Optional | - | -| `components` | [`Array`](../../doc/models/create-offer-component.md) | Optional | - | -| `coupons` | `Array` | Optional | - | +| `components` | [`Array[CreateOfferComponent]`](../../doc/models/create-offer-component.md) | Optional | - | +| `coupons` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/create-or-update-endpoint.md b/doc/models/create-or-update-endpoint.md index e1f03f31..1ae5c65a 100644 --- a/doc/models/create-or-update-endpoint.md +++ b/doc/models/create-or-update-endpoint.md @@ -12,7 +12,7 @@ Used to Create or Update Endpoint | Name | Type | Tags | Description | | --- | --- | --- | --- | | `url` | `String` | Required | - | -| `webhook_subscriptions` | [`Array`](../../doc/models/webhook-subscription.md) | Required | - | +| `webhook_subscriptions` | [`Array[WebhookSubscription]`](../../doc/models/webhook-subscription.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/create-or-update-product.md b/doc/models/create-or-update-product.md index 9d9aa3c7..a47d1b69 100644 --- a/doc/models/create-or-update-product.md +++ b/doc/models/create-or-update-product.md @@ -13,18 +13,18 @@ | `handle` | `String` | Optional | The product API handle | | `description` | `String` | Required | The product description | | `accounting_code` | `String` | Optional | E.g. Internal ID or SKU Number | -| `require_credit_card` | `TrueClass \| FalseClass` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, please read this attribute from under the signup page. | +| `require_credit_card` | `TrueClass \| FalseClass` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. | | `price_in_cents` | `Integer` | Required | The product price, in integer cents | | `interval` | `Integer` | Required | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days | | `interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Required | A string representing the interval unit for this product, either month or day | | `trial_price_in_cents` | `Integer` | Optional | The product trial price, in integer cents | | `trial_interval` | `Integer` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product trial would last 30 days. | | `trial_interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product, either month or day | -| `trial_type` | `String` | Optional | - | +| `trial_type` | [`TrialType`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `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 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, either month, day or never | | `auto_create_signup_page` | `TrueClass \| FalseClass` | Optional | - | -| `tax_code` | `String` | Optional | A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.

**Constraints**: *Maximum Length*: `10` | +| `tax_code` | `String` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | ## Example (as JSON) diff --git a/doc/models/create-payment-profile.md b/doc/models/create-payment-profile.md index 83079636..f229b863 100644 --- a/doc/models/create-payment-profile.md +++ b/doc/models/create-payment-profile.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `chargify_token` | `String` | Optional | Token received after sending billing informations using chargify.js. | +| `chargify_token` | `String` | Optional | Token received after sending billing information using chargify.js. | | `id` | `Integer` | Optional | - | | `payment_type` | [`PaymentType`](../../doc/models/payment-type.md) | Optional | - | | `first_name` | `String` | Optional | First name on card or bank account. If omitted, the first_name from customer attributes will be used. | @@ -23,7 +23,7 @@ | `billing_address_2` | `String` | Optional | Second line of the customer’s billing address i.e. Apt. 100 | | `billing_city` | `String` | Optional | The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | | `billing_state` | `String` | Optional | The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | -| `billing_country` | `String` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | +| `billing_country` | `String` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | | `billing_zip` | `String` | Optional | The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | | `current_vault` | [`AllVaults`](../../doc/models/all-vaults.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. | | `vault_token` | `String` | Optional | The “token” provided by your vault storage for an already stored payment profile | diff --git a/doc/models/create-prepaid-usage-component-price-point.md b/doc/models/create-prepaid-usage-component-price-point.md index 378b38eb..62d1e9da 100644 --- a/doc/models/create-prepaid-usage-component-price-point.md +++ b/doc/models/create-prepaid-usage-component-price-point.md @@ -12,7 +12,7 @@ | `name` | `String` | Required | - | | `handle` | `String` | Optional | - | | `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`](../../doc/models/price.md) | Required | - | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Required | - | | `overage_pricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Required | - | | `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.

**Default**: `true` | | `rollover_prepaid_remainder` | `TrueClass \| FalseClass` | Optional | (only for prepaid usage components) Boolean which controls whether or not remaining units should be rolled over to the next period | diff --git a/doc/models/create-product-currency-prices-request.md b/doc/models/create-product-currency-prices-request.md index cc32d88b..86f5278e 100644 --- a/doc/models/create-product-currency-prices-request.md +++ b/doc/models/create-product-currency-prices-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/create-product-currency-price.md) | Required | - | +| `currency_prices` | [`Array[CreateProductCurrencyPrice]`](../../doc/models/create-product-currency-price.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/create-product-price-point-request.md b/doc/models/create-product-price-point-request.md index 625b3fe5..d0d73471 100644 --- a/doc/models/create-product-price-point-request.md +++ b/doc/models/create-product-price-point-request.md @@ -25,7 +25,7 @@ "trial_price_in_cents": 108, "trial_interval": 202, "trial_interval_unit": "day", - "trial_type": "trial_type4" + "trial_type": "no_obligation" } } ``` diff --git a/doc/models/create-product-price-point.md b/doc/models/create-product-price-point.md index 1bcdf3bb..07bb487d 100644 --- a/doc/models/create-product-price-point.md +++ b/doc/models/create-product-price-point.md @@ -17,7 +17,7 @@ | `trial_price_in_cents` | `Integer` | Optional | The product price point trial price, in integer cents | | `trial_interval` | `Integer` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days. | | `trial_interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product price point, either month or day | -| `trial_type` | `String` | Optional | - | +| `trial_type` | [`TrialType`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `initial_charge_in_cents` | `Integer` | Optional | The product price point initial charge, in integer cents | | `initial_charge_after_trial` | `TrueClass \| FalseClass` | Optional | - | | `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. | @@ -37,7 +37,7 @@ "trial_price_in_cents": 48, "trial_interval": 102, "trial_interval_unit": "day", - "trial_type": "trial_type0" + "trial_type": "no_obligation" } ``` diff --git a/doc/models/create-segment.md b/doc/models/create-segment.md index b68559e2..2828f6c8 100644 --- a/doc/models/create-segment.md +++ b/doc/models/create-segment.md @@ -14,7 +14,7 @@ | `segment_property_3_value` | String \| Float \| Integer \| TrueClass \| FalseClass \| nil | Optional | This is a container for one-of cases. | | `segment_property_4_value` | String \| Float \| Integer \| TrueClass \| FalseClass \| nil | Optional | This is a container for one-of cases. | | `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`](../../doc/models/create-or-update-segment-price.md) | Optional | - | +| `prices` | [`Array[CreateOrUpdateSegmentPrice]`](../../doc/models/create-or-update-segment-price.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/create-subscription-group.md b/doc/models/create-subscription-group.md index ab4cbec4..c23657d0 100644 --- a/doc/models/create-subscription-group.md +++ b/doc/models/create-subscription-group.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `subscription_id` | `Integer` | Required | - | -| `member_ids` | `Array` | Optional | - | +| `member_ids` | `Array[Integer]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md index 32cfe38a..e4bf5adf 100644 --- a/doc/models/create-subscription.md +++ b/doc/models/create-subscription.md @@ -15,7 +15,7 @@ | `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 | | `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` | Optional | An array for all the coupons attached to the subscription. | +| `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`. | | `receives_invoice_emails` | `String` | Optional | (Optional) Default: True - Whether or not this subscription is set to receive emails related to this subscription. | | `net_terms` | `String` | Optional | (Optional) Default: null The number of days after renewal (on invoice billing) that a subscription is due. A value between 0 (due immediately) and 180. | @@ -31,7 +31,7 @@ | `payment_profile_attributes` | [`PaymentProfileAttributes`](../../doc/models/payment-profile-attributes.md) | Optional | alias to credit_card_attributes | | `credit_card_attributes` | [`PaymentProfileAttributes`](../../doc/models/payment-profile-attributes.md) | Optional | Credit Card data to create a new Subscription. Interchangeable with `payment_profile_attributes` property. | | `bank_account_attributes` | [`BankAccountAttributes`](../../doc/models/bank-account-attributes.md) | Optional | - | -| `components` | [`Array`](../../doc/models/create-subscription-component.md) | Optional | (Optional) An array of component ids and quantities to be added to the subscription. See [Components](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview) for more information. | +| `components` | [`Array[CreateSubscriptionComponent]`](../../doc/models/create-subscription-component.md) | Optional | (Optional) An array of component ids and quantities to be added to the subscription. See [Components](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview) for more information. | | `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. | | `customer_reference` | `String` | Optional | The reference value (provided by your app) of an existing customer within Chargify. Required, unless a `customer_id` or a set of `customer_attributes` is given. | diff --git a/doc/models/create-usage-request.md b/doc/models/create-usage-request.md index a783b50b..d94b5821 100644 --- a/doc/models/create-usage-request.md +++ b/doc/models/create-usage-request.md @@ -21,6 +21,25 @@ "memo": "memo2", "billing_schedule": { "initial_billing_at": "2016-03-13" + }, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "interval": 66, + "interval_unit": "day", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "renew_prepaid_allocation": false } } } diff --git a/doc/models/create-usage.md b/doc/models/create-usage.md index f8fd3033..8b518ca0 100644 --- a/doc/models/create-usage.md +++ b/doc/models/create-usage.md @@ -12,7 +12,8 @@ | `quantity` | `Float` | Optional | integer by default or decimal number if fractional quantities are enabled for the component | | `price_point_id` | `String` | Optional | - | | `memo` | `String` | Optional | - | -| `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. Please note this only works for site with Multifrequency enabled | +| `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) @@ -23,6 +24,25 @@ "memo": "memo2", "billing_schedule": { "initial_billing_at": "2016-03-13" + }, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "interval": 66, + "interval_unit": "day", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "renew_prepaid_allocation": false } } ``` diff --git a/doc/models/credit-note.md b/doc/models/credit-note.md index f7560f91..a9a5dc0c 100644 --- a/doc/models/credit-note.md +++ b/doc/models/credit-note.md @@ -30,12 +30,12 @@ | `total_amount` | `String` | Optional | The credit note total, which is `subtotal_amount - discount_amount + tax_amount`.' | | `applied_amount` | `String` | Optional | The amount of the credit note that has already been applied to invoices. | | `remaining_amount` | `String` | Optional | The amount of the credit note remaining to be applied to invoices, which is `total_amount - applied_amount`. | -| `line_items` | [`Array`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the credit note. | -| `discounts` | [`Array`](../../doc/models/invoice-discount.md) | Optional | - | -| `taxes` | [`Array`](../../doc/models/invoice-tax.md) | Optional | - | -| `applications` | [`Array`](../../doc/models/credit-note-application.md) | Optional | - | -| `refunds` | [`Array`](../../doc/models/invoice-refund.md) | Optional | - | -| `origin_invoices` | [`Array`](../../doc/models/origin-invoice.md) | Optional | An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin-invoices) | +| `line_items` | [`Array[CreditNoteLineItem]`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the credit note. | +| `discounts` | [`Array[InvoiceDiscount]`](../../doc/models/invoice-discount.md) | Optional | - | +| `taxes` | [`Array[InvoiceTax]`](../../doc/models/invoice-tax.md) | Optional | - | +| `applications` | [`Array[CreditNoteApplication]`](../../doc/models/credit-note-application.md) | Optional | - | +| `refunds` | [`Array[InvoiceRefund]`](../../doc/models/invoice-refund.md) | Optional | - | +| `origin_invoices` | [`Array[OriginInvoice]`](../../doc/models/origin-invoice.md) | Optional | An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin-invoices) | ## Example (as JSON) diff --git a/doc/models/currency-prices-response.md b/doc/models/currency-prices-response.md index e0ba7906..b0566a0f 100644 --- a/doc/models/currency-prices-response.md +++ b/doc/models/currency-prices-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/currency-price.md) | Required | - | +| `currency_prices` | [`Array[CurrencyPrice]`](../../doc/models/currency-price.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/customer-custom-fields-change.md b/doc/models/customer-custom-fields-change.md index d620befb..b3cd8763 100644 --- a/doc/models/customer-custom-fields-change.md +++ b/doc/models/customer-custom-fields-change.md @@ -9,8 +9,8 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `before` | [`Array`](../../doc/models/invoice-custom-field.md) | Required | - | -| `after` | [`Array`](../../doc/models/invoice-custom-field.md) | Required | - | +| `before` | [`Array[InvoiceCustomField]`](../../doc/models/invoice-custom-field.md) | Required | - | +| `after` | [`Array[InvoiceCustomField]`](../../doc/models/invoice-custom-field.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/debit-note.md b/doc/models/debit-note.md index aab4e33a..ae4276d7 100644 --- a/doc/models/debit-note.md +++ b/doc/models/debit-note.md @@ -28,10 +28,10 @@ | `customer` | [`InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the debited subscription. | | `billing_address` | [`InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The billing address of the debited subscription. | | `shipping_address` | [`InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The shipping address of the debited subscription. | -| `line_items` | [`Array`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the debit note. | -| `discounts` | [`Array`](../../doc/models/invoice-discount.md) | Optional | - | -| `taxes` | [`Array`](../../doc/models/invoice-tax.md) | Optional | - | -| `refunds` | [`Array`](../../doc/models/invoice-refund.md) | Optional | - | +| `line_items` | [`Array[CreditNoteLineItem]`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the debit note. | +| `discounts` | [`Array[InvoiceDiscount]`](../../doc/models/invoice-discount.md) | Optional | - | +| `taxes` | [`Array[InvoiceTax]`](../../doc/models/invoice-tax.md) | Optional | - | +| `refunds` | [`Array[InvoiceRefund]`](../../doc/models/invoice-refund.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/ebb-component.md b/doc/models/ebb-component.md index 5d3675d2..be0ec125 100644 --- a/doc/models/ebb-component.md +++ b/doc/models/ebb-component.md @@ -15,10 +15,10 @@ | `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. | | `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`](../../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. | -| `price_points` | [`Array`](../../doc/models/component-price-point-item.md) | Optional | - | +| `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. | +| `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 the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `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. | | `hide_date_range_on_invoice` | `TrueClass \| FalseClass` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `event_based_billing_metric_id` | `Integer` | Required | The ID of an event based billing metric that will be attached to this component. | | `interval` | `Integer` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/endpoint.md b/doc/models/endpoint.md index e749ba87..d315d914 100644 --- a/doc/models/endpoint.md +++ b/doc/models/endpoint.md @@ -13,7 +13,7 @@ | `url` | `String` | Optional | - | | `site_id` | `Integer` | Optional | - | | `status` | `String` | Optional | - | -| `webhook_subscriptions` | `Array` | Optional | - | +| `webhook_subscriptions` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/error-list-response-exception.md b/doc/models/error-list-response-exception.md index 148c5640..77bc0736 100644 --- a/doc/models/error-list-response-exception.md +++ b/doc/models/error-list-response-exception.md @@ -11,7 +11,7 @@ Error which contains list of messages. | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `errors` | `Array` | Required | - | +| `errors` | `Array[String]` | Required | - | ## Example (as JSON) diff --git a/doc/models/errors.md b/doc/models/errors.md index eea36fc8..2e5bc561 100644 --- a/doc/models/errors.md +++ b/doc/models/errors.md @@ -9,8 +9,8 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `per_page` | `Array` | Optional | - | -| `price_point` | `Array` | Optional | - | +| `per_page` | `Array[String]` | Optional | - | +| `price_point` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/full-subscription-group-response.md b/doc/models/full-subscription-group-response.md index 0102df4b..777869ab 100644 --- a/doc/models/full-subscription-group-response.md +++ b/doc/models/full-subscription-group-response.md @@ -13,7 +13,7 @@ | `scheme` | `Integer` | Optional | - | | `customer_id` | `Integer` | Optional | - | | `payment_profile_id` | `Integer` | Optional | - | -| `subscription_ids` | `Array` | Optional | - | +| `subscription_ids` | `Array[Integer]` | Optional | - | | `primary_subscription_id` | `Integer` | Optional | - | | `next_assessment_at` | `DateTime` | Optional | - | | `state` | [`SubscriptionState`](../../doc/models/subscription-state.md) | Optional | The state of a subscription.

* **Live States**
* `active` - A normal, active subscription. It is not in a trial and is paid and up to date.
* `assessing` - An internal (transient) state that indicates a subscription is in the middle of periodic assessment. Do not base any access decisions in your app on this state, as it may not always be exposed.
* `pending` - An internal (transient) state that indicates a subscription is in the creation process. Do not base any access decisions in your app on this state, as it may not always be exposed.
* `trialing` - A subscription in trialing state has a valid trial subscription. This type of subscription may transition to active once payment is received when the trial has ended. Otherwise, it may go to a Problem or End of Life state.
* `paused` - An internal state that indicates that your account with Advanced Billing is in arrears.
* **Problem States**
* `past_due` - Indicates that the most recent payment has failed, and payment is past due for this subscription. If you have enabled our automated dunning, this subscription will be in the dunning process (additional status and callbacks from the dunning process will be available in the future). If you are handling dunning and payment updates yourself, you will want to use this state to initiate a payment update from your customers.
* `soft_failure` - Indicates that normal assessment/processing of the subscription has failed for a reason that cannot be fixed by the Customer. For example, a Soft Fail may result from a timeout at the gateway or incorrect credentials on your part. The subscriptions should be retried automatically. An interface is being built for you to review problems resulting from these events to take manual action when needed.
* `unpaid` - Indicates an unpaid subscription. A subscription is marked unpaid if the retry period expires and you have configured your [Dunning](https://maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunning-Overview) settings to have a Final Action of `mark the subscription unpaid`.
* **End of Life States**
* `canceled` - Indicates a canceled subscription. This may happen at your request (via the API or the web interface) or due to the expiration of the [Dunning](https://maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunning-Overview) process without payment. See the [Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming) documentation for info on how to restart a canceled subscription.
While a subscription is canceled, its period will not advance, it will not accrue any new charges, and Advanced Billing will not attempt to collect the overdue balance.
* `expired` - Indicates a subscription that has expired due to running its normal life cycle. Some products may be configured to have an expiration period. An expired subscription then is one that stayed active until it fulfilled its full period.
* `failed_to_create` - Indicates that signup has failed. (You may see this state in a signup_failure webhook.)
* `on_hold` - Indicates that a subscription’s billing has been temporarily stopped. While it is expected that the subscription will resume and return to active status, this is still treated as an “End of Life” state because the customer is not paying for services during this time.
* `suspended` - Indicates that a prepaid subscription has used up all their prepayment balance. If a prepayment is applied, it will return to an active state.
* `trial_ended` - A subscription in a trial_ended state is a subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing) for more details.

See [Subscription States](https://maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscription-States) for more info about subscription states and state transitions. | diff --git a/doc/models/invoice-discount.md b/doc/models/invoice-discount.md index b7714204..a7c394fc 100644 --- a/doc/models/invoice-discount.md +++ b/doc/models/invoice-discount.md @@ -20,7 +20,7 @@ | `eligible_amount` | `String` | Optional | - | | `discount_amount` | `String` | Optional | - | | `transaction_id` | `Integer` | Optional | - | -| `line_item_breakouts` | [`Array`](../../doc/models/invoice-discount-breakout.md) | Optional | - | +| `line_item_breakouts` | [`Array[InvoiceDiscountBreakout]`](../../doc/models/invoice-discount-breakout.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/invoice-issued.md b/doc/models/invoice-issued.md index 3f12c84a..20939371 100644 --- a/doc/models/invoice-issued.md +++ b/doc/models/invoice-issued.md @@ -23,7 +23,7 @@ | `status_amount` | `String` | Required | - | | `product_name` | `String` | Required | - | | `consolidation_level` | `String` | Required | - | -| `line_items` | [`Array`](../../doc/models/invoice-line-item-event-data.md) | Required | - | +| `line_items` | [`Array[InvoiceLineItemEventData]`](../../doc/models/invoice-line-item-event-data.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/invoice-line-item-component-cost-data.md b/doc/models/invoice-line-item-component-cost-data.md index 981f1997..3e270892 100644 --- a/doc/models/invoice-line-item-component-cost-data.md +++ b/doc/models/invoice-line-item-component-cost-data.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `rates` | [`Array`](../../doc/models/component-cost-data.md) | Optional | - | +| `rates` | [`Array[ComponentCostData]`](../../doc/models/component-cost-data.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/invoice-line-item-event-data.md b/doc/models/invoice-line-item-event-data.md index 8334d2cc..53e381ee 100644 --- a/doc/models/invoice-line-item-event-data.md +++ b/doc/models/invoice-line-item-event-data.md @@ -20,7 +20,7 @@ | `amount` | `String` | Optional | - | | `line_references` | `String` | Optional | - | | `pricing_details_index` | `Integer` | Optional | - | -| `pricing_details` | [`Array`](../../doc/models/invoice-line-item-pricing-detail.md) | Optional | - | +| `pricing_details` | [`Array[InvoiceLineItemPricingDetail]`](../../doc/models/invoice-line-item-pricing-detail.md) | Optional | - | | `tax_code` | `String` | Optional | - | | `tax_amount` | `String` | Optional | - | | `product_id` | `Integer` | Optional | - | diff --git a/doc/models/invoice-previous-balance.md b/doc/models/invoice-previous-balance.md index f4d3aaac..3bdd43d5 100644 --- a/doc/models/invoice-previous-balance.md +++ b/doc/models/invoice-previous-balance.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `captured_at` | `DateTime` | Optional | - | -| `invoices` | [`Array`](../../doc/models/invoice-balance-item.md) | Optional | - | +| `invoices` | [`Array[InvoiceBalanceItem]`](../../doc/models/invoice-balance-item.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/invoice-tax.md b/doc/models/invoice-tax.md index f0350527..95e5f366 100644 --- a/doc/models/invoice-tax.md +++ b/doc/models/invoice-tax.md @@ -18,8 +18,8 @@ | `taxable_amount` | `String` | Optional | - | | `tax_amount` | `String` | Optional | - | | `transaction_id` | `Integer` | Optional | - | -| `line_item_breakouts` | [`Array`](../../doc/models/invoice-tax-breakout.md) | Optional | - | -| `tax_component_breakouts` | [`Array`](../../doc/models/invoice-tax-component-breakout.md) | Optional | - | +| `line_item_breakouts` | [`Array[InvoiceTaxBreakout]`](../../doc/models/invoice-tax-breakout.md) | Optional | - | +| `tax_component_breakouts` | [`Array[InvoiceTaxComponentBreakout]`](../../doc/models/invoice-tax-component-breakout.md) | Optional | - | | `eu_vat` | `TrueClass \| FalseClass` | Optional | - | | `type` | `String` | Optional | - | | `tax_exempt_amount` | `String` | Optional | - | diff --git a/doc/models/invoice.md b/doc/models/invoice.md index b2bdb768..793c2476 100644 --- a/doc/models/invoice.md +++ b/doc/models/invoice.md @@ -38,7 +38,7 @@ | `seller` | [`InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the invoice. | | `customer` | [`InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the invoiced subscription. | | `payer` | [`InvoicePayer`](../../doc/models/invoice-payer.md) | Optional | - | -| `recipient_emails` | `Array` | Optional | **Constraints**: *Maximum Items*: `5` | +| `recipient_emails` | `Array[String]` | Optional | **Constraints**: *Maximum Items*: `5` | | `net_terms` | `Integer` | Optional | - | | `memo` | `String` | Optional | The memo printed on invoices of any collection type. This message is in control of the merchant. | | `billing_address` | [`InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The invoice billing address. | @@ -52,14 +52,14 @@ | `refund_amount` | `String` | Optional | - | | `paid_amount` | `String` | Optional | The amount paid on the invoice by the customer. | | `due_amount` | `String` | Optional | Amount due on the invoice, which is `total_amount - credit_amount - paid_amount`. | -| `line_items` | [`Array`](../../doc/models/invoice-line-item.md) | Optional | Line items on the invoice. | -| `discounts` | [`Array`](../../doc/models/invoice-discount.md) | Optional | - | -| `taxes` | [`Array`](../../doc/models/invoice-tax.md) | Optional | - | -| `credits` | [`Array`](../../doc/models/invoice-credit.md) | Optional | - | -| `debits` | [`Array`](../../doc/models/invoice-debit.md) | Optional | - | -| `refunds` | [`Array`](../../doc/models/invoice-refund.md) | Optional | - | -| `payments` | [`Array`](../../doc/models/invoice-payment.md) | Optional | - | -| `custom_fields` | [`Array`](../../doc/models/invoice-custom-field.md) | Optional | - | +| `line_items` | [`Array[InvoiceLineItem]`](../../doc/models/invoice-line-item.md) | Optional | Line items on the invoice. | +| `discounts` | [`Array[InvoiceDiscount]`](../../doc/models/invoice-discount.md) | Optional | - | +| `taxes` | [`Array[InvoiceTax]`](../../doc/models/invoice-tax.md) | Optional | - | +| `credits` | [`Array[InvoiceCredit]`](../../doc/models/invoice-credit.md) | Optional | - | +| `debits` | [`Array[InvoiceDebit]`](../../doc/models/invoice-debit.md) | Optional | - | +| `refunds` | [`Array[InvoiceRefund]`](../../doc/models/invoice-refund.md) | Optional | - | +| `payments` | [`Array[InvoicePayment]`](../../doc/models/invoice-payment.md) | Optional | - | +| `custom_fields` | [`Array[InvoiceCustomField]`](../../doc/models/invoice-custom-field.md) | Optional | - | | `display_settings` | [`InvoiceDisplaySettings`](../../doc/models/invoice-display-settings.md) | Optional | - | | `avatax_details` | [`InvoiceAvataxDetails`](../../doc/models/invoice-avatax-details.md) | Optional | - | | `public_url` | `String` | Optional | The public URL of the invoice | diff --git a/doc/models/list-components-filter.md b/doc/models/list-components-filter.md index b277c73a..3330abbd 100644 --- a/doc/models/list-components-filter.md +++ b/doc/models/list-components-filter.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `ids` | `Array` | Optional | Allows fetching components with matching id based on provided value. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | +| `ids` | `Array[Integer]` | Optional | Allows fetching components with matching id based on provided value. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | | `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | Allows fetching components with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query `filter[use_site_exchange_rate]=true`. | ## Example (as JSON) diff --git a/doc/models/list-components-price-points-response.md b/doc/models/list-components-price-points-response.md index e04be1e5..bc6ff174 100644 --- a/doc/models/list-components-price-points-response.md +++ b/doc/models/list-components-price-points-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `price_points` | [`Array`](../../doc/models/component-price-point.md) | Required | - | +| `price_points` | [`Array[ComponentPricePoint]`](../../doc/models/component-price-point.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/list-coupons-filter.md b/doc/models/list-coupons-filter.md index fe5b1548..acfaba1f 100644 --- a/doc/models/list-coupons-filter.md +++ b/doc/models/list-coupons-filter.md @@ -14,9 +14,10 @@ | `end_date` | `Date` | Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns coupons with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. Use in query `filter[end_date]=2011-12-15`. | | `start_datetime` | `DateTime` | Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns coupons with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. Use in query `filter[start_datetime]=2011-12-19T10:15:30+01:00`. | | `end_datetime` | `DateTime` | Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns coupons with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. Use in query `filter[end_datetime]=2011-12-1T10:15:30+01:00`. | -| `ids` | `Array` | Optional | Allows fetching coupons with matching id based on provided values. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | -| `codes` | `Array` | Optional | Allows fetching coupons with matching codes based on provided values. Use in query `filter[codes]=free,free_trial`. | -| `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | Allows fetching coupons with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. | +| `ids` | `Array[Integer]` | Optional | Allows fetching coupons with matching id based on provided values. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | +| `codes` | `Array[String]` | Optional | Allows fetching coupons with matching codes based on provided values. Use in query `filter[codes]=free,free_trial`. | +| `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | If true, restricts the list to coupons whose pricing is recalculated from the site’s current exchange rates, so their currency_prices array contains on-the-fly conversions rather than stored price records. If false, restricts the list to coupons that have manually defined amounts for each currency, ensuring the response includes the saved currency_prices entries instead of exchange-rate-derived values. Use in query `filter[use_site_exchange_rate]=true`. | +| `include_archived` | `TrueClass \| FalseClass` | Optional | Controls returning archived coupons. | ## Example (as JSON) diff --git a/doc/models/list-credit-notes-response.md b/doc/models/list-credit-notes-response.md index 54934fd2..70d7cfa5 100644 --- a/doc/models/list-credit-notes-response.md +++ b/doc/models/list-credit-notes-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `credit_notes` | [`Array`](../../doc/models/credit-note.md) | Required | - | +| `credit_notes` | [`Array[CreditNote]`](../../doc/models/credit-note.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md index a6a95ad9..2076f92f 100644 --- a/doc/models/list-invoices-response.md +++ b/doc/models/list-invoices-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `invoices` | [`Array`](../../doc/models/invoice.md) | Required | - | +| `invoices` | [`Array[Invoice]`](../../doc/models/invoice.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/list-metafields-response.md b/doc/models/list-metafields-response.md index 8ec80f39..36e89e7d 100644 --- a/doc/models/list-metafields-response.md +++ b/doc/models/list-metafields-response.md @@ -13,7 +13,7 @@ | `current_page` | `Integer` | Optional | - | | `total_pages` | `Integer` | Optional | - | | `per_page` | `Integer` | Optional | - | -| `metafields` | [`Array`](../../doc/models/metafield.md) | Optional | - | +| `metafields` | [`Array[Metafield]`](../../doc/models/metafield.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-mrr-filter.md b/doc/models/list-mrr-filter.md index a06be8a5..308b2ba5 100644 --- a/doc/models/list-mrr-filter.md +++ b/doc/models/list-mrr-filter.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_ids` | `Array` | Optional | Submit ids in order to limit results. Use in query: `filter[subscription_ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | +| `subscription_ids` | `Array[Integer]` | Optional | Submit ids in order to limit results. Use in query: `filter[subscription_ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | ## Example (as JSON) diff --git a/doc/models/list-mrr-response-result.md b/doc/models/list-mrr-response-result.md index c4cfbc33..76cfd538 100644 --- a/doc/models/list-mrr-response-result.md +++ b/doc/models/list-mrr-response-result.md @@ -15,7 +15,7 @@ | `total_entries` | `Integer` | Optional | - | | `currency` | `String` | Optional | - | | `currency_symbol` | `String` | Optional | - | -| `movements` | [`Array`](../../doc/models/movement.md) | Optional | - | +| `movements` | [`Array[Movement]`](../../doc/models/movement.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-offers-response.md b/doc/models/list-offers-response.md index 9902014a..d89cc071 100644 --- a/doc/models/list-offers-response.md +++ b/doc/models/list-offers-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `offers` | [`Array`](../../doc/models/offer.md) | Optional | - | +| `offers` | [`Array[Offer]`](../../doc/models/offer.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-price-points-filter.md b/doc/models/list-price-points-filter.md index 8b736024..4cf6e619 100644 --- a/doc/models/list-price-points-filter.md +++ b/doc/models/list-price-points-filter.md @@ -14,8 +14,8 @@ | `end_date` | `Date` | Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns price points with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. | | `start_datetime` | `DateTime` | Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns price points with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. | | `end_datetime` | `DateTime` | Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns price points with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. | -| `type` | [`Array`](../../doc/models/price-point-type.md) | Optional | Allows fetching price points with matching type. Use in query: `filter[type]=custom,catalog`. | -| `ids` | `Array` | Optional | Allows fetching price points with matching id based on provided values. Use in query: `filter[ids]=1,2,3`. | +| `type` | [`Array[PricePointType]`](../../doc/models/price-point-type.md) | Optional | Allows fetching price points with matching type. Use in query: `filter[type]=custom,catalog`. | +| `ids` | `Array[Integer]` | Optional | Allows fetching price points with matching id based on provided values. Use in query: `filter[ids]=1,2,3`. | | `archived_at` | [`IncludeNullOrNotNull`](../../doc/models/include-null-or-not-null.md) | Optional | Allows fetching price points only if archived_at is present or not. Use in query: `filter[archived_at]=not_null`. | ## Example (as JSON) diff --git a/doc/models/list-product-price-points-response.md b/doc/models/list-product-price-points-response.md index 6c58fd92..52ce0146 100644 --- a/doc/models/list-product-price-points-response.md +++ b/doc/models/list-product-price-points-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `price_points` | [`Array`](../../doc/models/product-price-point.md) | Required | - | +| `price_points` | [`Array[ProductPricePoint]`](../../doc/models/product-price-point.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/list-products-filter.md b/doc/models/list-products-filter.md index 4e9b2bb2..7f93d239 100644 --- a/doc/models/list-products-filter.md +++ b/doc/models/list-products-filter.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `ids` | `Array` | Optional | Allows fetching products with matching id based on provided values. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | +| `ids` | `Array[Integer]` | Optional | Allows fetching products with matching id based on provided values. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | | `prepaid_product_price_point` | [`PrepaidProductPricePointFilter`](../../doc/models/prepaid-product-price-point-filter.md) | Optional | Allows fetching products only if a prepaid product price point is present or not. To use this filter you also have to include the following param in the request `include=prepaid_product_price_point`. Use in query `filter[prepaid_product_price_point][product_price_point_id]=not_null`. | | `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | Allows fetching products with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query `filter[use_site_exchange_rate]=true`. | diff --git a/doc/models/list-proforma-invoices-response.md b/doc/models/list-proforma-invoices-response.md index 7160ffc5..8c55bb81 100644 --- a/doc/models/list-proforma-invoices-response.md +++ b/doc/models/list-proforma-invoices-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `proforma_invoices` | [`Array`](../../doc/models/proforma-invoice.md) | Optional | - | +| `proforma_invoices` | [`Array[ProformaInvoice]`](../../doc/models/proforma-invoice.md) | Optional | - | | `meta` | [`ListProformaInvoicesMeta`](../../doc/models/list-proforma-invoices-meta.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-public-keys-response.md b/doc/models/list-public-keys-response.md index 4763b771..2764b331 100644 --- a/doc/models/list-public-keys-response.md +++ b/doc/models/list-public-keys-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `chargify_js_keys` | [`Array`](../../doc/models/public-key.md) | Optional | - | +| `chargify_js_keys` | [`Array[PublicKey]`](../../doc/models/public-key.md) | Optional | - | | `meta` | [`ListPublicKeysMeta`](../../doc/models/list-public-keys-meta.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-segments-response.md b/doc/models/list-segments-response.md index 8b83f41f..a1e5fd63 100644 --- a/doc/models/list-segments-response.md +++ b/doc/models/list-segments-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `segments` | [`Array`](../../doc/models/segment.md) | Optional | - | +| `segments` | [`Array[Segment]`](../../doc/models/segment.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-service-credits-response.md b/doc/models/list-service-credits-response.md index 56aa66ee..1e21dd71 100644 --- a/doc/models/list-service-credits-response.md +++ b/doc/models/list-service-credits-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `service_credits` | [`Array`](../../doc/models/service-credit-1.md) | Optional | - | +| `service_credits` | [`Array[ServiceCredit1]`](../../doc/models/service-credit-1.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/list-subscription-components-filter.md b/doc/models/list-subscription-components-filter.md index 5fbbb343..41ee066c 100644 --- a/doc/models/list-subscription-components-filter.md +++ b/doc/models/list-subscription-components-filter.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currencies` | `Array` | Optional | Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=EUR,USD`.

**Constraints**: *Minimum Items*: `1` | +| `currencies` | `Array[String]` | Optional | Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=EUR,USD`.

**Constraints**: *Minimum Items*: `1` | | `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. | ## Example (as JSON) diff --git a/doc/models/list-subscription-components-for-site-filter.md b/doc/models/list-subscription-components-for-site-filter.md index 0340decb..44a6a3a8 100644 --- a/doc/models/list-subscription-components-for-site-filter.md +++ b/doc/models/list-subscription-components-for-site-filter.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currencies` | `Array` | Optional | Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=USD,EUR`.

**Constraints**: *Minimum Items*: `1` | +| `currencies` | `Array[String]` | Optional | Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=USD,EUR`.

**Constraints**: *Minimum Items*: `1` | | `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. | | `subscription` | [`SubscriptionFilter`](../../doc/models/subscription-filter.md) | Optional | Nested filter used for List Subscription Components For Site Filter | diff --git a/doc/models/list-subscription-components-response.md b/doc/models/list-subscription-components-response.md index 1c6b15b8..4974b23a 100644 --- a/doc/models/list-subscription-components-response.md +++ b/doc/models/list-subscription-components-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptions_components` | [`Array`](../../doc/models/subscription-component.md) | Required | - | +| `subscriptions_components` | [`Array[SubscriptionComponent]`](../../doc/models/subscription-component.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/list-subscription-group-prepayment-response.md b/doc/models/list-subscription-group-prepayment-response.md index 0a2d39c6..b1d942d2 100644 --- a/doc/models/list-subscription-group-prepayment-response.md +++ b/doc/models/list-subscription-group-prepayment-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `prepayments` | [`Array`](../../doc/models/list-subscription-group-prepayment.md) | Required | - | +| `prepayments` | [`Array[ListSubscriptionGroupPrepayment]`](../../doc/models/list-subscription-group-prepayment.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/list-subscription-groups-item.md b/doc/models/list-subscription-groups-item.md index 88baaf2e..7d38ee3e 100644 --- a/doc/models/list-subscription-groups-item.md +++ b/doc/models/list-subscription-groups-item.md @@ -13,7 +13,7 @@ | `scheme` | `Integer` | Optional | - | | `customer_id` | `Integer` | Optional | - | | `payment_profile_id` | `Integer` | Optional | - | -| `subscription_ids` | `Array` | Optional | - | +| `subscription_ids` | `Array[Integer]` | Optional | - | | `primary_subscription_id` | `Integer` | Optional | - | | `next_assessment_at` | `DateTime` | Optional | - | | `state` | `String` | Optional | - | diff --git a/doc/models/list-subscription-groups-response.md b/doc/models/list-subscription-groups-response.md index fefc2ff2..55f31591 100644 --- a/doc/models/list-subscription-groups-response.md +++ b/doc/models/list-subscription-groups-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription_groups` | [`Array`](../../doc/models/list-subscription-groups-item.md) | Optional | - | +| `subscription_groups` | [`Array[ListSubscriptionGroupsItem]`](../../doc/models/list-subscription-groups-item.md) | Optional | - | | `meta` | [`ListSubscriptionGroupsMeta`](../../doc/models/list-subscription-groups-meta.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/metafield-input.md b/doc/models/metafield-input.md index ec8203b8..75443bd3 100644 --- a/doc/models/metafield-input.md +++ b/doc/models/metafield-input.md @@ -1,7 +1,7 @@ # Metafield Input -Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' +Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. ## Enumeration diff --git a/doc/models/metafield-scope.md b/doc/models/metafield-scope.md index 12097338..3c2ca83d 100644 --- a/doc/models/metafield-scope.md +++ b/doc/models/metafield-scope.md @@ -15,9 +15,9 @@ Warning: When updating a metafield's scope attribute, all scope attributes must | `invoices` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from invoices. | | `statements` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from statements. | | `portal` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from the portal. | -| `public_show` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from being viewable by your ecosystem. | -| `public_edit` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields from being edited by your ecosystem. | -| `hosted` | `Array` | Optional | - | +| `public_show` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being viewable by your ecosystem. | +| `public_edit` | [`IncludeOption`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being editable by your ecosystem. | +| `hosted` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/metafield.md b/doc/models/metafield.md index 59aa622a..7b74131a 100644 --- a/doc/models/metafield.md +++ b/doc/models/metafield.md @@ -12,8 +12,8 @@ | `id` | `Integer` | Optional | - | | `name` | `String` | Optional | - | | `scope` | [`MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | -| `data_count` | `Integer` | Optional | the amount of subscriptions this metafield has been applied to in Chargify | -| `input_type` | [`MetafieldInput`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' | +| `data_count` | `Integer` | Optional | The amount of subscriptions this metafield has been applied to in Advanced Billing. | +| `input_type` | [`MetafieldInput`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | | `enum` | String \| Array[String] \| nil | Optional | This is a container for one-of cases. | ## Example (as JSON) diff --git a/doc/models/metered-component.md b/doc/models/metered-component.md index 09f47a20..e89c965c 100644 --- a/doc/models/metered-component.md +++ b/doc/models/metered-component.md @@ -15,14 +15,14 @@ | `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. | | `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`](../../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. | -| `price_points` | [`Array`](../../doc/models/component-price-point-item.md) | Optional | - | +| `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. | +| `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 the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `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. | | `hide_date_range_on_invoice` | `TrueClass \| FalseClass` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `display_on_hosted_page` | `TrueClass \| FalseClass` | Optional | - | | `allow_fractional_quantities` | `TrueClass \| FalseClass` | Optional | - | -| `public_signup_page_ids` | `Array` | Optional | - | +| `public_signup_page_ids` | `Array[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's default 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's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/movement-line-item.md b/doc/models/movement-line-item.md index f2c5859b..341656d8 100644 --- a/doc/models/movement-line-item.md +++ b/doc/models/movement-line-item.md @@ -14,7 +14,7 @@ | `price_point_id` | `Integer` | Optional | - | | `name` | `String` | Optional | - | | `mrr` | `Integer` | Optional | - | -| `mrr_movements` | [`Array`](../../doc/models/mrr-movement.md) | Optional | - | +| `mrr_movements` | [`Array[MRRMovement]`](../../doc/models/mrr-movement.md) | Optional | - | | `quantity` | `Integer` | Optional | - | | `prev_quantity` | `Integer` | Optional | - | | `recurring` | `TrueClass \| FalseClass` | Optional | When `true`, the line item's MRR value will contribute to the `plan` breakout. When `false`, the line item contributes to the `usage` breakout. | diff --git a/doc/models/movement.md b/doc/models/movement.md index 3ceb04f7..5c7956ed 100644 --- a/doc/models/movement.md +++ b/doc/models/movement.md @@ -15,7 +15,7 @@ | `description` | `String` | Optional | - | | `category` | `String` | Optional | - | | `breakouts` | [`Breakouts`](../../doc/models/breakouts.md) | Optional | - | -| `line_items` | [`Array`](../../doc/models/movement-line-item.md) | Optional | - | +| `line_items` | [`Array[MovementLineItem]`](../../doc/models/movement-line-item.md) | Optional | - | | `subscription_id` | `Integer` | Optional | - | | `subscriber_name` | `String` | Optional | - | diff --git a/doc/models/multi-invoice-payment.md b/doc/models/multi-invoice-payment.md index 16f15fd5..489a2ae6 100644 --- a/doc/models/multi-invoice-payment.md +++ b/doc/models/multi-invoice-payment.md @@ -12,7 +12,7 @@ | `transaction_id` | `Integer` | Optional | The numeric ID of the transaction. | | `total_amount` | `String` | Optional | Dollar amount of the sum of the paid invoices. | | `currency_code` | `String` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | -| `applications` | [`Array`](../../doc/models/invoice-payment-application.md) | Optional | - | +| `applications` | [`Array[InvoicePaymentApplication]`](../../doc/models/invoice-payment-application.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/offer-item.md b/doc/models/offer-item.md index bc047184..10c52bdd 100644 --- a/doc/models/offer-item.md +++ b/doc/models/offer-item.md @@ -16,7 +16,7 @@ | `component_unit_price` | `String` | Optional | - | | `component_name` | `String` | Optional | - | | `price_point_name` | `String` | Optional | - | -| `currency_prices` | [`Array`](../../doc/models/currency-price.md) | Optional | - | +| `currency_prices` | [`Array[CurrencyPrice]`](../../doc/models/currency-price.md) | 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/offer.md b/doc/models/offer.md index 1dc8e47e..d0834e19 100644 --- a/doc/models/offer.md +++ b/doc/models/offer.md @@ -21,13 +21,13 @@ | `created_at` | `DateTime` | Optional | - | | `updated_at` | `DateTime` | Optional | - | | `archived_at` | `DateTime` | Optional | - | -| `offer_items` | [`Array`](../../doc/models/offer-item.md) | Optional | - | -| `offer_discounts` | [`Array`](../../doc/models/offer-discount.md) | Optional | - | +| `offer_items` | [`Array[OfferItem]`](../../doc/models/offer-item.md) | Optional | - | +| `offer_discounts` | [`Array[OfferDiscount]`](../../doc/models/offer-discount.md) | Optional | - | | `product_family_name` | `String` | Optional | - | | `product_name` | `String` | Optional | - | | `product_price_point_name` | `String` | Optional | - | | `product_price_in_cents` | `Integer` | Optional | - | -| `offer_signup_pages` | [`Array`](../../doc/models/offer-signup-page.md) | Optional | - | +| `offer_signup_pages` | [`Array[OfferSignupPage]`](../../doc/models/offer-signup-page.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index 227e3bcf..667d4327 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -15,13 +15,13 @@ | `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`. | -| `price_points` | [`Array`](../../doc/models/component-price-point-item.md) | Optional | - | +| `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 the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `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. | | `hide_date_range_on_invoice` | `TrueClass \| FalseClass` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `display_on_hosted_page` | `TrueClass \| FalseClass` | Optional | - | | `allow_fractional_quantities` | `TrueClass \| FalseClass` | Optional | - | -| `public_signup_page_ids` | `Array` | Optional | - | +| `public_signup_page_ids` | `Array[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's default 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's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/overage-pricing.md b/doc/models/overage-pricing.md index 81787036..12225092 100644 --- a/doc/models/overage-pricing.md +++ b/doc/models/overage-pricing.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `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`](../../doc/models/price.md) | Optional | - | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/paginated-metadata.md b/doc/models/paginated-metadata.md index 55a8f2fa..a982a0c5 100644 --- a/doc/models/paginated-metadata.md +++ b/doc/models/paginated-metadata.md @@ -13,7 +13,7 @@ | `current_page` | `Integer` | Optional | - | | `total_pages` | `Integer` | Optional | - | | `per_page` | `Integer` | Optional | - | -| `metadata` | [`Array`](../../doc/models/metadata.md) | Optional | - | +| `metadata` | [`Array[Metadata]`](../../doc/models/metadata.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/payer-error.md b/doc/models/payer-error.md index 92c1271c..d963da36 100644 --- a/doc/models/payer-error.md +++ b/doc/models/payer-error.md @@ -9,9 +9,9 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `last_name` | `Array` | Optional | - | -| `first_name` | `Array` | Optional | - | -| `email` | `Array` | Optional | - | +| `last_name` | `Array[String]` | Optional | - | +| `first_name` | `Array[String]` | Optional | - | +| `email` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/payment-profile-attributes.md b/doc/models/payment-profile-attributes.md index c197c40b..1a9fa8f8 100644 --- a/doc/models/payment-profile-attributes.md +++ b/doc/models/payment-profile-attributes.md @@ -25,7 +25,7 @@ alias to credit_card_attributes | `billing_address_2` | `String` | Optional | (Optional) Second line of the customer’s billing address i.e. Apt. 100 | | `billing_city` | `String` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | | `billing_state` | `String` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | -| `billing_country` | `String` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | +| `billing_country` | `String` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | | `billing_zip` | `String` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | | `current_vault` | [`AllVaults`](../../doc/models/all-vaults.md) | Optional | (Optional, used only for Subscription Import) The vault that stores the payment profile with the provided vault_token. | | `vault_token` | `String` | Optional | (Optional, used only for Subscription Import) The “token” provided by your vault storage for an already stored payment profile | diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md index 08d1ea67..d1ed2e99 100644 --- a/doc/models/prepaid-usage-component.md +++ b/doc/models/prepaid-usage-component.md @@ -15,12 +15,12 @@ | `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. | | `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`](../../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. | +| `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`. | -| `price_points` | [`Array`](../../doc/models/create-prepaid-usage-component-price-point.md) | Optional | - | +| `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 the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `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. | | `hide_date_range_on_invoice` | `TrueClass \| FalseClass` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `overage_pricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Required | - | | `rollover_prepaid_remainder` | `TrueClass \| FalseClass` | Optional | Boolean which controls whether or not remaining units should be rolled over to the next period | @@ -29,7 +29,7 @@ | `expiration_interval_unit` | [`ExpirationIntervalUnit`](../../doc/models/expiration-interval-unit.md) | Optional | - | | `display_on_hosted_page` | `TrueClass \| FalseClass` | Optional | - | | `allow_fractional_quantities` | `TrueClass \| FalseClass` | Optional | - | -| `public_signup_page_ids` | `Array` | Optional | - | +| `public_signup_page_ids` | `Array[Integer]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/prepaid-usage.md b/doc/models/prepaid-usage.md index 31c81b6d..f3af4fd9 100644 --- a/doc/models/prepaid-usage.md +++ b/doc/models/prepaid-usage.md @@ -18,7 +18,7 @@ | `component_id` | `Integer` | Required | - | | `component_handle` | `String` | Required | - | | `memo` | `String` | Required | - | -| `allocation_details` | [`Array`](../../doc/models/prepaid-usage-allocation-detail.md) | Required | - | +| `allocation_details` | [`Array[PrepaidUsageAllocationDetail]`](../../doc/models/prepaid-usage-allocation-detail.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/prepayments-response.md b/doc/models/prepayments-response.md index 0e090e4a..ca4ad487 100644 --- a/doc/models/prepayments-response.md +++ b/doc/models/prepayments-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `prepayments` | [`Array`](../../doc/models/prepayment.md) | Optional | **Constraints**: *Unique Items Required* | +| `prepayments` | [`Array[Prepayment]`](../../doc/models/prepayment.md) | Optional | **Constraints**: *Unique Items Required* | ## Example (as JSON) diff --git a/doc/models/preview-allocations-request.md b/doc/models/preview-allocations-request.md index 1dd4f460..a87126f4 100644 --- a/doc/models/preview-allocations-request.md +++ b/doc/models/preview-allocations-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `allocations` | [`Array`](../../doc/models/create-allocation.md) | Required | - | +| `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`. | diff --git a/doc/models/product-price-point-errors.md b/doc/models/product-price-point-errors.md index 42148805..8bf1c314 100644 --- a/doc/models/product-price-point-errors.md +++ b/doc/models/product-price-point-errors.md @@ -10,11 +10,11 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `price_point` | `String` | Optional | - | -| `interval` | `Array` | Optional | - | -| `interval_unit` | `Array` | Optional | - | -| `name` | `Array` | Optional | - | -| `price` | `Array` | Optional | - | -| `price_in_cents` | `Array` | Optional | - | +| `interval` | `Array[String]` | Optional | - | +| `interval_unit` | `Array[String]` | Optional | - | +| `name` | `Array[String]` | Optional | - | +| `price` | `Array[String]` | Optional | - | +| `price_in_cents` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/product-price-point.md b/doc/models/product-price-point.md index b260fbcb..2709500f 100644 --- a/doc/models/product-price-point.md +++ b/doc/models/product-price-point.md @@ -18,7 +18,7 @@ | `trial_price_in_cents` | `Integer` | Optional | The product price point trial price, in integer cents | | `trial_interval` | `Integer` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days | | `trial_interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product price point, either month or day | -| `trial_type` | `String` | Optional | - | +| `trial_type` | [`TrialType`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `introductory_offer` | `TrueClass \| FalseClass` | Optional | reserved for future use | | `initial_charge_in_cents` | `Integer` | Optional | The product price point initial charge, in integer cents | | `initial_charge_after_trial` | `TrueClass \| FalseClass` | Optional | - | @@ -32,7 +32,7 @@ | `type` | [`PricePointType`](../../doc/models/price-point-type.md) | Optional | The type of price point | | `tax_included` | `TrueClass \| FalseClass` | Optional | Whether or not the price point includes tax | | `subscription_id` | `Integer` | Optional | The subscription id this price point belongs to | -| `currency_prices` | [`Array`](../../doc/models/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[CurrencyPrice]`](../../doc/models/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. | ## Example (as JSON) diff --git a/doc/models/product.md b/doc/models/product.md index 2f293e3c..b1a0ce4c 100644 --- a/doc/models/product.md +++ b/doc/models/product.md @@ -14,7 +14,7 @@ | `handle` | `String` | Optional | The product API handle | | `description` | `String` | Optional | The product description | | `accounting_code` | `String` | Optional | E.g. Internal ID or SKU Number | -| `request_credit_card` | `TrueClass \| FalseClass` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, please read this attribute from under the signup page. | +| `request_credit_card` | `TrueClass \| FalseClass` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. | | `expiration_interval` | `Integer` | Optional | A numerical interval for the length a subscription to this product will run before it expires. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval | | `expiration_interval_unit` | [`ExpirationIntervalUnit`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this product, either month, day or never | | `created_at` | `DateTime` | Optional | Timestamp indicating when this product was created | @@ -35,12 +35,12 @@ | `version_number` | `Integer` | Optional | The version of the product | | `update_return_params` | `String` | Optional | The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#return-parameters-after-account-update) | | `product_family` | [`ProductFamily`](../../doc/models/product-family.md) | Optional | - | -| `public_signup_pages` | [`Array`](../../doc/models/public-signup-page.md) | Optional | - | +| `public_signup_pages` | [`Array[PublicSignupPage]`](../../doc/models/public-signup-page.md) | Optional | - | | `product_price_point_name` | `String` | Optional | - | | `request_billing_address` | `TrueClass \| FalseClass` | Optional | A boolean indicating whether to request a billing address on any Self-Service Pages that are used by subscribers of this product. | | `require_billing_address` | `TrueClass \| FalseClass` | Optional | A boolean indicating whether a billing address is required to add a payment profile, especially at signup. | | `require_shipping_address` | `TrueClass \| FalseClass` | Optional | A boolean indicating whether a shipping address is required for the customer, especially at signup. | -| `tax_code` | `String` | Optional | A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `tax_code` | `String` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | | `default_product_price_point_id` | `Integer` | Optional | - | | `use_site_exchange_rate` | `TrueClass \| FalseClass` | Optional | - | | `item_category` | `String` | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | diff --git a/doc/models/proforma-invoice-discount.md b/doc/models/proforma-invoice-discount.md index aa893094..c24ab980 100644 --- a/doc/models/proforma-invoice-discount.md +++ b/doc/models/proforma-invoice-discount.md @@ -16,7 +16,7 @@ | `discount_type` | [`InvoiceDiscountType`](../../doc/models/invoice-discount-type.md) | Optional | - | | `eligible_amount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | | `discount_amount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | -| `line_item_breakouts` | [`Array`](../../doc/models/invoice-discount-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | +| `line_item_breakouts` | [`Array[InvoiceDiscountBreakout]`](../../doc/models/invoice-discount-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | ## Example (as JSON) diff --git a/doc/models/proforma-invoice-issued.md b/doc/models/proforma-invoice-issued.md index 47130fee..14490bee 100644 --- a/doc/models/proforma-invoice-issued.md +++ b/doc/models/proforma-invoice-issued.md @@ -19,7 +19,7 @@ | `tax_amount` | `String` | Required | - | | `total_amount` | `String` | Required | - | | `product_name` | `String` | Required | - | -| `line_items` | [`Array`](../../doc/models/invoice-line-item-event-data.md) | Required | - | +| `line_items` | [`Array[InvoiceLineItemEventData]`](../../doc/models/invoice-line-item-event-data.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/proforma-invoice-tax.md b/doc/models/proforma-invoice-tax.md index 0eabd3f0..56d5501a 100644 --- a/doc/models/proforma-invoice-tax.md +++ b/doc/models/proforma-invoice-tax.md @@ -15,7 +15,7 @@ | `percentage` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | | `taxable_amount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | | `tax_amount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | -| `line_item_breakouts` | [`Array`](../../doc/models/invoice-tax-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | +| `line_item_breakouts` | [`Array[InvoiceTaxBreakout]`](../../doc/models/invoice-tax-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | ## Example (as JSON) diff --git a/doc/models/proforma-invoice.md b/doc/models/proforma-invoice.md index 0aa9e9f7..1900554a 100644 --- a/doc/models/proforma-invoice.md +++ b/doc/models/proforma-invoice.md @@ -38,12 +38,12 @@ | `paid_amount` | `String` | Optional | - | | `refund_amount` | `String` | Optional | - | | `due_amount` | `String` | Optional | - | -| `line_items` | [`Array`](../../doc/models/invoice-line-item.md) | Optional | - | -| `discounts` | [`Array`](../../doc/models/proforma-invoice-discount.md) | Optional | - | -| `taxes` | [`Array`](../../doc/models/proforma-invoice-tax.md) | Optional | - | -| `credits` | [`Array`](../../doc/models/proforma-invoice-credit.md) | Optional | - | -| `payments` | [`Array`](../../doc/models/proforma-invoice-payment.md) | Optional | - | -| `custom_fields` | [`Array`](../../doc/models/invoice-custom-field.md) | Optional | - | +| `line_items` | [`Array[InvoiceLineItem]`](../../doc/models/invoice-line-item.md) | Optional | - | +| `discounts` | [`Array[ProformaInvoiceDiscount]`](../../doc/models/proforma-invoice-discount.md) | Optional | - | +| `taxes` | [`Array[ProformaInvoiceTax]`](../../doc/models/proforma-invoice-tax.md) | Optional | - | +| `credits` | [`Array[ProformaInvoiceCredit]`](../../doc/models/proforma-invoice-credit.md) | Optional | - | +| `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 | - | ## Example (as JSON) diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md index f32093f7..6f3893c7 100644 --- a/doc/models/quantity-based-component.md +++ b/doc/models/quantity-based-component.md @@ -15,17 +15,17 @@ | `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. | | `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`](../../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. | +| `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`. | -| `price_points` | [`Array`](../../doc/models/component-price-point-item.md) | Optional | - | +| `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 the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `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. | | `hide_date_range_on_invoice` | `TrueClass \| FalseClass` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | | `recurring` | `TrueClass \| FalseClass` | Optional | - | | `display_on_hosted_page` | `TrueClass \| FalseClass` | Optional | - | | `allow_fractional_quantities` | `TrueClass \| FalseClass` | Optional | - | -| `public_signup_page_ids` | `Array` | Optional | - | +| `public_signup_page_ids` | `Array[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's default 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's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | diff --git a/doc/models/reactivate-subscription-group-response.md b/doc/models/reactivate-subscription-group-response.md index 9f94efd5..879ceedb 100644 --- a/doc/models/reactivate-subscription-group-response.md +++ b/doc/models/reactivate-subscription-group-response.md @@ -13,7 +13,7 @@ | `scheme` | `Integer` | Optional | - | | `customer_id` | `Integer` | Optional | - | | `payment_profile_id` | `Integer` | Optional | - | -| `subscription_ids` | `Array` | Optional | - | +| `subscription_ids` | `Array[Integer]` | Optional | - | | `primary_subscription_id` | `Integer` | Optional | - | | `next_assessment_at` | `DateTime` | Optional | - | | `state` | `String` | Optional | - | diff --git a/doc/models/record-payment-response.md b/doc/models/record-payment-response.md index bfda38c9..265ec52b 100644 --- a/doc/models/record-payment-response.md +++ b/doc/models/record-payment-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `paid_invoices` | [`Array`](../../doc/models/paid-invoice.md) | Optional | - | +| `paid_invoices` | [`Array[PaidInvoice]`](../../doc/models/paid-invoice.md) | Optional | - | | `prepayment` | [`InvoicePrePayment`](../../doc/models/invoice-pre-payment.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/renewal-preview-request.md b/doc/models/renewal-preview-request.md index e530a9ed..50307e78 100644 --- a/doc/models/renewal-preview-request.md +++ b/doc/models/renewal-preview-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `components` | [`Array`](../../doc/models/renewal-preview-component.md) | Optional | An optional array of component definitions to preview. Providing any component definitions here will override the actual components on the subscription (and their quantities), and the billing preview will contain only these components (in addition to any product base fees). | +| `components` | [`Array[RenewalPreviewComponent]`](../../doc/models/renewal-preview-component.md) | Optional | An optional array of component definitions to preview. Providing any component definitions here will override the actual components on the subscription (and their quantities), and the billing preview will contain only these components (in addition to any product base fees). | ## Example (as JSON) diff --git a/doc/models/renewal-preview.md b/doc/models/renewal-preview.md index 8178dd85..59c1a917 100644 --- a/doc/models/renewal-preview.md +++ b/doc/models/renewal-preview.md @@ -17,7 +17,7 @@ | `existing_balance_in_cents` | `Integer` | Optional | An integer representing the amount of the subscription’s current balance | | `total_amount_due_in_cents` | `Integer` | Optional | An integer representing the existing_balance_in_cents plus the total_in_cents | | `uncalculated_taxes` | `TrueClass \| FalseClass` | Optional | A boolean indicating whether or not additional taxes will be calculated at the time of renewal. This will be true if you are using Avalara and the address of the subscription is in one of your defined taxable regions. | -| `line_items` | [`Array`](../../doc/models/renewal-preview-line-item.md) | Optional | An array of objects representing the individual transactions that will be created at the next renewal | +| `line_items` | [`Array[RenewalPreviewLineItem]`](../../doc/models/renewal-preview-line-item.md) | Optional | An array of objects representing the individual transactions that will be created at the next renewal | ## Example (as JSON) diff --git a/doc/models/replay-webhooks-request.md b/doc/models/replay-webhooks-request.md index 2c6f6d4c..c7a996d6 100644 --- a/doc/models/replay-webhooks-request.md +++ b/doc/models/replay-webhooks-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `ids` | `Array` | Required | - | +| `ids` | `Array[Integer]` | Required | - | ## Example (as JSON) diff --git a/doc/models/resume-options.md b/doc/models/resume-options.md index 8e59c61f..db156b6f 100644 --- a/doc/models/resume-options.md +++ b/doc/models/resume-options.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `require_resume` | `TrueClass \| FalseClass` | Optional | Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in it's current state. | +| `require_resume` | `TrueClass \| FalseClass` | Optional | Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in its current state. | | `forgive_balance` | `TrueClass \| FalseClass` | Optional | Indicates whether or not Chargify should clear the subscription's existing balance before attempting to resume the subscription. If subscription cannot be resumed, the balance will remain as it was before the attempt to resume was made. | ## Example (as JSON) diff --git a/doc/models/sale-rep.md b/doc/models/sale-rep.md index fc462333..e76b7862 100644 --- a/doc/models/sale-rep.md +++ b/doc/models/sale-rep.md @@ -13,7 +13,7 @@ | `full_name` | `String` | Optional | - | | `subscriptions_count` | `Integer` | Optional | - | | `test_mode` | `TrueClass \| FalseClass` | Optional | - | -| `subscriptions` | [`Array`](../../doc/models/sale-rep-subscription.md) | Optional | - | +| `subscriptions` | [`Array[SaleRepSubscription]`](../../doc/models/sale-rep-subscription.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/segment.md b/doc/models/segment.md index e37191dd..1ce932b7 100644 --- a/doc/models/segment.md +++ b/doc/models/segment.md @@ -20,7 +20,7 @@ | `segment_property_4_value` | String \| Float \| Integer \| TrueClass \| FalseClass \| nil | Optional | This is a container for one-of cases. | | `created_at` | `DateTime` | Optional | - | | `updated_at` | `DateTime` | Optional | - | -| `prices` | [`Array`](../../doc/models/segment-price.md) | Optional | **Constraints**: *Minimum Items*: `1` | +| `prices` | [`Array[SegmentPrice]`](../../doc/models/segment-price.md) | Optional | **Constraints**: *Minimum Items*: `1` | ## Example (as JSON) diff --git a/doc/models/send-invoice-request.md b/doc/models/send-invoice-request.md index ce8f06b4..6bb425d5 100644 --- a/doc/models/send-invoice-request.md +++ b/doc/models/send-invoice-request.md @@ -9,9 +9,9 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `recipient_emails` | `Array` | Optional | **Constraints**: *Maximum Items*: `5` | -| `cc_recipient_emails` | `Array` | Optional | **Constraints**: *Maximum Items*: `5` | -| `bcc_recipient_emails` | `Array` | Optional | **Constraints**: *Maximum Items*: `5` | +| `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` | ## Example (as JSON) diff --git a/doc/models/site.md b/doc/models/site.md index 58970566..079ac205 100644 --- a/doc/models/site.md +++ b/doc/models/site.md @@ -14,7 +14,7 @@ | `subdomain` | `String` | Optional | - | | `currency` | `String` | Optional | - | | `seller_id` | `Integer` | Optional | - | -| `non_primary_currencies` | `Array` | Optional | - | +| `non_primary_currencies` | `Array[String]` | Optional | - | | `relationship_invoicing_enabled` | `TrueClass \| FalseClass` | Optional | - | | `schedule_subscription_cancellation_enabled` | `TrueClass \| FalseClass` | Optional | - | | `customer_hierarchy_enabled` | `TrueClass \| FalseClass` | Optional | - | diff --git a/doc/models/snap-day.md b/doc/models/snap-day.md index 097f8ccc..80c32f22 100644 --- a/doc/models/snap-day.md +++ b/doc/models/snap-day.md @@ -1,8 +1,6 @@ # Snap Day -Use for subscriptions with product eligible for calendar billing only. Value can be 1-28 or 'end'. - ## Enumeration `SnapDay` diff --git a/doc/models/subscription-add-coupon-error-exception.md b/doc/models/subscription-add-coupon-error-exception.md index 739e33a8..f449428a 100644 --- a/doc/models/subscription-add-coupon-error-exception.md +++ b/doc/models/subscription-add-coupon-error-exception.md @@ -9,10 +9,10 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `codes` | `Array` | Optional | - | -| `coupon_code` | `Array` | Optional | - | -| `coupon_codes` | `Array` | Optional | - | -| `subscription` | `Array` | Optional | - | +| `codes` | `Array[String]` | Optional | - | +| `coupon_code` | `Array[String]` | Optional | - | +| `coupon_codes` | `Array[String]` | Optional | - | +| `subscription` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/subscription-component-allocation-error-exception.md b/doc/models/subscription-component-allocation-error-exception.md index 29428692..87bc6b70 100644 --- a/doc/models/subscription-component-allocation-error-exception.md +++ b/doc/models/subscription-component-allocation-error-exception.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `errors` | [`Array`](../../doc/models/subscription-component-allocation-error-item.md) | Optional | - | +| `errors` | [`Array[SubscriptionComponentAllocationErrorItem]`](../../doc/models/subscription-component-allocation-error-item.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/subscription-component.md b/doc/models/subscription-component.md index 37204e48..b162ce1d 100644 --- a/doc/models/subscription-component.md +++ b/doc/models/subscription-component.md @@ -37,7 +37,7 @@ | `description` | `String` | Optional | - | | `allow_fractional_quantities` | `TrueClass \| FalseClass` | Optional | - | | `subscription` | [`SubscriptionComponentSubscription`](../../doc/models/subscription-component-subscription.md) | Optional | An optional object, will be returned if provided `include=subscription` query param. | -| `historic_usages` | [`Array`](../../doc/models/historic-usage.md) | Optional | - | +| `historic_usages` | [`Array[HistoricUsage]`](../../doc/models/historic-usage.md) | Optional | - | | `display_on_hosted_page` | `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. | diff --git a/doc/models/subscription-custom-price.md b/doc/models/subscription-custom-price.md index 694a705f..d0acbd9c 100644 --- a/doc/models/subscription-custom-price.md +++ b/doc/models/subscription-custom-price.md @@ -19,6 +19,7 @@ | `trial_price_in_cents` | String \| Integer \| nil | Optional | This is a container for one-of cases. | | `trial_interval` | String \| Integer \| nil | Optional | This is a container for one-of cases. | | `trial_interval_unit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | (Optional) | +| `trial_type` | [`TrialType`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | | `initial_charge_in_cents` | String \| Integer \| nil | Optional | This is a container for one-of cases. | | `initial_charge_after_trial` | `TrueClass \| FalseClass` | Optional | (Optional) | | `expiration_interval` | String \| Integer \| nil | Optional | This is a container for one-of cases. | diff --git a/doc/models/subscription-filter.md b/doc/models/subscription-filter.md index 514db97e..c699b8f0 100644 --- a/doc/models/subscription-filter.md +++ b/doc/models/subscription-filter.md @@ -11,7 +11,7 @@ Nested filter used for List Subscription Components For Site Filter | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `states` | [`Array`](../../doc/models/subscription-state-filter.md) | Optional | Allows fetching components allocations that belong to the subscription with matching states based on provided values. To use this filter you also have to include the following param in the request `include=subscription`. Use in query `filter[subscription][states]=active,canceled&include=subscription`.

**Constraints**: *Minimum Items*: `1` | +| `states` | [`Array[SubscriptionStateFilter]`](../../doc/models/subscription-state-filter.md) | Optional | Allows fetching components allocations that belong to the subscription with matching states based on provided values. To use this filter you also have to include the following param in the request `include=subscription`. Use in query `filter[subscription][states]=active,canceled&include=subscription`.

**Constraints**: *Minimum Items*: `1` | | `date_field` | [`SubscriptionListDateField`](../../doc/models/subscription-list-date-field.md) | Optional | The type of filter you'd like to apply to your search. To use this filter you also have to include the following param in the request `include=subscription`. | | `start_date` | `Date` | Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components that belong to the subscription with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. To use this filter you also have to include the following param in the request `include=subscription`. | | `end_date` | `Date` | Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components that belong to the subscription with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. To use this filter you also have to include the following param in the request `include=subscription`. | diff --git a/doc/models/subscription-group-component-custom-price.md b/doc/models/subscription-group-component-custom-price.md index f57798a6..1185f36a 100644 --- a/doc/models/subscription-group-component-custom-price.md +++ b/doc/models/subscription-group-component-custom-price.md @@ -12,8 +12,8 @@ Used in place of `price_point_id` to define a custom price point unique to the s | Name | Type | Tags | Description | | --- | --- | --- | --- | | `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. | -| `prices` | [`Array`](../../doc/models/price.md) | Optional | - | -| `overage_pricing` | [`Array`](../../doc/models/component-custom-price.md) | Optional | - | +| `prices` | [`Array[Price]`](../../doc/models/price.md) | Optional | - | +| `overage_pricing` | [`Array[ComponentCustomPrice]`](../../doc/models/component-custom-price.md) | Optional | - | ## Example (as JSON) @@ -39,7 +39,8 @@ Used in place of `price_point_id` to define a custom price point unique to the s "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } ] } diff --git a/doc/models/subscription-group-members-array-error.md b/doc/models/subscription-group-members-array-error.md index d8d87ff6..6d9321c1 100644 --- a/doc/models/subscription-group-members-array-error.md +++ b/doc/models/subscription-group-members-array-error.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `members` | `Array` | Required | - | +| `members` | `Array[String]` | Required | - | ## Example (as JSON) diff --git a/doc/models/subscription-group-signup-component.md b/doc/models/subscription-group-signup-component.md index 98d82cba..092dcbce 100644 --- a/doc/models/subscription-group-signup-component.md +++ b/doc/models/subscription-group-signup-component.md @@ -49,7 +49,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false }, { "tax_included": false, @@ -62,7 +63,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false }, { "tax_included": false, @@ -75,7 +77,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } ] } diff --git a/doc/models/subscription-group-signup-error.md b/doc/models/subscription-group-signup-error.md index e2292c8f..ab4b9140 100644 --- a/doc/models/subscription-group-signup-error.md +++ b/doc/models/subscription-group-signup-error.md @@ -12,7 +12,7 @@ | `subscriptions` | [`Hash[String, SubscriptionGroupSubscriptionError]`](../../doc/models/subscription-group-subscription-error.md) | Optional | Object that as key have subscription position in request subscriptions array and as value subscription errors object. | | `payer_reference` | `String` | Optional | - | | `payer` | [`PayerError`](../../doc/models/payer-error.md) | Optional | - | -| `subscription_group` | `Array` | Optional | - | +| `subscription_group` | `Array[String]` | Optional | - | | `payment_profile_id` | `String` | Optional | - | | `payer_id` | `String` | Optional | - | diff --git a/doc/models/subscription-group-signup-failure-data.md b/doc/models/subscription-group-signup-failure-data.md index c3c6d166..75682b99 100644 --- a/doc/models/subscription-group-signup-failure-data.md +++ b/doc/models/subscription-group-signup-failure-data.md @@ -16,7 +16,7 @@ | `payer_attributes` | [`PayerAttributes`](../../doc/models/payer-attributes.md) | Optional | - | | `credit_card_attributes` | [`SubscriptionGroupCreditCard`](../../doc/models/subscription-group-credit-card.md) | Optional | - | | `bank_account_attributes` | [`SubscriptionGroupBankAccount`](../../doc/models/subscription-group-bank-account.md) | Optional | - | -| `subscriptions` | [`Array`](../../doc/models/subscription-group-signup-item.md) | Optional | - | +| `subscriptions` | [`Array[SubscriptionGroupSignupItem]`](../../doc/models/subscription-group-signup-item.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/subscription-group-signup-item.md b/doc/models/subscription-group-signup-item.md index 5e0e7dbd..90dbd42d 100644 --- a/doc/models/subscription-group-signup-item.md +++ b/doc/models/subscription-group-signup-item.md @@ -17,8 +17,8 @@ | `reference` | `String` | Optional | The reference value (provided by your app) for the subscription itelf. | | `primary` | `TrueClass \| FalseClass` | Optional | One of the subscriptions must be marked as primary in the group. | | `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` | Optional | An array for all the coupons attached to the subscription. | -| `components` | [`Array`](../../doc/models/subscription-group-signup-component.md) | Optional | - | +| `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 | | `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-signup-response.md b/doc/models/subscription-group-signup-response.md index b4af6c8c..ad0bfeba 100644 --- a/doc/models/subscription-group-signup-response.md +++ b/doc/models/subscription-group-signup-response.md @@ -13,12 +13,12 @@ | `scheme` | `Integer` | Optional | - | | `customer_id` | `Integer` | Optional | - | | `payment_profile_id` | `Integer` | Optional | - | -| `subscription_ids` | `Array` | Optional | - | +| `subscription_ids` | `Array[Integer]` | Optional | - | | `primary_subscription_id` | `Integer` | Optional | - | | `next_assessment_at` | `DateTime` | Optional | - | | `state` | [`SubscriptionState`](../../doc/models/subscription-state.md) | Optional | The state of a subscription.

* **Live States**
* `active` - A normal, active subscription. It is not in a trial and is paid and up to date.
* `assessing` - An internal (transient) state that indicates a subscription is in the middle of periodic assessment. Do not base any access decisions in your app on this state, as it may not always be exposed.
* `pending` - An internal (transient) state that indicates a subscription is in the creation process. Do not base any access decisions in your app on this state, as it may not always be exposed.
* `trialing` - A subscription in trialing state has a valid trial subscription. This type of subscription may transition to active once payment is received when the trial has ended. Otherwise, it may go to a Problem or End of Life state.
* `paused` - An internal state that indicates that your account with Advanced Billing is in arrears.
* **Problem States**
* `past_due` - Indicates that the most recent payment has failed, and payment is past due for this subscription. If you have enabled our automated dunning, this subscription will be in the dunning process (additional status and callbacks from the dunning process will be available in the future). If you are handling dunning and payment updates yourself, you will want to use this state to initiate a payment update from your customers.
* `soft_failure` - Indicates that normal assessment/processing of the subscription has failed for a reason that cannot be fixed by the Customer. For example, a Soft Fail may result from a timeout at the gateway or incorrect credentials on your part. The subscriptions should be retried automatically. An interface is being built for you to review problems resulting from these events to take manual action when needed.
* `unpaid` - Indicates an unpaid subscription. A subscription is marked unpaid if the retry period expires and you have configured your [Dunning](https://maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunning-Overview) settings to have a Final Action of `mark the subscription unpaid`.
* **End of Life States**
* `canceled` - Indicates a canceled subscription. This may happen at your request (via the API or the web interface) or due to the expiration of the [Dunning](https://maxio.zendesk.com/hc/en-us/articles/24287076583565-Dunning-Overview) process without payment. See the [Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming) documentation for info on how to restart a canceled subscription.
While a subscription is canceled, its period will not advance, it will not accrue any new charges, and Advanced Billing will not attempt to collect the overdue balance.
* `expired` - Indicates a subscription that has expired due to running its normal life cycle. Some products may be configured to have an expiration period. An expired subscription then is one that stayed active until it fulfilled its full period.
* `failed_to_create` - Indicates that signup has failed. (You may see this state in a signup_failure webhook.)
* `on_hold` - Indicates that a subscription’s billing has been temporarily stopped. While it is expected that the subscription will resume and return to active status, this is still treated as an “End of Life” state because the customer is not paying for services during this time.
* `suspended` - Indicates that a prepaid subscription has used up all their prepayment balance. If a prepayment is applied, it will return to an active state.
* `trial_ended` - A subscription in a trial_ended state is a subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing) for more details.

See [Subscription States](https://maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscription-States) for more info about subscription states and state transitions. | | `cancel_at_end_of_period` | `TrueClass \| FalseClass` | Optional | - | -| `subscriptions` | [`Array`](../../doc/models/subscription-group-item.md) | Optional | - | +| `subscriptions` | [`Array[SubscriptionGroupItem]`](../../doc/models/subscription-group-item.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`. | ## Example (as JSON) diff --git a/doc/models/subscription-group-signup.md b/doc/models/subscription-group-signup.md index 7bffaf49..a4b1fac5 100644 --- a/doc/models/subscription-group-signup.md +++ b/doc/models/subscription-group-signup.md @@ -16,7 +16,7 @@ | `payer_attributes` | [`PayerAttributes`](../../doc/models/payer-attributes.md) | Optional | - | | `credit_card_attributes` | [`SubscriptionGroupCreditCard`](../../doc/models/subscription-group-credit-card.md) | Optional | - | | `bank_account_attributes` | [`SubscriptionGroupBankAccount`](../../doc/models/subscription-group-bank-account.md) | Optional | - | -| `subscriptions` | [`Array`](../../doc/models/subscription-group-signup-item.md) | Required | - | +| `subscriptions` | [`Array[SubscriptionGroupSignupItem]`](../../doc/models/subscription-group-signup-item.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/subscription-group-subscription-error.md b/doc/models/subscription-group-subscription-error.md index 48124941..19409689 100644 --- a/doc/models/subscription-group-subscription-error.md +++ b/doc/models/subscription-group-subscription-error.md @@ -11,14 +11,14 @@ Object which contains subscription errors. | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `product` | `Array` | Optional | - | -| `product_price_point_id` | `Array` | Optional | - | -| `payment_profile` | `Array` | Optional | - | -| `payment_profile_chargify_token` | `Array` | Optional | - | -| `base` | `Array` | Optional | - | -| `payment_profile_expiration_month` | `Array` | Optional | - | -| `payment_profile_expiration_year` | `Array` | Optional | - | -| `payment_profile_full_number` | `Array` | Optional | - | +| `product` | `Array[String]` | Optional | - | +| `product_price_point_id` | `Array[String]` | Optional | - | +| `payment_profile` | `Array[String]` | Optional | - | +| `payment_profile_chargify_token` | `Array[String]` | Optional | - | +| `base` | `Array[String]` | Optional | - | +| `payment_profile_expiration_month` | `Array[String]` | Optional | - | +| `payment_profile_expiration_year` | `Array[String]` | Optional | - | +| `payment_profile_full_number` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/subscription-group-update-error.md b/doc/models/subscription-group-update-error.md index cec3df09..13309af2 100644 --- a/doc/models/subscription-group-update-error.md +++ b/doc/models/subscription-group-update-error.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `members` | `Array` | Optional | - | +| `members` | `Array[String]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/subscription-group.md b/doc/models/subscription-group.md index 5af6a19d..33566850 100644 --- a/doc/models/subscription-group.md +++ b/doc/models/subscription-group.md @@ -12,7 +12,7 @@ | `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`. | -| `subscription_ids` | `Array` | Optional | - | +| `subscription_ids` | `Array[Integer]` | Optional | - | | `created_at` | `DateTime` | Optional | - | ## Example (as JSON) diff --git a/doc/models/subscription-mrr-response.md b/doc/models/subscription-mrr-response.md index 2c6ab801..830ca6c0 100644 --- a/doc/models/subscription-mrr-response.md +++ b/doc/models/subscription-mrr-response.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptions_mrr` | [`Array`](../../doc/models/subscription-mrr.md) | Required | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | +| `subscriptions_mrr` | [`Array[SubscriptionMRR]`](../../doc/models/subscription-mrr.md) | Required | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | ## Example (as JSON) diff --git a/doc/models/subscription-remove-coupon-errors-exception.md b/doc/models/subscription-remove-coupon-errors-exception.md index 4d679d61..360c938c 100644 --- a/doc/models/subscription-remove-coupon-errors-exception.md +++ b/doc/models/subscription-remove-coupon-errors-exception.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `subscription` | `Array` | Required | - | +| `subscription` | `Array[String]` | Required | - | ## Example (as JSON) diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 9e2cfe7e..1692bc39 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` | `String` | Optional | The day of the month that the subscription will charge according to calendar billing rules, if used. | +| `snap_day` | Integer \| [SnapDay](../../doc/models/snap-day.md) \| nil | Optional | This is a container for one-of cases. | | `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 | - | @@ -48,10 +48,10 @@ | `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. | | `automatically_resume_at` | `DateTime` | Optional | The date the subscription is scheduled to automatically resume from the on_hold state. | -| `coupon_codes` | `Array` | Optional | An array for all the coupons attached to the subscription. | +| `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. | | `payer_id` | `Integer` | Optional | On Relationship Invoicing, the ID of the individual paying for the subscription. Defaults to the Customer ID unless the 'Customer Hierarchies & WhoPays' feature is enabled. | -| `current_billing_amount_in_cents` | `Integer` | Optional | The balance in cents plus the estimated renewal amount in cents. Returned ONLY for readSubscription operation as it's compute intensive operation. | +| `current_billing_amount_in_cents` | `Integer` | Optional | The balance in cents plus the estimated renewal amount in cents. Returned ONLY for the readSubscription operation as it's a compute intensive operation. | | `product_price_point_id` | `Integer` | Optional | The product price point currently subscribed to. | | `product_price_point_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. | | `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. | @@ -60,7 +60,7 @@ | `reference` | `String` | Optional | The reference value (provided by your app) for the subscription itelf. | | `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`](../../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. | +| `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. | | `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. | | `receives_invoice_emails` | `TrueClass \| FalseClass` | Optional | - | diff --git a/doc/models/trial-type.md b/doc/models/trial-type.md new file mode 100644 index 00000000..1298d99b --- /dev/null +++ b/doc/models/trial-type.md @@ -0,0 +1,16 @@ + +# Trial Type + +Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. + +## Enumeration + +`TrialType` + +## Fields + +| Name | +| --- | +| `NO_OBLIGATION` | +| `PAYMENT_EXPECTED` | + diff --git a/doc/models/update-component-price-point.md b/doc/models/update-component-price-point.md index 43351233..beff7fd6 100644 --- a/doc/models/update-component-price-point.md +++ b/doc/models/update-component-price-point.md @@ -16,7 +16,7 @@ | `tax_included` | `TrueClass \| FalseClass` | Optional | Whether or not the price point includes tax | | `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`](../../doc/models/update-price.md) | Optional | - | +| `prices` | [`Array[UpdatePrice]`](../../doc/models/update-price.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/update-component.md b/doc/models/update-component.md index 1c4aa2b9..30130d53 100644 --- a/doc/models/update-component.md +++ b/doc/models/update-component.md @@ -14,7 +14,7 @@ | `description` | `String` | Optional | The description of the component. | | `accounting_code` | `String` | Optional | - | | `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 the Avalara service to tax based on locale. This attribute has a max length of 10 characters. | +| `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`. | diff --git a/doc/models/update-currency-prices-request.md b/doc/models/update-currency-prices-request.md index 9549582f..29e7fbe5 100644 --- a/doc/models/update-currency-prices-request.md +++ b/doc/models/update-currency-prices-request.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `currency_prices` | [`Array`](../../doc/models/update-currency-price.md) | Required | - | +| `currency_prices` | [`Array[UpdateCurrencyPrice]`](../../doc/models/update-currency-price.md) | Required | - | ## Example (as JSON) diff --git a/doc/models/update-metafield.md b/doc/models/update-metafield.md index 9cb08987..5de4d166 100644 --- a/doc/models/update-metafield.md +++ b/doc/models/update-metafield.md @@ -12,8 +12,8 @@ | `current_name` | `String` | Optional | - | | `name` | `String` | Optional | - | | `scope` | [`MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | -| `input_type` | [`MetafieldInput`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text' | -| `enum` | `Array` | Optional | Only applicable when input_type is radio or dropdown | +| `input_type` | [`MetafieldInput`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | +| `enum` | `Array[String]` | Optional | Only applicable when input_type is radio or dropdown. | ## Example (as JSON) diff --git a/doc/models/update-payment-profile.md b/doc/models/update-payment-profile.md index 7cdeee72..64c07894 100644 --- a/doc/models/update-payment-profile.md +++ b/doc/models/update-payment-profile.md @@ -20,7 +20,7 @@ | `billing_city` | `String` | Optional | The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | | `billing_state` | `String` | Optional | The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | | `billing_zip` | `String` | Optional | The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | -| `billing_country` | `String` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | +| `billing_country` | `String` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | | `billing_address_2` | `String` | Optional | Second line of the customer’s billing address i.e. Apt. 100 | ## Example (as JSON) diff --git a/doc/models/update-segment.md b/doc/models/update-segment.md index dc5e8e5b..cd4bf25f 100644 --- a/doc/models/update-segment.md +++ b/doc/models/update-segment.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | | `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`](../../doc/models/create-or-update-segment-price.md) | Optional | - | +| `prices` | [`Array[CreateOrUpdateSegmentPrice]`](../../doc/models/create-or-update-segment-price.md) | Optional | - | ## Example (as JSON) diff --git a/doc/models/update-subscription-component.md b/doc/models/update-subscription-component.md index 932cd474..63423dd9 100644 --- a/doc/models/update-subscription-component.md +++ b/doc/models/update-subscription-component.md @@ -33,7 +33,8 @@ "ending_quantity": 40, "unit_price": 23.26 } - ] + ], + "renew_prepaid_allocation": false } } ``` diff --git a/doc/models/update-subscription-group.md b/doc/models/update-subscription-group.md index e4b53623..fa720d9c 100644 --- a/doc/models/update-subscription-group.md +++ b/doc/models/update-subscription-group.md @@ -9,7 +9,7 @@ | Name | Type | Tags | Description | | --- | --- | --- | --- | -| `member_ids` | `Array` | Optional | - | +| `member_ids` | `Array[Integer]` | Optional | - | ## Example (as JSON) diff --git a/doc/models/update-subscription.md b/doc/models/update-subscription.md index 80763f91..6777f412 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` | [SnapDay](../../doc/models/snap-day.md) \| Integer \| nil | Optional | This is a container for one-of cases. | +| `snap_day` | Integer \| [SnapDay](../../doc/models/snap-day.md) \| 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 | - | @@ -26,7 +26,7 @@ | `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 | -| `components` | [`Array`](../../doc/models/update-subscription-component.md) | Optional | (Optional) An array of component ids and custom prices to be added to the subscription. | +| `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. | | `product_price_point_id` | `Integer` | Optional | Set to change the current product's price point. | diff --git a/lib/advanced_billing.rb b/lib/advanced_billing.rb index 967403f3..b9f236e2 100644 --- a/lib/advanced_billing.rb +++ b/lib/advanced_billing.rb @@ -623,6 +623,7 @@ require_relative 'advanced_billing/models/subscription_state_filter' 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/webhook_order' require_relative 'advanced_billing/models/webhook_status' require_relative 'advanced_billing/models/webhook_subscription' diff --git a/lib/advanced_billing/client.rb b/lib/advanced_billing/client.rb index 4ab9d876..ad03241f 100644 --- a/lib/advanced_billing/client.rb +++ b/lib/advanced_billing/client.rb @@ -9,6 +9,10 @@ class Client include CoreLibrary attr_reader :config, :auth_managers + def user_agent_detail + config.user_agent_detail + end + # Access to api_exports controller. # @return [APIExportsController] Returns the controller instance. def api_exports @@ -242,5 +246,12 @@ def initialize_auth_managers(global_config) %w[BasicAuth].each { |auth| @auth_managers[auth] = nil } @auth_managers['BasicAuth'] = BasicAuth.new(http_client_config.basic_auth_credentials) end + + # Creates a client directly from environment variables. + def self.from_env(**overrides) + default_config = Configuration.build_default_config_from_env + new_config = default_config.clone_with(**overrides) + new(config: new_config) + end end end diff --git a/lib/advanced_billing/configuration.rb b/lib/advanced_billing/configuration.rb index 9e165ae4..8b39d8ac 100644 --- a/lib/advanced_billing/configuration.rb +++ b/lib/advanced_billing/configuration.rb @@ -12,6 +12,21 @@ class Environment US = 'US'.freeze, EU = 'EU'.freeze ].freeze + + # Converts a string or symbol into a valid Environment constant. + def self.from_value(value, default_value = US) + return default_value if value.nil? + + str = value.to_s.strip.downcase + case str + when 'us' then US + when 'eu' then EU + + else + warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} " + default_value + end + end end # An enum for API servers. @@ -20,6 +35,21 @@ class Server PRODUCTION = 'production'.freeze, EBB = 'ebb'.freeze ].freeze + + # Converts a string or symbol into a valid Server constant. + def self.from_value(value, default_value = PRODUCTION) + return default_value if value.nil? + + str = value.to_s.strip.downcase + case str + when 'production' then PRODUCTION + when 'ebb' then EBB + + else + warn "[Server] Unknown server '#{value}', falling back to #{default_value} " + default_value + end + end end # All configuration including auth info and base URI for the API access @@ -118,5 +148,48 @@ def get_base_uri(server = Server::PRODUCTION) ENVIRONMENTS[environment][server], parameters ) end + + # Builds a Configuration instance using environment variables. + def self.build_default_config_from_env + # === Core environment === + environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'us')) + site = ENV.fetch('SITE', 'subdomain') + timeout = (ENV['TIMEOUT'] || 120).to_f + max_retries = (ENV['MAX_RETRIES'] || 0).to_i + retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f + backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f + retry_statuses = ENV.fetch('RETRY_STATUSES', + '[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '') + .split(',') + .map(&:strip) + .map do |item| + item.match?(/\A\d+\z/) ? item.to_i : item.downcase + end + retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '') + .split(',') + .map(&:strip) + .map do |item| + item.match?(/\A\d+\z/) ? item.to_i : item.downcase + end + + # === Authentication credentials === + basic_auth_credentials = BasicAuthCredentials.from_env + + # === Proxy settings === + proxy_settings = ProxySettings.from_env + + Configuration.new( + environment: environment, + site: site, + timeout: timeout, + max_retries: max_retries, + retry_interval: retry_interval, + backoff_factor: backoff_factor, + retry_statuses: retry_statuses, + retry_methods: retry_methods, + basic_auth_credentials: basic_auth_credentials, + proxy_settings: proxy_settings + ) + end end end diff --git a/lib/advanced_billing/controllers/advance_invoice_controller.rb b/lib/advanced_billing/controllers/advance_invoice_controller.rb index 799cae47..61d13458 100644 --- a/lib/advanced_billing/controllers/advance_invoice_controller.rb +++ b/lib/advanced_billing/controllers/advance_invoice_controller.rb @@ -7,7 +7,7 @@ module AdvancedBilling # AdvanceInvoiceController class AdvanceInvoiceController < BaseController # Generate an invoice in advance for a subscription's next renewal date. - # [Please see our + # [See our # docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Inv # oice-In-Advance) for more information on advance invoices, including # eligibility on generating one; for the most part, they function like any @@ -85,7 +85,7 @@ def read_advance_invoice(subscription_id) # A `reason` is required in order to void, and the invoice must have an open # status. Voiding will cause any prepayments and credits that were applied # to the invoice to be returned to the subscription. For a full overview of - # the impact of voiding, please [see our help docs]($m/Invoice). + # the impact of voiding, [see our help docs]($m/Invoice). # @param [Integer] subscription_id Required parameter: The Chargify id of # the subscription # @param [VoidInvoiceRequest] body Optional parameter: TODO: type diff --git a/lib/advanced_billing/controllers/base_controller.rb b/lib/advanced_billing/controllers/base_controller.rb index 7fc8da00..4bb16cc1 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:7.0.1 on OS {os-info}' + 'AB SDK Ruby:8.0.0 on OS {os-info}' end def self.user_agent_parameters diff --git a/lib/advanced_billing/controllers/billing_portal_controller.rb b/lib/advanced_billing/controllers/billing_portal_controller.rb index 89a75939..ffb93ce0 100644 --- a/lib/advanced_billing/controllers/billing_portal_controller.rb +++ b/lib/advanced_billing/controllers/billing_portal_controller.rb @@ -30,8 +30,8 @@ class BillingPortalController < BaseController # In order to prevent abuse & overuse, we ask that you request a new URL # only when absolutely necessary. Management URLs are good for 65 days, so # you should re-use a previously generated one as much as possible. If you - # use the URL frequently (such as to display on your website), please **do - # not** make an API request to Advanced Billing every time. + # use the URL frequently (such as to display on your website), **do not** + # make an API request to Advanced Billing every time. # @param [Integer] customer_id Required parameter: The Chargify id of the # customer # @param [AutoInvite] auto_invite Optional parameter: When set to 1, an diff --git a/lib/advanced_billing/controllers/component_price_points_controller.rb b/lib/advanced_billing/controllers/component_price_points_controller.rb index febb82c3..4b000829 100644 --- a/lib/advanced_billing/controllers/component_price_points_controller.rb +++ b/lib/advanced_billing/controllers/component_price_points_controller.rb @@ -151,8 +151,8 @@ def bulk_create_component_price_points(component_id, .execute end - # When updating a price point, it's prices can be updated as well by - # creating new prices or editing / removing existing ones. + # When updating a price point, prices can be updated as well by creating new + # prices or editing / removing existing ones. # Passing in a price bracket without an `id` will attempt to create a new # price. # Including an `id` will update the corresponding price, and including the diff --git a/lib/advanced_billing/controllers/components_controller.rb b/lib/advanced_billing/controllers/components_controller.rb index a2d24662..5b9c7295 100644 --- a/lib/advanced_billing/controllers/components_controller.rb +++ b/lib/advanced_billing/controllers/components_controller.rb @@ -17,7 +17,7 @@ class ComponentsController < BaseController # which DO NOT reset to zero at the start of every billing period. If you # want to bill for a quantity of something that does not change unless you # change it, then you want quantity components, instead. - # For more information on components, please see our documentation + # For more information on components, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Componen # ts-Overview). # @param [String] product_family_id Required parameter: Either the product @@ -67,7 +67,7 @@ def create_metered_component(product_family_id, # charge your customer a one-time fee for onboarding or other services. # The allocated quantity for one-time quantity-based components immediately # gets reset back to zero after the allocation is made. - # For more information on components, please see our documentation + # For more information on components, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Componen # ts-Overview). # @param [String] product_family_id Required parameter: Either the product @@ -107,7 +107,7 @@ def create_quantity_based_component(product_family_id, # can then be added and “allocated” for a subscription. # On/off components are used for any flat fee, recurring add on (think # $99/month for tech support or a flat add on shipping fee). - # For more information on components, please see our documentation + # For more information on components, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Componen # ts-Overview). # @param [String] product_family_id Required parameter: Either the product @@ -151,7 +151,7 @@ def create_on_off_component(product_family_id, # period for the amount of units used, prepaid components are charged for at # the time of purchase, and we subsequently keep track of the usage against # the amount purchased. - # For more information on components, please see our documentation + # For more information on components, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Componen # ts-Overview). # @param [String] product_family_id Required parameter: Either the product @@ -198,7 +198,7 @@ def create_prepaid_usage_component(product_family_id, # So, instead of reporting usage directly for each component (as you would # with metered components), the usage is derived from analysis of your # events. - # For more information on components, please see our documentation + # For more information on components, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Componen # ts-Overview). # @param [String] product_family_id Required parameter: Either the product diff --git a/lib/advanced_billing/controllers/coupons_controller.rb b/lib/advanced_billing/controllers/coupons_controller.rb index 7fedc5ca..9e897a48 100644 --- a/lib/advanced_billing/controllers/coupons_controller.rb +++ b/lib/advanced_billing/controllers/coupons_controller.rb @@ -8,11 +8,11 @@ module AdvancedBilling class CouponsController < BaseController # ## Coupons Documentation # Coupons can be administered in the Advanced Billing application or created - # via API. Please view our section on [creating + # via API. View our section on [creating # coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creati # ng-Editing-Deleting-Coupons) for more information. # Additionally, for documentation on how to apply a coupon to a subscription - # within the Advanced Billing UI, please see our documentation + # within the Advanced Billing UI, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons- # and-Subscriptions). # ## Create Coupon @@ -53,9 +53,6 @@ def create_coupon(product_family_id, end # List coupons for a specific Product Family in a Site. - # If the coupon is set to `use_site_exchange_rate: true`, it will return - # pricing based on the current exchange rate. If the flag is set to false, - # it will return all of the defined prices for each currency. # @param [Integer] product_family_id Required parameter: The Advanced # Billing id of the product family to which the coupon belongs # @param [Integer] page Optional parameter: Result records are organized in @@ -247,9 +244,6 @@ def archive_coupon(product_family_id, end # You can retrieve a list of coupons. - # If the coupon is set to `use_site_exchange_rate: true`, it will return - # pricing based on the current exchange rate. If the flag is set to false, - # it will return all of the defined prices for each currency. # @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 @@ -291,9 +285,9 @@ def list_coupons(options = {}) # This request will provide details about the coupon usage as an array of # data hashes, one per product. # @param [Integer] product_family_id Required parameter: The Advanced - # Billing id of the product family to which the coupon belongs + # Billing id of the product family to which the coupon belongs. # @param [Integer] coupon_id Required parameter: The Advanced Billing id of - # the coupon + # the coupon. # @return [Array[CouponUsage]] Response from the API call. def read_coupon_usage(product_family_id, coupon_id) @@ -423,7 +417,7 @@ def create_or_update_coupon_currency_prices(coupon_id, # [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-C # odes). # Additionally, for documentation on how to apply a coupon to a Subscription - # within the Advanced Billing UI, please see our documentation + # within the Advanced Billing UI, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons- # and-Subscriptions). # ## Create Coupon Subcode diff --git a/lib/advanced_billing/controllers/custom_fields_controller.rb b/lib/advanced_billing/controllers/custom_fields_controller.rb index 1d2a88e1..33474bb4 100644 --- a/lib/advanced_billing/controllers/custom_fields_controller.rb +++ b/lib/advanced_billing/controllers/custom_fields_controller.rb @@ -6,43 +6,31 @@ module AdvancedBilling # CustomFieldsController class CustomFieldsController < BaseController - # ## Custom Fields: Metafield Intro - # **Advanced Billing refers to Custom Fields in the API documentation as - # metafields and metadata.** Within the Advanced Billing UI, metadata and - # metafields are grouped together under the umbrella of "Custom Fields." All - # of our UI-based documentation that references custom fields will not cite - # the terminology metafields or metadata. - # + **Metafield is the custom field** - # + **Metadata is the data populating the custom field.** - # Advanced Billing Metafields are used to add meaningful attributes to - # subscription and customer resources. Full documentation on how to create - # Custom Fields in the Advanced Billing UI can be located - # [here](https://maxio.zendesk.com/hc/en-us/sections/24266118312589-Custom-F - # ields). For additional documentation on how to record data within custom - # fields, please see our subscription-based documentation - # [here](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscrip - # tion-Summary-Custom-Fields-Tab). - # Metafield are the place where you will set up your resource to accept - # additional data. It is scoped to the site instead of a specific customer - # or subscription. Think of it as the key, and Metadata as the value on - # every record. - # ## Create Metafields - # Use this endpoint to create metafields for your Site. Metafields can be - # populated with metadata after the fact. - # Each site is limited to 100 unique Metafields (i.e. keys, or names) per - # resource. This means you can have 100 Metafields for Subscription and - # another 100 for Customer. - # ### Metafields "On-the-Fly" - # It is possible to create Metafields “on the fly” when you create your - # Metadata – if a non-existent name is passed when creating Metadata, a - # Metafield for that key will be automatically created. The Metafield API, - # however, gives you more control over your “keys”. - # ### Metafield Scope Warning - # If configuring metafields in the Admin UI or via the API, be careful - # sending updates to metafields with the scope attribute – **if a partial - # update is sent it will overwrite the current configuration**. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Creates metafields on a Site for either the Subscriptions or Customers + # resource. + # Metafields and their metadata are created in the Custom Fields + # configuration page on your Site. Metafields can be populated with metadata + # when you create them or later with the [Update + # Metafield]($e/Custom%20Fields/updateMetafield), [Create + # Metadata]($e/Custom%20Fields/createMetadata), or [Update + # Metadata]($e/Custom%20Fields/updateMetadata) endpoints. The Create + # Metadata and Update Metadata endpoints allow you to add metafields and + # metadata values to a specific subscription or customer. + # Each site is limited to 100 unique metafields per resource. This means you + # can have 100 metafields for Subscriptions and another 100 for Customers. + # > Note: After creating a metafield, the resource type cannot be modified. + # In the UI and product documentation, metafields and metadata are called + # Custom Fields. + # - Metafield is the custom field + # - Metadata is the data populating the custom field. + # See [Custom Fields + # Reference](https://docs.maxio.com/hc/en-us/articles/24266140850573-Custom- + # Fields-Reference) and [Custom Fields + # Tab](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscripti + # on-Summary-Custom-Fields-Tab) for information on using Custom Fields in + # the Advanced Billing UI. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [CreateMetafieldsRequest] body Optional parameter: TODO: type # description here # @return [Array[Metafield]] Response from the API call. @@ -71,12 +59,12 @@ def create_metafields(resource_type, .execute end - # This endpoint lists metafields associated with a site. The metafield - # description and usage is contained in the response. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong - # @param [String] name Optional parameter: filter by the name of the - # metafield + # Lists the metafields and their associated details for a Site and resource + # type. You can filter the request to a specific metafield. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. + # @param [String] name Optional parameter: Filter by the name of the + # metafield. # @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 @@ -111,10 +99,38 @@ def list_metafields(options = {}) .execute end - # Use the following method to update metafields for your Site. Metafields - # can be populated with metadata after the fact. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Updates metafields on your Site for a resource type. Depending on the + # request structure, you can update or add metafields and metadata to the + # Subscriptions or Customers resource. + # With this endpoint, you can: + # - Add metafields. If the metafield specified in current_name does not + # exist, a new metafield is added. + # >Note: Each site is limited to 100 unique metafields per resource. This + # means you can have 100 metafields for Subscriptions and another 100 for + # Customers. + # - Change the name of a metafield. + # >Note: To keep the metafield name the same and only update the metadata + # for the metafield, you must use the current metafield name in both the + # `current_name` and `name` parameters. + # - Change the input type for the metafield. For example, you can change a + # metafield input type from text to a dropdown. If you change the input type + # from text to a dropdown or radio, you must update the specific + # subscriptions or customers where the metafield was used to reflect the + # updated metafield and metadata. + # - Add metadata values to the existing metadata for a dropdown or radio + # metafield. + # >Note: Updates to metadata overwrite. To add one or more values, you + # must specify all metadata values including the new value you want to add. + # - Add new metadata to a dropdown or radio for a metafield that was created + # without metadata. + # - Remove metadata for a dropdown or radio for a metafield. + # >Note: Updates to metadata overwrite existing values. To remove one or + # more values, specify all metadata values except those you want to remove. + # - Add or update scope settings for a metafield. + # >Note: Scope changes overwrite existing settings. You must specify the + # complete scope, including the changes you want to make. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [UpdateMetafieldsRequest] body Optional parameter: TODO: type # description here # @return [Array[Metafield]] Response from the API call. @@ -143,12 +159,10 @@ def update_metafield(resource_type, .execute end - # Use the following method to delete a metafield. This will remove the - # metafield from the Site. - # Additionally, this will remove the metafield and associated metadata with - # all Subscriptions on the Site. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Deletes a metafield from your Site. Removes the metafield and associated + # metadata from all Subscriptions or Customers resources on the Site. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [String] name Optional parameter: The name of the metafield to be # deleted # @return [void] Response from the API call. @@ -171,36 +185,19 @@ def delete_metafield(resource_type, .execute end - # ## Custom Fields: Metadata Intro - # **Advanced Billing refers to Custom Fields in the API documentation as - # metafields and metadata.** Within the Advanced Billing UI, metadata and - # metafields are grouped together under the umbrella of "Custom Fields." All - # of our UI-based documentation that references custom fields will not cite - # the terminology metafields or metadata. - # + **Metafield is the custom field** - # + **Metadata is the data populating the custom field.** - # Advanced Billing Metafields are used to add meaningful attributes to - # subscription and customer resources. Full documentation on how to create - # Custom Fields in the Advanced Billing UI can be located - # [here](https://maxio.zendesk.com/hc/en-us/articles/24266164865677-Custom-F - # ields-Overview). For additional documentation on how to record data within - # custom fields, please see our subscription-based documentation - # [here.](https://maxio.zendesk.com/hc/en-us/articles/24251701302925-Subscri - # ption-Summary-Custom-Fields-Tab) - # Metadata is associated to a customer or subscription, and corresponds to a - # Metafield. When creating a new metadata object for a given record, **if - # the metafield is not present it will be created**. - # ## Metadata limits - # Metadata values are limited to 2kB in size. Additonally, there are limits - # on the number of unique metafields available per resource. - # ## Create Metadata - # This method will create a metafield for the site on the fly if it does not - # already exist, and populate the metadata value. - # ### Subscription or Customer Resource - # Please pay special attention to the resource you use when creating - # metadata. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Creates metadata and metafields for a specific subscription or customer, + # or updates metadata values of existing metafields for a subscription or + # customer. Metadata values are limited to 2 KB in size. + # If you create metadata on a subscription or customer with a metafield that + # does not already exist, the metafield is created with the metadata you + # specify and it is always added as a text field. You can update the + # input_type for the metafield with the [Update + # Metafield]($e/Custom%20Fields/updateMetafield) endpoint. + # >Note: Each site is limited to 100 unique metafields per resource. This + # means you can have 100 metafields for Subscriptions and another 100 for + # Customers. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [Integer] resource_id Required parameter: The Advanced Billing id # of the customer or the subscription for which the metadata applies # @param [CreateMetadataRequest] body Optional parameter: TODO: type @@ -235,13 +232,9 @@ def create_metadata(resource_type, .execute end - # This request will list all of the metadata belonging to a particular - # resource (ie. subscription, customer) that is specified. - # ## Metadata Data - # This endpoint will also display the current stats of your metadata to use - # as a tool for pagination. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Lists metadata and metafields for a specific customer or subscription. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [Integer] resource_id Required parameter: The Advanced Billing id # of the customer or the subscription for which the metadata applies # @param [Integer] page Optional parameter: Result records are organized in @@ -277,10 +270,18 @@ def list_metadata(options = {}) .execute end - # This method allows you to update the existing metadata associated with a - # subscription or customer. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Updates metadata and metafields on the Site and the customer or + # subscription specified, and updates the metadata value on a subscription + # or customer. + # If you update metadata on a subscription or customer with a metafield that + # does not already exist, the metafield is created with the metadata you + # specify and it is always added as a text field to the Site and to the + # subscription or customer you specify. You can update the input_type for + # the metafield with the Update Metafield endpoint. + # Each site is limited to 100 unique metafields per resource. This means you + # can have 100 metafields for Subscription and another 100 for Customer. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [Integer] resource_id Required parameter: The Advanced Billing id # of the customer or the subscription for which the metadata applies # @param [UpdateMetadataRequest] body Optional parameter: TODO: type @@ -315,27 +316,10 @@ def update_metadata(resource_type, .execute end - # This method removes the metadata from the subscriber/customer cited. - # ## Query String Usage - # For instance if you wanted to delete the metadata for customer 99 named - # weight you would request: - # ``` - # https://acme.chargify.com/customers/99/metadata.json?name=weight - # ``` - # If you want to delete multiple metadata fields for a customer 99 named: - # `weight` and `age` you wrould request: - # ``` - # https://acme.chargify.com/customers/99/metadata.json?names[]=weight&names[ - # ]=age - # ``` - # ## Successful Response - # For a success, there will be a code `200` and the plain text response - # `true`. - # ## Unsuccessful Response - # When a failed response is encountered, you will receive a `404` response - # and the plain text response of `true`. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Deletes one or more metafields (and associated metadata) from the + # specified subscription or customer. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @param [Integer] resource_id Required parameter: The Advanced Billing id # of the customer or the subscription for which the metadata applies # @param [String] name Optional parameter: Name of field to be removed. @@ -369,19 +353,9 @@ def delete_metadata(resource_type, .execute end - # This method will provide you information on usage of metadata across your - # selected resource (ie. subscriptions, customers) - # ## Metadata Data - # This endpoint will also display the current stats of your metadata to use - # as a tool for pagination. - # ### Metadata for multiple records - # `https://acme.chargify.com/subscriptions/metadata.json?resource_ids[]=1&re - # source_ids[]=2` - # ## Read Metadata for a Site - # This endpoint will list the number of pages of metadata information that - # are contained within a site. - # @param [ResourceType] resource_type Required parameter: the resource type - # to which the metafields belong + # Lists metadata for a specified array of subscriptions or customers. + # @param [ResourceType] resource_type Required parameter: The resource type + # to which the metafields belong. # @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/customers_controller.rb b/lib/advanced_billing/controllers/customers_controller.rb index ff1fb85d..ea653c70 100644 --- a/lib/advanced_billing/controllers/customers_controller.rb +++ b/lib/advanced_billing/controllers/customers_controller.rb @@ -22,8 +22,8 @@ class CustomersController < BaseController # ## Required Country Format # Advanced Billing requires that you use the ISO Standard Country codes when # formatting country attribute of the customer. - # Countries should be formatted as 2 characters. For more information, - # please see the following wikipedia article on + # Countries should be formatted as 2 characters. For more information, see + # the following wikipedia article on # [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) # ## Required State Format # Advanced Billing requires that you use the ISO Standard State codes when @@ -31,7 +31,7 @@ class CustomersController < BaseController # + US States (2 characters): # [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US) # + States Outside the US (2-3 characters): To find the correct state codes - # outside of the US, please go to + # outside of the US, go to # [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and # click on the link in the “ISO 3166-2 codes” column next to country you # wish to populate. @@ -74,7 +74,7 @@ def create_customer(body: nil) # + Search by an organization # + Search by a reference value from your application # + Search by a first or last name - # To retrieve a single, exact match by reference, please use the [lookup + # To retrieve a single, exact match by reference, use the [lookup # endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read # -customer-by-reference). # @param [SortingDirection] direction Optional parameter: Direction to sort diff --git a/lib/advanced_billing/controllers/invoices_controller.rb b/lib/advanced_billing/controllers/invoices_controller.rb index dc77f689..04bf13eb 100644 --- a/lib/advanced_billing/controllers/invoices_controller.rb +++ b/lib/advanced_billing/controllers/invoices_controller.rb @@ -658,6 +658,38 @@ def list_consolidated_invoice_segments(options = {}) # ] # ... # ``` + # #### Using Coupon Subcodes + # You can also use coupon subcodes to apply existing coupons with specific + # subcodes: + # ```json + # ... + # "coupons": [ + # { + # "subcode": "SUB1", + # "product_family_id": 1 + # } + # ] + # ... + # ``` + # **Important:** You cannot specify both `code` and `subcode` for the same + # coupon. Use either: + # - `code` to apply a main coupon + # - `subcode` to apply a specific coupon subcode + # The API response will include both the main coupon code and the subcode + # used: + # ```json + # ... + # "coupons": [ + # { + # "code": "MAIN123", + # "subcode": "SUB1", + # "product_family_id": 1, + # "percentage": 10, + # "description": "Special discount" + # } + # ] + # ... + # ``` # ### Coupon options # #### Code # Coupon `code` will be displayed on invoice discount section. @@ -666,6 +698,11 @@ def list_consolidated_invoice_segments(options = {}) # Lowercase letters will be converted to uppercase. It can be used to select # an existing coupon from the catalog, or as an ad hoc coupon when passed # with `percentage` or `amount`. + # #### Subcode + # Coupon `subcode` allows you to apply existing coupons using their + # subcodes. When a subcode is used, the API response will include both the + # main coupon code and the specific subcode that was applied. Subcodes are + # case-insensitive and will be converted to uppercase automatically. # #### Percentage # Coupon `percentage` can take values from 0 to 100 and up to 4 decimal # places. It cannot be used with `amount`. Only for ad hoc coupons, will be @@ -724,8 +761,8 @@ def list_consolidated_invoice_segments(options = {}) # #### Addresses # The seller, shipping and billing addresses can be sent to override the # site's defaults. Each address requires to send a `first_name` at a minimum - # in order to work. Please see below for the details on which parameters can - # be sent for each address object. + # in order to work. See below for the details on which parameters can be + # sent for each address object. # #### Memo and Payment Instructions # A custom memo can be sent with the `memo` parameter to override the site's # default. Likewise, custom payment instructions can be sent with the @@ -767,15 +804,15 @@ 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. - # Please note that if no recipient email addresses are specified in the - # request, then the subscription's default email configuration will be used. - # For example, if `recipient_emails` is left blank, then the invoice will be - # delivered to the subscription's customer email address. - # On success, a 204 no-content response will be returned. Please note that - # this does not indicate that email(s) have been delivered, but instead - # indicates that emails have been successfully queued for delivery. If _any_ - # invalid or malformed email address is found in the request body, the - # entire request will be rejected and a 422 response will be returned. + # If no recipient email addresses are specified in the request, then the + # subscription's default email configuration will be used. For example, if + # `recipient_emails` is left blank, then the invoice will be delivered to + # the subscription's customer email address. + # On success, a 204 no-content response will be returned. The response does + # not indicate that email(s) have been delivered, but instead indicates that + # emails have been successfully queued for delivery. If _any_ invalid or + # malformed email address is found in the request body, the entire request + # will be rejected and a 422 response will be returned. # @param [String] uid Required parameter: The unique identifier for the # invoice, this does not refer to the public facing invoice number. # @param [SendInvoiceRequest] body Optional parameter: TODO: type diff --git a/lib/advanced_billing/controllers/payment_profiles_controller.rb b/lib/advanced_billing/controllers/payment_profiles_controller.rb index 250edf83..06e50450 100644 --- a/lib/advanced_billing/controllers/payment_profiles_controller.rb +++ b/lib/advanced_billing/controllers/payment_profiles_controller.rb @@ -6,40 +6,27 @@ module AdvancedBilling # PaymentProfilesController class PaymentProfilesController < BaseController - # Use this endpoint to create a payment profile for a customer. - # Payment Profiles house the credit card, ACH (Authorize.Net or Stripe - # only,) or PayPal (Braintree only,) data for a customer. The payment - # information is attached to the customer within Advanced Billing, as - # opposed to the Subscription itself. - # You must include a customer_id so that Advanced Billing will attach it to - # the customer entry. If no customer_id is included the API will return a - # 404. - # ## Create a Payment Profile for ACH usage - # If you would like to create a payment method that is a Bank Account - # applicable for ACH payments use the following: - # ```json - # { - # "payment_profile": { - # "customer_id": [Valid-Customer-ID], - # "bank_name": "Best Bank", - # "bank_routing_number": "021000089", - # "bank_account_number": "111111111111", - # "bank_account_type": "checking", - # "bank_account_holder_type": "business", - # "payment_type": "bank_account" - # } - # } - # ``` - # ## Taxable Subscriptions - # If your subscriber pays taxes on their purchased product, and you are - # attempting to create or update the `payment_profile`, complete address - # information is required. For information on required address formatting to - # allow your subscriber to be taxed, please see our documentation - # [here](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-s - # ignups#taxes) - # ## Payment Profile Documentation - # Full documentation on how Payment Profiles operate within Advanced Billing - # can be located under the following links: + # Creates a payment profile for a customer. + # When you create a new payment profile for a customer via the API, it does + # not automatically make the profile current for any of the customer’s + # subscriptions. To use the payment profile as the default, you must set it + # explicitly for the subscription or subscription group. + # Select an option from the **Request Examples** drop-down on the right side + # of the portal to see examples of common scenarios for creating payment + # profiles. + # Do not use real card information for testing. See the Sites articles that + # cover [testing your site + # setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Ove + # rview#testing-overview-0-0) for more details on testing in your sandbox. + # Note that collecting and sending raw card details in production requires + # [PCI + # compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Co + # mpliance#pci-compliance-0-0) on your end. If your business is not PCI + # compliant, use + # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char + # gify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank + # account information. + # See the following articles to learn more about subscriptions and payments: # + [Subscriber Payment # Details](https://maxio.zendesk.com/hc/en-us/articles/24251599929613-Subscr # iption-Summary-Payment-Details-Tab) @@ -49,210 +36,50 @@ class PaymentProfilesController < BaseController # + [Public Signup Pages payment # settings](https://maxio.zendesk.com/hc/en-us/articles/24261368332557-Indiv # idual-Page-Settings) - # ## Create a Payment Profile with a Chargify.js token - # ```json - # { - # "payment_profile": { - # "customer_id": 1036, - # "chargify_token": "tok_w68qcpnftyv53jk33jv6wk3w" - # } - # } - # ``` - # ## Active Payment Methods - # Creating a new payment profile for a Customer via the API will not make - # that Payment Profile current for any of the Customer’s Subscriptions. In - # order to utilize the payment profile as the default, it must be set as the - # default payment profile for the subscription or subscription group. - # ## Requirements - # Either the full_number, expiration_month, and expiration_year or if you - # have an existing vault_token from your gateway, that vault_token and the - # current_vault are required. - # Passing in the vault_token and current_vault are only allowed when - # creating a new payment profile. - # ### Taxable Subscriptions - # If your subscriber pays taxes on their purchased product, and you are - # attempting to create or update the `payment_profile`, complete address - # information is required. For information on required address formatting to - # allow your subscriber to be taxed, please see our documentation - # [here](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e-s - # ignups#taxes) - # ## BraintreeBlue - # Some merchants use Braintree JavaScript libraries directly and then pass - # `payment_method_nonce` and/or `paypal_email` to create a payment profile. - # This implementation is deprecated and does not handle 3D Secure. Instead, - # we have provided - # [Chargify.js](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0 - # NjAzNDI0-overview) which is continuously improved and supports Credit - # Cards (along with 3D Secure), PayPal and ApplePay payment types. - # ## GoCardless - # For more information on GoCardless, please view the following resources: - # + [Full documentation on - # GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC - # ardless) - # + [Using Chargify.js with GoCardless - minimal + # + + # [Taxes](https://developers.chargify.com/docs/developer-docs/d2e9e34db740e- + # signups#taxes) + # + + # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char + # gify-js-Overview) + # + [Chargify.js with GoCardless - minimal # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# # h_01K0PJ15QQZKCER8CFK40MR6XJ) - # + [Using Chargify.js with GoCardless - full + # + [Chargify.js with GoCardless - full # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# # h_01K0PJ15QR09JVHWW0MCA7HVJV) - # ### GoCardless with Local Bank Details - # Following examples create customer, bank account and mandate in - # GoCardless: - # ```json - # { - # "payment_profile": { - # "customer_id": "Valid-Customer-ID", - # "bank_name": "Royal Bank of France", - # "bank_account_number": "0000000", - # "bank_routing_number": "0003", - # "bank_branch_code": "00006", - # "payment_type": "bank_account", - # "billing_address": "20 Place de la Gare", - # "billing_city": "Colombes", - # "billing_state": "Île-de-France", - # "billing_zip": "92700", - # "billing_country": "FR" - # } - # } - # ``` - # ### GoCardless with IBAN - # ```json - # { - # "payment_profile": { - # "customer_id": "24907598", - # "bank_name": "French Bank", - # "bank_iban": "FR1420041010050500013M02606", - # "payment_type": "bank_account", - # "billing_address": "20 Place de la Gare", - # "billing_city": "Colombes", - # "billing_state": "Île-de-France", - # "billing_zip": "92700", - # "billing_country": "FR" - # } - # } - # ``` - # ### Importing GoCardless - # If the customer, bank account, and mandate already exist in GoCardless, a - # payment profile can be created by using the IDs. In order to create masked - # versions of `bank_account_number` and `bank_routing_number` that are used - # to display within Advanced Billing Admin UI, you can pass the last four - # digits for this fields which then will be saved in this form - # `XXXX[four-provided-digits]`. - # ```json - # { - # "payment_profile": { - # "customer_id": "24907598", - # "customer_vault_token": [Existing GoCardless Customer ID] - # "vault_token": [Existing GoCardless Mandate ID], - # "current_vault": "gocardless", - # "bank_name": "French Bank", - # "bank_account_number": [Last Four Of The Existing Account Number or - # IBAN if applicable], - # "bank_routing_number": [Last Four Of The Existing Routing Number], - # "payment_type": "bank_account", - # "billing_address": "20 Place de la Gare", - # "billing_city": "Colombes", - # "billing_state": "Île-de-France", - # "billing_zip": "92700", - # "billing_country": "FR" - # } - # } - # ``` - # ## SEPA Direct Debit - # For more information on Stripe SEPA Direct Debit, please view the - # following resources: - # + [Full documentation on Stripe SEPA Direct - # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S - # EPA-and-BECS-Direct-Debit) - # + [Using Chargify.js with Stripe Direct Debit - minimal + # + [Chargify.js with Stripe Direct Debit - minimal # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - # + [Using Chargify.js with Stripe Direct Debit - full + # + [Chargify.js with Stripe Direct Debit - full # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# # h_01K0PJ15QRECQQ4ECS3ZA55GY7) - # ### Stripe SEPA Direct Debit Payment Profiles - # The following example creates a customer, bank account and mandate in - # Stripe: - # ```json - # { - # "payment_profile": { - # "customer_id": "24907598", - # "bank_name": "Deutsche bank", - # "bank_iban": "DE89370400440532013000", - # "payment_type": "bank_account", - # "billing_address": "Test", - # "billing_city": "Berlin", - # "billing_state": "Brandenburg", - # "billing_zip": "12345", - # "billing_country": "DE" - # } - # } - # ``` - # ## Stripe BECS Direct Debit - # For more information on Stripe BECS Direct Debit, please view the - # following resources: - # + [Full documentation on Stripe BECS Direct - # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S - # EPA-and-BECS-Direct-Debit) - # + [Using Chargify.js with Stripe BECS Direct Debit - minimal + # + [Chargify.js with Stripe BECS Direct Debit - minimal # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN # DIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway # ) - # + [Using Chargify.js with Stripe BECS Direct Debit - full + # + [Chargify.js with Stripe BECS Direct Debit - full # example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzN # DIy-examples#full-example-with-sepa-direct-debit-stripe-gateway) - # ### Stripe BECS Direct Debit Payment Profiles - # The following example creates a customer, bank account and mandate in - # Stripe: - # ```json - # { - # "payment_profile": { - # "customer_id": "24907598", - # "bank_name": "Australian bank", - # "bank_branch_code": "000000", - # "bank_account_number": "000123456" - # "payment_type": "bank_account", - # "billing_address": "Test", - # "billing_city": "Stony Rise", - # "billing_state": "Tasmania", - # "billing_zip": "12345", - # "billing_country": "AU" - # } - # } - # ``` - # ## Stripe BACS Direct Debit - # Contact the support team to enable this payment method. - # For more information on Stripe BACS Direct Debit, please view the - # following resources: + # + [Full documentation on + # GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC + # ardless) + # + [Full documentation on Stripe SEPA Direct + # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S + # EPA-and-BECS-Direct-Debit) + # + [Full documentation on Stripe BECS Direct + # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S + # EPA-and-BECS-Direct-Debit) # + [Full documentation on Stripe BACS Direct # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S # EPA-and-BECS-Direct-Debit) - # ### Stripe BACS Direct Debit Payment Profiles - # The following example creates a customer, bank account and mandate in - # Stripe: - # ```json - # { - # "payment_profile": { - # "customer_id": "24907598", - # "bank_name": "British bank", - # "bank_branch_code": "108800", - # "bank_account_number": "00012345" - # "payment_type": "bank_account", - # "billing_address": "Test", - # "billing_city": "London", - # "billing_state": "LND", - # "billing_zip": "12345", - # "billing_country": "GB" - # } - # } - # ``` - # ## 3D Secure - Checkout - # It may happen that a payment needs 3D Secure Authentication when the - # payment profile is created; this is referred to in our help docs as a - # [post-authentication + # ## 3D Secure Authentication during payment profile creation. + # When a payment requires 3D Secure Authentication to adhear to Strong + # Customer Authentication (SCA) during payment profile creation, the request + # enters a [post-authentication # flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I # mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio - # n). The server returns `422 Unprocessable Entity` in this case with the + # n). In this case, a 422 Unprocessable Entity status is returned with the # following response: # ```json # { @@ -284,41 +111,41 @@ class PaymentProfilesController < BaseController # ``` # To let the customer go through 3D Secure Authentication, they need to be # redirected to the URL specified in `action_link`. - # Optionally, you can specify `callback_url` parameter in the `action_link` - # URL if you’d like to be notified about the result of 3D Secure - # Authentication. The `callback_url` will return the following information: + # Optionally, you can specify the `callback_url` parameter in the + # `action_link` URL to receive notification about the result of 3D Secure + # Authentication. + # The `callback_url` will return the following information: # - whether the authentication was successful (`success`) # - the payment profile ID (`payment_profile_id`) - # Lastly, you can also specify a `redirect_url` parameter within the - # `action_link` URL if you’d like to redirect a customer back to your site. - # It is not possible to use `action_link` in an iframe inside a custom - # application. You have to redirect the customer directly to the - # `action_link`, then, to be notified about the result, use `redirect_url` - # or `callback_url`. + # You can also specify a `redirect_url` parameter in the `action_link` URL + # to redirect the customer back to your site. + # You cannot use action_link in an iframe inside a custom application. You + # must redirect the customer directly to the `action_link` and use the + # `redirect_url` or `callback_url` to be notified of the result. # The final URL that you send a customer to complete 3D Secure may resemble # the following, where the first half is the `action_link` and the second # half contains a `redirect_url` and `callback_url`: + # # `https://checkout-test.chargifypay.test/3d-secure/checkout/pay_uerzhsxd5uh # kbodx5jhvkg6yeu?one_time_token_id=93&callback_url=http://localhost:4000&re # direct_url=https://yourpage.com` # ### Example Redirect Flow - # You may wish to redirect customers to different pages depending on whether - # their SCA was performed successfully. Here's an example flow to use as a - # reference: - # 1. Create a payment profile via API; it requires 3DS - # 2. You receive a `action_link` in the response. + # Here's an example flow to redirect customers to different pages depending + # on whether SCA was performed successfully: + # 1. Create a payment profile via the API; it requires 3DS. + # 2. You receive an `action_link` in the response. # 3. Use this `action_link` to, for example, connect with your internal - # resources or generate a session_id - # 4. Include 1 of those attributes inside the `callback_url` and - # `redirect_url` to be aware which “session” this applies to + # resources or generate a `session_id`. + # 4. Include one of those attributes inside the `callback_url` and + # `redirect_url` to be aware which “session” this applies to. # 5. Redirect the customer to the `action_link` with `callback_url` and # `redirect_url` applied - # 6. After the customer finishes 3DS authentication, we let you know the - # result by making a request to applied `callback_url`. + # 6. After the customer completes 3DS authentication, we notify you of the + # result via the applied `callback_url`. # 7. After that, we redirect the customer to the `redirect_url`; at this - # point the result of authentication is known + # point the result of authentication is known. # 8. Optionally, you can use the applied "msg" param in the `redirect_url` - # to determine whether it was successful or not + # to determine if the redirect was successful. # @param [CreatePaymentProfileRequest] body Optional parameter: When # following the IBAN or the Local Bank details examples, a customer, bank # account and mandate will be created in your current vault. If the @@ -384,8 +211,8 @@ def list_payment_profiles(options = {}) # Using the GET method you can retrieve a Payment Profile identified by its # unique ID. - # Please note that a different JSON object will be returned if the card - # method on file is a bank account. + # Note that a different JSON object will be returned if the card method on + # file is a bank account. # ### Response for Bank Account # Example response for Bank Account: # ``` diff --git a/lib/advanced_billing/controllers/product_families_controller.rb b/lib/advanced_billing/controllers/product_families_controller.rb index 3a96f194..34f689b0 100644 --- a/lib/advanced_billing/controllers/product_families_controller.rb +++ b/lib/advanced_billing/controllers/product_families_controller.rb @@ -6,8 +6,7 @@ module AdvancedBilling # ProductFamiliesController class ProductFamiliesController < BaseController - # This method allows to retrieve a list of Products belonging to a Product - # Family. + # Retrieves a list of Products belonging to a Product Family. # @param [String] product_family_id Required parameter: Either the product # family's id or its handle prefixed with `handle:` # @param [Integer] page Optional parameter: Result records are organized in @@ -82,9 +81,9 @@ def list_products_for_product_family(options = {}) .execute end - # This method will create a Product Family within your Advanced Billing - # site. Create a Product Family to act as a container for your products, - # components and coupons. + # Creates a Product Family within your Advanced Billing site. Create a + # Product Family to act as a container for your products, components and + # coupons. # Full documentation on how Product Families operate within the Advanced # Billing UI can be located # [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product- @@ -112,7 +111,7 @@ def create_product_family(body: nil) .execute end - # This method allows to retrieve a list of Product Families for a site. + # Retrieve a list of Product Families for a site. # @param [BasicDateField] date_field Optional parameter: The type of filter # you would like to apply to your search. Use in query: # `date_field=created_at`. @@ -155,8 +154,8 @@ def list_product_families(options = {}) .execute end - # This method allows to retrieve a Product Family via the - # `product_family_id`. The response will contain a Product Family object. + # Retrieves a Product Family via the `product_family_id`. The response will + # contain a Product Family object. # The product family can be specified either with the id number, or with the # `handle:my-family` format. # @param [Integer] id Required parameter: The Advanced Billing id of the diff --git a/lib/advanced_billing/controllers/product_price_points_controller.rb b/lib/advanced_billing/controllers/product_price_points_controller.rb index 8876264d..49cccda7 100644 --- a/lib/advanced_billing/controllers/product_price_points_controller.rb +++ b/lib/advanced_billing/controllers/product_price_points_controller.rb @@ -6,9 +6,9 @@ module AdvancedBilling # ProductPricePointsController class ProductPricePointsController < BaseController - # [Product Price Point - # Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261111947789- - # Product-Price-Points) + # Creates a Product Price Point. See the [Product Price + # Point](https://maxio.zendesk.com/hc/en-us/articles/24261111947789-Product- + # Price-Points) documentation for details. # @param [Integer | String] product_id Required parameter: The id or handle # of the product. When using the handle, it must be prefixed with # `handle:` @@ -43,7 +43,7 @@ def create_product_price_point(product_id, .execute end - # Use this endpoint to retrieve a list of product price points. + # Retrieves a list of product price points. # @param [Integer | String] product_id Required parameter: The id or handle # of the product. When using the handle, it must be prefixed with # `handle:` @@ -96,8 +96,8 @@ def list_product_price_points(options = {}) .execute end - # Use this endpoint to update a product price point. - # Note: Custom product price points are not able to be updated. + # Updates a product price point. + # Note: Custom product price points cannot be updated. # @param [Integer | String] product_id Required parameter: The id or handle # of the product. When using the handle, it must be prefixed with `handle:`. # Example: `123` for an integer ID, or `handle:example-product-handle` for a @@ -189,7 +189,7 @@ def read_product_price_point(product_id, .execute end - # Use this endpoint to archive a product price point. + # Archives a product price point. # @param [Integer | String] product_id Required parameter: The id or handle # of the product. When using the handle, it must be prefixed with `handle:`. # Example: `123` for an integer ID, or `handle:example-product-handle` for a @@ -257,10 +257,9 @@ def unarchive_product_price_point(product_id, .execute end - # Use this endpoint to make a product price point the default for the + # Sets a product price point as the default for the product. + # Note: Custom product price points cannot be set as the default for a # product. - # Note: Custom product price points are not able to be set as the default - # for a product. # @param [Integer] product_id Required parameter: The Advanced Billing id of # the product to which the price point belongs # @param [Integer] price_point_id Required parameter: The Advanced Billing @@ -286,7 +285,7 @@ def promote_product_price_point_to_default(product_id, .execute end - # Use this endpoint to create multiple product price points in one request. + # Creates multiple product price points in one request. # @param [Integer] product_id Required parameter: The Advanced Billing id of # the product to which the price points belong # @param [BulkCreateProductPricePointsRequest] body Optional parameter: @@ -316,8 +315,8 @@ def bulk_create_product_price_points(product_id, .execute end - # This endpoint allows you to create currency prices for a given currency - # that has been defined on the site level in your settings. + # Creates currency prices for a given currency that has been defined on the + # site level in your settings. # When creating currency prices, they need to mirror the structure of your # primary pricing. If the product price point defines a trial and/or setup # fee, each currency must also define a trial and/or setup fee. @@ -352,13 +351,12 @@ def create_product_currency_prices(product_price_point_id, .execute end - # This endpoint allows you to update the `price`s of currency prices for a - # given currency that exists on the product price point. + # Updates the `price`s of currency prices for a given currency that exists + # on the product price point. # When updating the pricing, it needs to mirror the structure of your # primary pricing. If the product price point defines a trial and/or setup # fee, each currency must also define a trial and/or setup fee. - # Note: Currency Prices are not able to be updated for custom product price - # points. + # Note: Currency Prices cannot be updated for custom product price points. # @param [Integer] product_price_point_id Required parameter: The Advanced # Billing id of the product price point # @param [UpdateCurrencyPricesRequest] body Optional parameter: TODO: type diff --git a/lib/advanced_billing/controllers/products_controller.rb b/lib/advanced_billing/controllers/products_controller.rb index 571acb44..22e540b1 100644 --- a/lib/advanced_billing/controllers/products_controller.rb +++ b/lib/advanced_billing/controllers/products_controller.rb @@ -6,7 +6,8 @@ module AdvancedBilling # ProductsController class ProductsController < BaseController - # Use this method to create a product within your Advanced Billing site. + # Creates a product in your Advanced Billing site. + # See the following product docuemation for more information: # + [Products # Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645- # Products-Overview) @@ -42,8 +43,7 @@ def create_product(product_family_id, .execute end - # This endpoint allows you to read the current details of a product that - # you've created in Advanced Billing. + # Reads the current details of a product. # @param [Integer] product_id Required parameter: The Advanced Billing id of # the product # @return [ProductResponse] Response from the API call. @@ -63,7 +63,7 @@ def read_product(product_id) .execute end - # Use this method to change aspects of an existing product. + # Updates aspects of an existing product. # ### Input Attributes Update Notes # + `update_return_params` The parameters we will append to your # `update_return_url`. See Return URLs and Parameters @@ -100,9 +100,8 @@ def update_product(product_id, .execute end - # Sending a DELETE request to this endpoint will archive the product. All - # current subscribers will be unffected; their subscription/purchase will - # continue to be charged monthly. + # Archives the product. All current subscribers will be unffected; their + # subscription/purchase will continue to be charged monthly. # This will restrict the option to chose the product for purchase via the # Billing Portal, as well as disable Public Signup Pages for the product. # @param [Integer] product_id Required parameter: The Advanced Billing id of @@ -128,7 +127,7 @@ def archive_product(product_id) .execute end - # This method allows to retrieve a Product object by its `api_handle`. + # Retrieves a Product object by its `api_handle`. # @param [String] api_handle Required parameter: The handle of the product # @return [ProductResponse] Response from the API call. def read_product_by_handle(api_handle) diff --git a/lib/advanced_billing/controllers/proforma_invoices_controller.rb b/lib/advanced_billing/controllers/proforma_invoices_controller.rb index 94a5fe03..79a82e98 100644 --- a/lib/advanced_billing/controllers/proforma_invoices_controller.rb +++ b/lib/advanced_billing/controllers/proforma_invoices_controller.rb @@ -113,7 +113,7 @@ def read_proforma_invoice(proforma_invoice_uid) # If the information becomes outdated, simply void the old proforma invoice # and generate a new one. # If you would like to preview the next billing amounts without generating a - # full proforma invoice, please use the renewal preview endpoint. + # full proforma invoice, use the renewal preview endpoint. # ## Restrictions # Proforma invoices are only available on Relationship Invoicing sites. To # create a proforma invoice, the subscription must not be in a group, must diff --git a/lib/advanced_billing/controllers/sales_commissions_controller.rb b/lib/advanced_billing/controllers/sales_commissions_controller.rb index a21d7417..f2d2326b 100644 --- a/lib/advanced_billing/controllers/sales_commissions_controller.rb +++ b/lib/advanced_billing/controllers/sales_commissions_controller.rb @@ -20,7 +20,7 @@ class SalesCommissionsController < BaseController # Access to the Sales Commission API endpoints is available to users with # financial access, where the seller has the Advanced Analytics component # enabled. For further information on getting access to Advanced Analytics - # please contact Maxio support. + # contact Maxio support. # > Note: The request is at seller level, it means `<>` variable # will be replaced by `app` # @param [String] seller_id Required parameter: The Chargify id of your @@ -77,7 +77,7 @@ def list_sales_commission_settings(options = {}) # Access to the Sales Commission API endpoints is available to users with # financial access, where the seller has the Advanced Analytics component # enabled. For further information on getting access to Advanced Analytics - # please contact Maxio support. + # contact Maxio support. # > Note: The request is at seller level, it means `<>` variable # will be replaced by `app` # @param [String] seller_id Required parameter: The Chargify id of your @@ -134,7 +134,7 @@ def list_sales_reps(options = {}) # Access to the Sales Commission API endpoints is available to users with # financial access, where the seller has the Advanced Analytics component # enabled. For further information on getting access to Advanced Analytics - # please contact Maxio support. + # contact Maxio support. # > Note: The request is at seller level, it means `<>` variable # will be replaced by `app` # @param [String] seller_id Required parameter: The Chargify id of your diff --git a/lib/advanced_billing/controllers/subscription_components_controller.rb b/lib/advanced_billing/controllers/subscription_components_controller.rb index f12612f7..82905a8e 100644 --- a/lib/advanced_billing/controllers/subscription_components_controller.rb +++ b/lib/advanced_billing/controllers/subscription_components_controller.rb @@ -528,48 +528,46 @@ def delete_prepaid_usage_allocation(subscription_id, .execute end - # ## Documentation + # Records an instance of metered or prepaid usage for a subscription. + # You can report metered or prepaid usage to Advanced Billing as often as + # you wish. You can report usage as it happens or periodically, such as each + # night or once per billing period. # Full documentation on how to create Components in the Advanced Billing UI # can be located # [here](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Create-E # dit-and-Archive-Components). Additionally, for information on how to - # record component usage against a subscription, please see the following + # record component usage against a subscription, see the following # resources: - # + [Recording Metered Component + # It is not possible to record metered usage for more than one component at + # a time Usage should be reported as one API call per component on a single + # subscription. For example, to record that a subscriber has sent both an + # SMS Message and an Email, send an API call for each. + # See the following product documention articles for more information: + # - [Create and Manage + # Components](https://maxio.zendesk.com/hc/en-us/articles/24261149711501-Cre + # ate-Edit-and-Archive-Components). A + # - [Recording Metered Component # Usage](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reportin # g-Component-Allocations#reporting-metered-component-usage) - # + [Reporting Prepaid Component + # - [Reporting Prepaid Component # Status](https://maxio.zendesk.com/hc/en-us/articles/24251890500109-Reporti # ng-Component-Allocations#reporting-prepaid-component-status) - # You may choose to report metered or prepaid usage to Advanced Billing as - # often as you wish. You may report usage as it happens. You may also report - # usage periodically, such as each night or once per billing period. If - # usage events occur in your system very frequently (on the order of - # thousands of times an hour), it is best to accumulate usage into batches - # on your side, and then report those batches less frequently, such as - # daily. This will ensure you remain below any API throttling limits. If - # your use case requires higher rates of usage reporting, we recommend - # utilizing Events Based Components. - # ## Create Usage for Subscription - # This endpoint allows you to record an instance of metered or prepaid usage - # for a subscription. The `quantity` from usage for each component is - # accumulated to the `unit_balance` on the [Component Line - # Item](./b3A6MTQxMDgzNzQ-read-subscription-component) for the subscription. + # The `quantity` from usage for each component is accumulated to the + # `unit_balance` on the [Component Line + # Item]($e/Subscription%20Components/readSubscriptionComponent) for the + # subscription. # ## Price Point ID usage - # If you are using price points, for metered and prepaid usage components, + # If you are using price points, for metered and prepaid usage components # Advanced Billing gives you the option to specify a price point in your # request. # You do not need to specify a price point ID. If a price point is not # included, the default price point for the component will be used when the # usage is recorded. - # If an invalid `price_point_id` is submitted, the endpoint will return an - # error. # ## Deducting Usage - # In the event that you need to reverse a previous usage report or otherwise - # deduct from the current usage balance, you may provide a negative - # quantity. + # If you need to reverse a previous usage report or otherwise deduct from + # the current usage balance, you can provide a negative quantity. # Example: - # Previously recorded: + # Previously recorded quantity was 5000: # ```json # { # "usage": { @@ -578,8 +576,7 @@ def delete_prepaid_usage_allocation(subscription_id, # } # } # ``` - # At this point, `unit_balance` would be `5000`. To reduce the balance to - # `0`, POST the following payload: + # To reduce the quantity to `0`, POST the following payload: # ```json # { # "usage": { @@ -591,12 +588,6 @@ def delete_prepaid_usage_allocation(subscription_id, # The `unit_balance` has a floor of `0`; negative unit balances are never # allowed. For example, if the usage balance is 100 and you deduct 200 # units, the unit balance would then be `0`, not `-100`. - # ## FAQ - # Q. Is it possible to record metered usage for more than one component at a - # time? - # A. No. Usage should be reported as one API call per component on a single - # subscription. For example, to record that a subscriber has sent both an - # SMS Message and an Email, send an API call for each. # @param [Integer | String] subscription_id_or_reference Required parameter: # Either the Advanced Billing subscription ID (integer) or the subscription # reference (string). Important: In cases where a numeric string value diff --git a/lib/advanced_billing/controllers/subscription_group_status_controller.rb b/lib/advanced_billing/controllers/subscription_group_status_controller.rb index c7f0dac1..34316d59 100644 --- a/lib/advanced_billing/controllers/subscription_group_status_controller.rb +++ b/lib/advanced_billing/controllers/subscription_group_status_controller.rb @@ -6,14 +6,14 @@ module AdvancedBilling # SubscriptionGroupStatusController class SubscriptionGroupStatusController < BaseController - # This endpoint will immediately cancel all subscriptions within the - # specified group. The group is identified by it's `uid` passed in the URL. - # To successfully cancel the group, the primary subscription must be on - # automatic billing. The group members as well must be on automatic billing - # or they must be prepaid. - # In order to cancel a subscription group while also charging for any - # unbilled usage on metered or prepaid components, the - # `charge_unbilled_usage=true` parameter must be included in the request. + # Cancels all subscriptions within the specified group immediately. The + # group is identified by the `uid` that is passed in the URL. To + # successfully cancel the group, the primary subscription must be on + # automatic billing. The group members must be on automatic billing or + # prepaid. + # To cancel a subscription group while also charging for any unbilled usage + # on metered or prepaid components, the `charge_unbilled_usage=true` + # parameter must be included in the request. # @param [String] uid Required parameter: The uid of the subscription # group # @param [CancelGroupedSubscriptionsRequest] body Optional parameter: TODO: @@ -43,7 +43,7 @@ def cancel_subscriptions_in_group(uid, # This endpoint will schedule all subscriptions within the specified group # to be canceled at the end of their billing period. The group is identified - # by it's uid passed in the URL. + # by its uid passed in the URL. # All subscriptions in the group must be on automatic billing in order to # successfully cancel them, and the group must not be in a "past_due" state. # @param [String] uid Required parameter: The uid of the subscription diff --git a/lib/advanced_billing/controllers/subscription_groups_controller.rb b/lib/advanced_billing/controllers/subscription_groups_controller.rb index 562d1c57..0533c3d2 100644 --- a/lib/advanced_billing/controllers/subscription_groups_controller.rb +++ b/lib/advanced_billing/controllers/subscription_groups_controller.rb @@ -17,6 +17,11 @@ class SubscriptionGroupsController < BaseController # Only one of the `subscriptions` can have `"primary": true` attribute set. # When passing product to a subscription you can use either `product_id` or # `product_handle` or `offer_id`. You can also use `custom_price` instead. + # The subscription request examples below will be split into two sections. + # The first section, "Subscription Customization", will focus on passing + # different information with a subscription, such as components, calendar + # billing, and custom fields. These examples will presume you are using a + # secure chargify_token generated by Chargify.js. # @param [SubscriptionGroupSignupRequest] body Optional parameter: TODO: # type description here # @return [SubscriptionGroupSignupResponse] Response from the API call. @@ -229,9 +234,9 @@ def find_subscription_group(subscription_id) # subscription group, a new group will be created and the subscription will # become part of the group with the specified target customer set as the # responsible payer for the group's subscriptions. - # **Please Note:** In order to add an existing subscription to a - # subscription group, it must belong to either the same customer record as - # the target, or be within the same customer hierarchy. + # **Note:** In order to add an existing subscription to a subscription + # group, it must belong to either the same customer record as the target, or + # be within the same customer hierarchy. # Rather than specifying a customer, the `target` parameter could instead # simply have a value of # * `"self"` which indicates the subscription will be paid for not by some @@ -240,8 +245,8 @@ def find_subscription_group(subscription_id) # subscribing customer's parent within a customer hierarchy, or # * `"eldest"` which indicates the subscription will be paid for by the # root-level customer in the subscribing customer's hierarchy. - # To create a new subscription into a subscription group, please reference - # the following: + # To create a new subscription into a subscription group, reference the + # following: # [Create Subscription in a Subscription # Group](https://developers.chargify.com/docs/api-docs/d571659cf0f24-create- # subscription#subscription-in-a-subscription-group) diff --git a/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb b/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb index 1a8dba1f..aff8c4c3 100644 --- a/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb +++ b/lib/advanced_billing/controllers/subscription_invoice_account_controller.rb @@ -35,7 +35,7 @@ def read_account_balances(subscription_id) # amount will be collected using the default credit card payment profile and # applied to the prepayment account balance. This is especially useful for # manual replenishment of prepaid subscriptions. - # Please note that you **can't** pass `amount_in_cents`. + # Note that passing `amount_in_cents` is now allowed. # @param [Integer] subscription_id Required parameter: The Chargify id of # the subscription # @param [CreatePrepaymentRequest] body Optional parameter: TODO: type diff --git a/lib/advanced_billing/controllers/subscription_products_controller.rb b/lib/advanced_billing/controllers/subscription_products_controller.rb index 92edb687..934e540e 100644 --- a/lib/advanced_billing/controllers/subscription_products_controller.rb +++ b/lib/advanced_billing/controllers/subscription_products_controller.rb @@ -26,13 +26,12 @@ class SubscriptionProductsController < BaseController # [here](https://maxio.zendesk.com/hc/en-us/articles/24181589372429-Data-Mig # ration-to-Advanced-Billing). # ## Failed Migrations - # One of the most common ways that a migration can fail is when the attempt - # is made to migrate a subscription to it's current product. Please be aware - # of this issue! + # Importaint note: One of the most common ways that a migration can fail is + # when the attempt is made to migrate a subscription to its current product. # ## Migration 3D Secure - Stripe - # It may happen that a payment needs 3D Secure Authentication when the - # subscription is migrated to a new product; this is referred to in our help - # docs as a [post-authentication + # When a payment requires 3D Secure Authentication to adhear to Strong + # Customer Authentication (SCA) when the subscription is migrated to a new + # product, the request enters a [post-authentication # flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I # mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio # n). The server returns `422 Unprocessable Entity` in this case with the @@ -82,7 +81,7 @@ class SubscriptionProductsController < BaseController # urpage.com` # ### Example Redirect Flow # You may wish to redirect customers to different pages depending on whether - # their SCA was performed successfully. Here's an example flow to use as a + # SCA was performed successfully. Here's an example flow to use as a # reference: # 1. Create a migration via API; it requires 3DS # 2. You receive a `gateway_payment_id` in the `action_link` along other diff --git a/lib/advanced_billing/controllers/subscription_status_controller.rb b/lib/advanced_billing/controllers/subscription_status_controller.rb index e27e22f0..d14948c2 100644 --- a/lib/advanced_billing/controllers/subscription_status_controller.rb +++ b/lib/advanced_billing/controllers/subscription_status_controller.rb @@ -104,7 +104,7 @@ def resume_subscription(subscription_id, # This will place the subscription in the on_hold state and it will not # renew. # ## Limitations - # You may not place a subscription on hold if the `next_billing` date is + # 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 @@ -176,10 +176,9 @@ def update_automatic_subscription_resumption(subscription_id, # reactivate subscriptions through the application, see # [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629- # Reactivating-and-Resuming). - # **Please note: The term - # "resume" is used also during another process in Advanced Billing. This - # occurs when an on-hold subscription is "resumed". This returns the - # subscription to an active state.** + # **Note: The term "resume" is used also during another process in Advanced + # Billing. This occurs when an on-hold subscription is "resumed". This + # returns the subscription to an active state.** # + The response returns the subscription object in the `active` or # `trialing` state. # + The `canceled_at` and `cancellation_message` fields do not have values. @@ -434,8 +433,8 @@ def cancel_dunning(subscription_id) # subscription’s next assessment. You can retrieve it to see a snapshot of # how much your customer will be charged on their next renewal. # The "Next Billing" amount and "Next Billing" date are already represented - # in the UI on each Subscriber's Summary. For more information, please see - # our documentation + # in the UI on each Subscriber's Summary. For more information, see our + # documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscrib # er-Interface-Overview). # ## Optional Component Fields diff --git a/lib/advanced_billing/controllers/subscriptions_controller.rb b/lib/advanced_billing/controllers/subscriptions_controller.rb index 36985584..f01c40fd 100644 --- a/lib/advanced_billing/controllers/subscriptions_controller.rb +++ b/lib/advanced_billing/controllers/subscriptions_controller.rb @@ -6,769 +6,37 @@ module AdvancedBilling # SubscriptionsController class SubscriptionsController < BaseController - # Full documentation on how subscriptions operate within Advanced Billing - # can be located under the following topics: - # + [Subscriptions - # Reference](https://maxio.zendesk.com/hc/en-us/articles/24251526991757-Subs - # cription-Overview) - # + [Subscriptions - # Actions](https://maxio.zendesk.com/hc/en-us/articles/24251983024653-Subscr - # iption-Actions-Overview) - # + [Subscription - # Cancellation](https://maxio.zendesk.com/hc/en-us/articles/24251957778829-C - # ancel-Subscriptions) - # + [Subscription - # Reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-R - # eactivating-and-Resuming) - # + [Subscription - # Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports - # ) - # When creating a subscription, you must specify a product and a customer. - # Credit card details may be required, depending on the options for the - # Product being subscribed ([see Product - # Options](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Produc - # t-Editing)). - # The product may be specified by `product_id` or by `product_handle` (API - # Handle). In similar fashion, to pass a particular product price point, you - # may either use `product_price_point_handle` or `product_price_point_id`. - # An existing customer may be specified by a `customer_id` (ID within - # Advanced Billing) or a `customer_reference` (unique value within your app - # that you have shared with Advanced Billing via the reference attribute on - # a customer). You may also pass in an existing payment profile for that - # customer with `payment_profile_id`. A new customer may be created by - # providing `customer_attributes`. - # Credit card details may be required, depending on the options for the - # product being subscribed. The product can be specified by `product_id` or - # by `product_handle` (API Handle). - # If you are creating a subscription with a payment profile, the attribute - # to send will be `credit_card_attributes` or `bank_account_attributes` for - # ACH and Direct Debit. That said, when you read the subscription after - # creation, we return the profile details under `credit_card` or - # `bank_account`. - # ## Bulk creation of subscriptions - # Bulk creation of subscriptions is currently not supported. For scenarios - # where multiple subscriptions must be added, particularly when assigning to - # the same subscription group, it is essential to switch to a - # single-threaded approach. - # To avoid data conflicts or inaccuracies, incorporate a sleep interval - # between requests. - # While this single-threaded approach may impact performance, it ensures - # data consistency and accuracy in cases where concurrent creation attempts - # could otherwise lead to issues with subscription alignment and integrity. - # ## Taxable Subscriptions - # If your intent is to charge your subscribers tax via [Avalara - # Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara- - # VAT-Tax) or [Custom - # Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-T - # axes), there are a few considerations to be made regarding collecting - # subscription data. - # For subscribers to be eligible to be taxed, the following information for - # the `customer` object or `payment_profile` object must by supplied: - # + A subscription to a [taxable - # product](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Produc - # t-Editing#tax-settings) - # + [Full valid billing or shipping - # address](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Advanc - # ed-Billing-Managed-Sales-Tax#full-address-required-for-taxable-subscriptio - # ns) to identify the tax locale - # + The portion of the address that houses the [state - # information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Ad - # vanced-Billing-Managed-Sales-Tax#required-state-format-for-taxable-subscri - # ptions) of either adddress must adhere to the ISO standard of a 2-3 - # character limit/format. - # + The portion of the address that houses the [country - # information](https://maxio.zendesk.com/hc/en-us/articles/24287008131853-Ad - # vanced-Billing-Managed-Sales-Tax#required-country-format-for-taxable-subsc - # riptions) must adhere to the ISO standard of a 2 character limit/format. - # ## Subscription Request Examples - # The subscription examples below will be split into two sections. - # The first section, "Subscription Customization", will focus on passing - # different information with a subscription, such as components, calendar - # billing, and custom fields. These examples will presume you are using a - # secure `chargify_token` generated by Chargify.js. - # The second section, "Passing Payment Information", will focus on passing - # payment information into Advanced Billing. Please be aware that - # collecting and sending Advanced Billing raw card details requires PCI - # compliance on your end; these examples are provided as guidance. If - # your business is not PCI compliant, we recommend using Chargify.js to - # collect credit cards or bank accounts. - # # Subscription Customization - # ## With Components - # Different components require slightly different data. For example, - # quantity-based and on/off components accept `allocated_quantity`, while - # metered components accept `unit_balance`. - # When creating a subscription with a component, a `price_point_id` can be - # passed in along with the `component_id` to specify which price point to - # use. If not passed in, the default price point will be used. - # Note: if an invalid `price_point_id` is used, the subscription will still - # proceed but will use the component's default price point. - # Components and their price points may be added by ID or by handle. See the - # example request body labeled "Components By Handle (Quantity-Based)"; the - # format will be the same for other component types. - # ## With Coupon(s) - # Pass an array of `coupon_codes`. See the example request body "With - # Coupon". - # ## With Manual Invoice Collection - # The `invoice` collection method works only on legacy Statement - # Architecture. - # On Relationship Invoicing Architecture use the `remittance` collection - # method. - # ## Prepaid Subscription - # A prepaid subscription can be created with the usual subscription creation - # parameters, specifying `prepaid` as the `payment_collection_method` and - # including a nested `prepaid_configuration`. - # After a prepaid subscription has been created, additional funds can be - # manually added to the prepayment account through the [Create Prepayment - # Endpoint](https://developers.chargify.com/docs/api-docs/7ec482de77ba7-crea - # te-prepayment). - # Prepaid subscriptions do not work on legacy Statement Architecture. - # ## With Metafields - # Metafields can either attach to subscriptions or customers. Metafields are - # popuplated with the supplied metadata to the resource specified. - # If the metafield doesn't exist yet, it will be created on-the-fly. - # ## With Custom Pricing - # Custom pricing is pricing specific to the subscription in question. - # Create a subscription with custom pricing by passing pricing information - # instead of a price point. - # For a custom priced product, pass the custom_price object in place of - # `product_price_point_id`. For a custom priced component, pass the - # `custom_price` object within the component object. - # Custom prices and price points can exist in harmony on a subscription. - # # Passing Payment Information - # ## Subscription with Chargify.js token - # The `chargify_token` can be obtained using - # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char - # gify-js-Overview#chargify-js-overview-0-0). The token represents payment - # profile attributes that were provided by the customer in their browser and - # stored at the payment gateway. - # The `payment_type` attribute may either be `credit_card` or - # `bank_account`, depending on the type of payment method being added. If a - # bank account is being passed, the payment attributes should be changed to - # `bank_account_attributes`. - # ```json - # { - # "subscription": { - # "product_handle": "pro-plan", - # "customer_attributes": { - # "first_name": "Joe", - # "last_name": "Smith", - # "email": "j.smith@example.com" - # }, - # "credit_card_attributes": { - # "chargify_token": "tok_cwhvpfcnbtgkd8nfkzf9dnjn", - # "payment_type": "credit_card" - # } - # } - # } - # ``` - # ## Subscription with vault token - # If you already have a customer and card stored in your payment gateway, - # you may create a subscription with a `vault_token`. Providing the - # last_four, card type and expiration date will allow the card to be - # displayed properly in the Advanced Billing UI. - # ```json - # { - # "subscription": { - # "product_handle": "pro-plan", - # "customer_attributes": { - # "first_name": "Joe", - # "last_name": "Smith", - # "email": "j.smith@example.com" - # }, - # "credit_card_attributes": { - # first_name: "Joe, - # last_name: "Smith", - # card_type: "visa", - # expiration_month: "05", - # expiration_year: "2025", - # last_four: "1234", - # vault_token: "12345abc", - # current_vault: "braintree_blue" - # } - # } - # ``` - # ## Subscription with ACH as Payment Profile - # ```json - # { - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Joe", - # "last_name": "Blow", - # "email": "joe@example.com", - # "zip": "02120", - # "state": "MA", - # "reference": "XYZ", - # "phone": "(617) 111 - 0000", - # "organization": "Acme", - # "country": "US", - # "city": "Boston", - # "address_2": null, - # "address": "123 Mass Ave." - # }, - # "bank_account_attributes": { - # "bank_name": "Best Bank", - # "bank_routing_number": "021000089", - # "bank_account_number": "111111111111", - # "bank_account_type": "checking", - # "bank_account_holder_type": "business", - # "payment_type": "bank_account" - # } - # } - # } - # ``` - # ## Subscription with PayPal payment profile - # ### With the nonce from Braintree JS - # ```json - # { "subscription": { - # "product_handle":"test-product-b", - # "customer_attributes": { - # "first_name":"Amelia", - # "last_name":"Johnson", - # "email":"amelia@example.com", - # "organization":"My Awesome Company" - # }, - # "payment_profile_attributes":{ - # "paypal_email": "amelia@example.com", - # "current_vault": "braintree_blue", - # "payment_method_nonce":"abc123", - # "payment_type":"paypal_account" - # } - # } - # ``` - # ### With the Braintree Customer ID as the vault token: - # ```json - # { "subscription": { - # "product_handle":"test-product-b", - # "customer_attributes": { - # "first_name":"Amelia", - # "last_name":"Johnson", - # "email":"amelia@example.com", - # "organization":"My Awesome Company" - # }, - # "payment_profile_attributes":{ - # "paypal_email": "amelia@example.com", - # "current_vault": "braintree_blue", - # "vault_token":"58271347", - # "payment_type":"paypal_account" - # } - # } - # ``` - # ## Subscription using GoCardless Bank Number - # These examples creates a customer, bank account and mandate in GoCardless. - # For more information on GoCardless, please view the following two - # resources: - # + [Payment Profiles via API for - # GoCardless](https://developers.chargify.com/docs/api-docs/1f10a4f170405-cr - # eate-payment-profile#gocardless) - # + [Full documentation on - # GoCardless](https://maxio.zendesk.com/hc/en-us/articles/24176159136909-GoC - # ardless) - # + [Using Chargify.js with GoCardless - minimal - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QQZKCER8CFK40MR6XJ) - # + [Using Chargify.js with GoCardless - full - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QR09JVHWW0MCA7HVJV) - # ```json - # { - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "bank_account_attributes": { - # "bank_name": "Royal Bank of France", - # "bank_account_number": "0000000", - # "bank_routing_number": "0003", - # "bank_branch_code": "00006", - # "payment_type": "bank_account", - # "billing_address": "20 Place de la Gare", - # "billing_city": "Colombes", - # "billing_state": "Île-de-France", - # "billing_zip": "92700", - # "billing_country": "FR" - # } - # } - # } - # ``` - # ## Subscription using GoCardless IBAN Number - # ```json - # { - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "bank_account_attributes": { - # "bank_name": "French Bank", - # "bank_iban": "FR1420041010050500013M02606", - # "payment_type": "bank_account", - # "billing_address": "20 Place de la Gare", - # "billing_city": "Colombes", - # "billing_state": "Île-de-France", - # "billing_zip": "92700", - # "billing_country": "FR" - # } - # } - # } - # ``` - # ## Subscription using Stripe SEPA Direct Debit - # For more information on Stripe Direct Debit, please view the following two - # resources: - # + [Payment Profiles via API for Stripe SEPA Direct - # Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create- - # payment-profile#sepa-direct-debit) - # + [Full documentation on Stripe Direct - # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S - # EPA-and-BECS-Direct-Debit) - # + [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - # + [Using Chargify.js with Stripe SEPA Direct Debit - full - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QR09JVHWW0MCA7HVJV) - # ```json - # { - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "bank_account_attributes": { - # "bank_name": "Test Bank", - # "bank_iban": "DE89370400440532013000", - # "payment_type": "bank_account" - # } - # } - # } - # ``` - # ## Subscription using Stripe BECS Direct Debit - # For more information on Stripe Direct Debit, please view the following two - # resources: - # + [Payment Profiles via API for Stripe BECS Direct - # Debit]($e/Payment%20Profiles/createPaymentProfile) - # + [Full documentation on Stripe Direct - # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S - # EPA-and-BECS-Direct-Debit) - # + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - # + [Using Chargify.js with Stripe BECS Direct Debit - full - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QRX4B1TYZKZD8ZND6D) - # ```json - # { - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "bank_account_attributes": { - # "bank_name": "Test Bank", - # "bank_branch_code": "000000", - # "bank_account_number": "000123456", - # "payment_type": "bank_account" - # } - # } - # } - # ``` - # ## Subscription using Stripe BACS Direct Debit - # For more information on Stripe Direct Debit, please view the following two - # resources: - # + [Payment Profiles via API for Stripe BACS Direct - # Debit]($e/Payment%20Profiles/createPaymentProfile) - # + [Full documentation on Stripe Direct - # Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-S - # EPA-and-BECS-Direct-Debit) - # + [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QQFKKN8Z7B7DZ9AJS5) - # + [Using Chargify.js with Stripe BACS Direct Debit - full - # example](https://docs.maxio.com/hc/en-us/articles/38206331271693-Examples# - # h_01K0PJ15QR7PA1DJ3XE9MD05FM) - # ```json - # { - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "bank_account_attributes": { - # "bank_name": "Test Bank", - # "bank_branch_code": "108800", - # "bank_account_number": "00012345", - # "payment_type": "bank_account", - # "billing_address": "123 Main St.", - # "billing_city": "London", - # "billing_state": "LND", - # "billing_zip": "W1A 1AA", - # "billing_country": "GB" - # } - # } - # } - # ``` - # ## 3D Secure - Stripe - # It may happen that a payment needs 3D Secure Authentication when the - # subscription is created; this is referred to in our help docs as a - # [post-authentication - # flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I - # mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio - # n). The server returns `422 Unprocessable Entity` in this case with the - # following response: - # ```json - # { - # "errors": [ - # "Your card was declined. This transaction requires 3D secure - # authentication." - # ], - # "gateway_payment_id": "pi_1F0aGoJ2UDb3Q4av7zU3sHPh", - # "description": "This card requires 3D secure authentication. Redirect - # the customer to the URL from the action_link attribute to authenticate. - # Attach callback_url param to this URL if you want to be notified about the - # result of 3D Secure authentication. Attach redirect_url param to this URL - # if you want to redirect a customer back to your page after 3D Secure - # authentication. Example: - # https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_time - # _token_id=128&callback_url=https://localhost:4000&redirect_url=https://you - # rpage.com will do a POST request to https://localhost:4000 after payment - # is authenticated and will redirect a customer to https://yourpage.com - # after 3DS authentication.", - # "action_link": - # "http://acme.chargify.com/3d-secure/pi_1F0aGoJ2UDb3Q4av7zU3sHPh?one_time_t - # oken_id=242" - # } - # ``` - # To let the customer go through 3D Secure Authentication, they need to be - # redirected to the URL specified in `action_link`. - # Optionally, you can specify `callback_url` parameter in the `action_link` - # URL if you’d like to be notified about the result of 3D Secure - # Authentication. The `callback_url` will return the following information: - # - whether the authentication was successful (`success`) - # - the gateway ID for the payment (`gateway_payment_id`) - # - the subscription ID (`subscription_id`) - # Lastly, you can also specify a `redirect_url` within the `action_link` URL - # if you’d like to redirect a customer back to your site. - # It is not possible to use `action_link` in an iframe inside a custom - # application. You have to redirect the customer directly to the - # `action_link`, then, to be notified about the result, use `redirect_url` - # or `callback_url`. - # The final URL that you send a customer to to complete 3D Secure may - # resemble the following, where the first half is the `action_link` and the - # second half contains a `redirect_url` and `callback_url`: - # `https://mysite.chargify.com/3d-secure/pi_1FCm4RKDeye4C0XfbqquXRYm?one_tim - # e_token_id=128&callback_url=https://localhost:4000&redirect_url=https://yo - # urpage.com` - # ## 3D Secure - Checkout - # It may happen that a payment needs 3D Secure Authentication when the - # subscription is created; this is referred to in our help docs as a - # [post-authentication - # flow](https://maxio.zendesk.com/hc/en-us/articles/24176278996493-Testing-I - # mplementing-3D-Secure#psd2-flows-pre-authentication-and-post-authenticatio - # n). The server returns `422 Unprocessable Entity` in this case with the - # following response: - # ```json - # { - # "errors": [ - # "Your card was declined. This transaction requires 3D secure - # authentication." - # ], - # "gateway_payment_id": "pay_6gjofv7dlyrkpizlolsuspvtiu", - # "description": "This card requires 3D secure authentication. Redirect - # the customer to the URL from the action_link attribute to authenticate. - # Attach callback_url param to this URL if you want to be notified about the - # result of 3D Secure authentication. Attach redirect_url param to this URL - # if you want to redirect a customer back to your page after 3D Secure - # authentication. Example: - # https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_t - # ime_token_id=123&callback_url=https://localhost:4000&redirect_url=https:// - # yourpage.com will do a POST request to https://localhost:4000 after - # payment is authenticated and will redirect a customer to - # https://yourpage.com after 3DS authentication.", - # "action_link": - # "http://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_t - # ime_token_id=123" - # } - # ``` - # To let the customer go through 3D Secure Authentication, they need to be - # redirected to the URL specified in `action_link`. - # Optionally, you can specify `callback_url` parameter in the `action_link` - # URL if you’d like to be notified about the result of 3D Secure - # Authentication. The `callback_url` will return the following information: - # - whether the authentication was successful (`success`) - # - the gateway ID for the payment (`gateway_payment_id`) - # - the subscription ID (`subscription_id`) - # Lastly, you can also specify a `redirect_url` parameter within the - # `action_link` URL if you’d like to redirect a customer back to your site. - # It is not possible to use `action_link` in an iframe inside a custom - # application. You have to redirect the customer directly to the - # `action_link`, then, to be notified about the result, use `redirect_url` - # or `callback_url`. - # The final URL that you send a customer to complete 3D Secure may resemble - # the following, where the first half is the `action_link` and the second - # half contains a `redirect_url` and `callback_url`: - # `https://mysite.chargify.com/3d-secure/pay_6gjofv7dlyrkpizlolsuspvtiu?one_ - # time_token_id=123&callback_url=https://localhost:4000&redirect_url=https:/ - # /yourpage.com` - # ### Example Redirect Flow - # You may wish to redirect customers to different pages depending on whether - # their SCA was performed successfully. Here's an example flow to use as a - # reference: - # 1. Create a subscription via API; it requires 3DS - # 2. You receive a `gateway_payment_id` in the `action_link` along other - # params in the response. - # 3. Use this `gateway_payment_id` to, for example, connect with your - # internal resources or generate a session_id - # 4. Include 1 of those attributes inside the `callback_url` and - # `redirect_url` to be aware which “session” this applies to - # 5. Redirect the customer to the `action_link` with `callback_url` and - # `redirect_url` applied - # 6. After the customer finishes 3DS authentication, we let you know the - # result by making a request to applied `callback_url`. - # 7. After that, we redirect the customer to the `redirect_url`; at this - # point the result of authentication is known - # 8. Optionally, you can use the applied "msg" param in the `redirect_url` - # to determine whether it was successful or not - # ## Subscriptions Import - # Subscriptions can be “imported” via the API to handle the following - # scenarios: - # + You already have existing subscriptions with specific start and renewal - # dates that you would like to import to Advanced Billing - # + You already have credit cards stored in your provider’s vault and you - # would like to create subscriptions using those tokens - # Before importing, you should have already set up your products to match - # your offerings. Then, you can create Subscriptions via the API just like - # you normally would, but using a few special attributes. - # Full documentation on how import Subscriptions using the **import tool** - # in the Advanced Billing UI can be located - # [here](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports) - # . - # ### Important Notices and Disclaimers regarding Imports - # Before performing a bulk import of subscriptions via the API, we suggest - # reading the [Subscriptions - # Import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Imports - # ) instructions to understand the repurcussions of a large import. - # ### Subscription Input Attributes - # The following _additional_ attributes to the subscription input attributes - # make imports possible: `next_billing_at`, `previous_billing_at`, and - # `import_mrr`. - # ### Current Vault - # If you are using a Legacy gateway such as "eWAY Rapid (Legacy)" or "Stripe - # (Legacy)" then please contact Support for further instructions on - # subscription imports. - # ### Braintree Blue (Braintree v2) Imports - # Braintree Blue is Braintree’s newer (version 2) API. For this gateway, - # please provide the `vault_token` parameter with the value from Braintree’s - # “Customer ID” rather than the “Payment Profile Token”. At this time we do - # not use `current_vault_token` with the Braintree Blue gateway, and we only - # support a single payment profile per Braintree Customer. - # When importing PayPal type payment profiles, please set `payment_type` to - # `paypal_account`. - # ### Stripe ACH Imports - # If the bank account has already been verified, currently you will need to - # create the customer, create the payment profile in Advanced Billing - - # setting verified=true, then create a subscription using the customer_id - # and payment_profile_id. - # ### Webhooks During Import - # If no `next_billing_at` is provided, webhooks will be fired as normal. If - # you do set a future `next_billing_at`, only a subset of the webhooks are - # fired when the subscription is created. Keep reading for more information - # as to what webhooks will be fired under which scenarios. - # #### Successful creation with Billing Date - # Scenario: If `next_billing_at` provided - # + `signup_success` - # + `billing_date_change` - # #### Successful creation without Billing Date - # Scenario: If no `next_billing_at` provided - # + `signup_success` - # + `payment_success` - # #### Unsuccessful creation - # Scenario: If card can’t be charged, and no `next_billing_at` provided - # + signup_failure - # #### Webhooks fired when next_billing_at is reached: - # + `renewal_success or renewal_failure` - # + `payment_success or payment_failure` - # ### Date and Time Formats - # We will attempt to parse any string you send as the value of - # next_billing_at in to a date or time. For best results, use a known format - # like described in “Date and Time Specification” of RFC 2822 or ISO 8601 . - # The following are all equivalent and will work as input to - # `next_billing_at`: - # ``` - # Aug 06 2030 11:34:00 -0400 - # Aug 06 2030 11:34 -0400 - # 2030-08-06T11:34:00-04:00 - # 8/6/2030 11:34:00 EDT - # 8/6/2030 8:34:00 PDT - # 2030-08-06T15:34:00Z - # ``` - # You may also pass just a date, in which case we will assume the time to be - # noon - # ``` - # 2010-08-06 - # ``` - # ## Subscription Hierarchies & WhoPays - # When subscription groups were first added to our Relationship Invoicing - # architecture, to group together invoices for related subscriptions and - # allow for complex customer hierarchies and WhoPays scenarios, they were - # designed to consist of a primary and a collection of group members. The - # primary would control many aspects of the group, such as when the - # consolidated invoice is generated. As of today, groups still function this - # way. - # In the future, the concept of a "primary" will be removed in order to - # offer more flexibility into group management and reduce confusion - # concerning what actions must be done on a primary level, rather than a - # member level. - # We have introduced a two scheme system as a bridge between these two group - # organizations. Scheme 1, which is relevant to all subscription groups - # today, marks the group as being "ruled" by a primary. - # When reading a subscription via API, they will return a top-level - # attribute called `group`, which will denote which scheme is being used. At - # this time, the `scheme` attribute will always be 1. - # ### Subscription in a Customer Hierarchy - # For sites making use of the [Relationship - # Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanc - # ed-Billing-Invoices-Overview) and [Customer - # Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Cust - # omer-Hierarchies-WhoPays) features, it is possible to create subscriptions - # within a customer hierarchy. This can be achieved through the API by - # passing group parameters in the **Create Subscription** request. - # + The `group` parameters are optional and consist of the required `target` - # and optional `billing` parameters. - # When the `target` parameter specifies a customer that is already part of a - # hierarchy, the new subscription will become a member of the customer - # hierarchy as well. If the target customer is not part of a hierarchy, a - # new customer hierarchy will be created and both the target customer and - # the new subscription will become part of the hierarchy with the specified - # target customer set as the responsible payer for the hierarchy's + # Creates a Subscription for a customer and product + # Specify the product with `product_id` or `product_handle`. To set a + # specific product pricepPoint, use `product_price_point_handle` or + # `product_price_point_id`. + # Identify an existing customer with `customer_id` or `customer_reference`. + # Optionally, include an existing payment profile using + # `payment_profile_id`. To create a new customer, pass customer_attributes. + # Select an option from the **Request Examples** drop-down on the right side + # of the portal to see examples of common scenarios for creating # subscriptions. - # Rather than specifying a customer, the `target` parameter could instead - # simply have a value of `self` which indicates the subscription will be - # paid for not by some other customer, but by the subscribing customer. - # This will be true whether the customer is being created new, is already - # part of a hierarchy, or already exists outside a hierarchy. A valid - # payment method must also be specified in the subscription parameters. - # Note that when creating subscriptions in a customer hierarchy, if the - # customer hierarchy does not already have a payment method, passing valid - # credit card attributes in the subscription parameters will also result in - # the payment method being established as the default payment method for the - # customer hierarchy irrespective of the responsible payer. - # The optional `billing` parameters specify how some aspects of the billing - # for the new subscription should be handled. Rather than capturing payment - # immediately, the `accrue` parameter can be included so that the new - # subscription charges accrue until the next assessment date. Regarding the - # date, the `align_date` parameter can be included so that the billing date - # of the new subscription matches up with the default subscription group in - # the customer hierarchy. When choosing to align the dates, the `prorate` - # parameter can also be specified so that the new subscription charges are - # prorated based on the billing period of the default subscription group in - # the customer hierarchy also. - # ### Subscription in a Subscription Group - # For sites making use of [Relationship - # Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanc - # ed-Billing-Invoices-Overview) it may be desireable to create a - # subscription as part of a [subscription - # group](https://maxio.zendesk.com/hc/en-us/articles/24252172565005-Subscrip - # tion-Groups-Overview) in order to rely on [invoice - # consolidation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389- - # Invoice-Consolidation). This can be achieved through the API by passing - # group parameters in the Create Subscription request. The `group` - # parameters are optional and consist of the required `target` and optional - # `billing` parameters. - # The `target` parameters specify an existing subscription with which the - # newly created subscription should be grouped. If the target subscription - # is already part of a group, the new subscription will become a member of - # the group as well. If the target subscription is not part of a group, a - # new group will be created and both the target and the new subscription - # will become part of the group with the target as the group's primary - # subscription. - # The optional `billing` parameters specify how some aspects of the billing - # for the new subscription should be handled. Rather than capturing payment - # immediately, the `accrue` parameter can be included so that the new - # subscription charges accrue until the next assessment date. Regarding the - # date, the `align_date` parameter can be included so that the billing date - # of the new subscription matches up with the target subscription. When - # choosing to align the dates, the `prorate` parameter can also be specified - # so that the new subscription charges are prorated based on the billing - # period of the target subscription also. - # ## Providing Agreement Acceptance Params - # It is possible to provide a proof of customer's acceptance of terms and - # policies. - # We will be storing this proof in case it might be required (i.e. - # chargeback). - # Currently, we already keep it for subscriptions created via Public Signup - # Pages. - # In order to create a subscription with the proof of agreement acceptance, - # you must provide additional parameters `agreement acceptance` with - # `ip_address` and at least one url to the policy that was accepted: - # `terms_url` or `privacy_policy_url`. Additional urls that can be provided: - # `return_refund_policy_url`, `delivery_policy_url` and - # `secure_checkout_policy_url`. - # ```json - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "agreement_acceptance": { - # "ip_address": "1.2.3.4", - # "terms_url": "https://terms.url", - # "privacy_policy_url": "https://privacy_policy.url", - # "return_refund_policy_url": "https://return_refund_policy.url", - # "delivery_policy_url": "https://delivery_policy.url", - # "secure_checkout_policy_url": "https://secure_checkout_policy.url" - # } - # } - # } - # ``` - # **For Maxio Payments subscriptions, the agreement acceptance params are - # required, with at least terms_url provided.** - # ## Providing ACH Agreement params - # It is also possible to provide a proof that a customer authorized ACH - # agreement terms. - # The proof will be stored and the email will be sent to the customer with a - # copy of the terms (if enabled). - # In order to create a subscription with the proof of authorized ACH - # agreement terms, you must provide the additional parameter `ach_agreement` - # with the following nested parameters: `agreement_terms`, - # `authorizer_first_name`, `authorizer_last_name` and `ip_address`. - # Each of them is required. - # ```json - # "subscription": { - # "product_handle": "gold-product", - # "customer_attributes": { - # "first_name": "Jane", - # "last_name": "Doe", - # "email": "jd@chargify.test" - # }, - # "bank_account_attributes": { - # "bank_name": "Test Bank", - # "bank_routing_number": "021000089", - # "bank_account_number": "111111111111", - # "bank_account_type": "checking", - # "bank_account_holder_type": "business", - # "payment_type": "bank_account" - # }, - # "ach_agreement": { - # "agreement_terms": "ACH agreement terms", - # "authorizer_first_name": "Jane", - # "authorizer_last_name": "Doe", - # "ip_address": "1.2.3.4" - # } - # } - # ``` + # Payment information may be required to create a subscription, depending on + # the options for the Product being subscribed. See [product + # options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Prod + # ucts) for more information. See the [Payments + # Profile]($e/Payment%20Profiles/createPaymentProfile) endpoint for details + # on payment parameters. + # Do not use real card information for testing. See the Sites articles that + # cover [testing your site + # setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Ove + # rview#testing-overview-0-0) for more details on testing in your sandbox. + # Note that collecting and sending raw card details in production requires + # [PCI + # compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Co + # mpliance#pci-compliance-0-0) on your end. If your business is not PCI + # compliant, use + # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char + # gify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank + # account information. + # See the [Subscription + # Signups](page:introduction/basic-concepts/subscription-signup) article for + # more information on working with subscriptions in Advanced Billing. # @param [CreateSubscriptionRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionResponse] Response from the API call. @@ -891,68 +159,78 @@ def list_subscriptions(options = {}) .execute end - # The subscription endpoint allows you to instantly update one or many - # attributes about a subscription in a single call. + # Updates one or more attributes of a subscription. # ## Update Subscription Payment Method - # Change the card that your Subscriber uses for their subscription. You can - # also use this method to simply change the expiration date of the card **if - # your gateway allows**. - # Note that partial card updates for **Authorize.Net** are not allowed via + # Change the card that your subscriber uses for their subscription. You can + # also use this method to change the expiration date of the card **if your + # gateway allows**. + # Do not use real card information for testing. See the Sites articles that + # cover [testing your site + # setup](https://docs.maxio.com/hc/en-us/articles/24250712113165-Testing-Ove + # rview#testing-overview-0-0) for more details on testing in your sandbox. + # Note that collecting and sending raw card details in production requires + # [PCI + # compliance](https://docs.maxio.com/hc/en-us/articles/24183956938381-PCI-Co + # mpliance#pci-compliance-0-0) on your end. If your business is not PCI + # compliant, use + # [Chargify.js](https://docs.maxio.com/hc/en-us/articles/38163190843789-Char + # gify-js-Overview#chargify-js-overview-0-0) to collect credit card or bank + # account information. + # > Note: Partial card updates for **Authorize.Net** are not allowed via # this endpoint. The existing Payment Profile must be directly updated # instead. + # ## Update Product # You also use this method to change the subscription to a different product # by setting a new value for product_handle. A product change can be done in # two different ways, **product change** or **delayed product change**. - # ## Product Change - # This endpoint may be used to change a subscription's product. The new - # payment amount is calculated and charged at the normal start of the next - # period. If you desire complex product changes or prorated upgrades and - # downgrades instead, please see the documentation on Migrating Subscription - # Products. - # To perform a product change, simply set either the `product_handle` or + # ### Product Change + # You can change a subscription's product. The new payment amount is + # calculated and charged at the normal start of the next period. If you + # require complex product changes or prorated upgrades and downgrades + # instead, please see the documentation on [Migrating Subscription + # Products](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product- + # Changes-and-Migrations#product-changes-and-migrations-0-0). + # To perform a product change, set either the `product_handle` or # `product_id` attribute to that of a different product from the same site # as the subscription. You can also change the price point by passing in # either `product_price_point_id` or `product_price_point_handle` - - # otherwise the new product's default price point will be used. + # otherwise the new product's default price point is used. # ### Delayed Product Change # This method also changes the product and/or price point, and the new # payment amount is calculated and charged at the normal start of the next # period. # This method schedules the product change to happen automatically at the - # subscription’s next renewal date. To perform a Delayed Product Change, set + # subscription’s next renewal date. To perform a delayed product change, set # the `product_handle` attribute as you would in a regular product change, # but also set the `product_change_delayed` attribute to `true`. No # proration applies in this case. # You can also perform a delayed change to the price point by passing in # either `product_price_point_id` or `product_price_point_handle` - # **Note: To cancel a delayed product change, set `next_product_id` to an - # empty string.** + # > **Note:** To cancel a delayed product change, set `next_product_id` to + # an empty string. # ## Billing Date Changes + # You can update dates for a subscrption. # ### Regular Billing Date Changes # Send the `next_billing_at` to set the next billing date for the # subscription. After that date passes and the subscription is processed, # the following billing date will be set according to the subscription's # product period. - # Note that if you pass an invalid date, we will automatically interpret and - # set the correct date. For example, when February 30 is entered, the next - # billing will be set to March 2nd in a non-leap year. + # > Note: If you pass an invalid date, the correct date is automatically set + # to he correct date. For example, if February 30 is passed, the next + # billing would be set to March 2nd in a non-leap year. # The server response will not return data under the key/value pair of - # `next_billing`. Please view the key/value pair of `current_period_ends_at` - # to verify that the `next_billing` date has been changed successfully. - # ### Snap Day Changes + # `next_billing_at`. View the key/value pair of `current_period_ends_at` to + # verify that the `next_billing_at` date has been changed successfully. + # ### Calendar Billing and Snap Day Changes # For a subscription using Calendar Billing, setting the next billing date # is a bit different. Send the `snap_day` attribute to change the calendar # billing date for **a subscription using a product eligible for calendar # billing**. - # Note: If you change the product associated with a subscription that - # contains a `snap_date` and immediately `READ/GET` the subscription data, - # it will still contain evidence of the existing `snap_date`. This is due to - # the fact that a product change is instantanous and only affects the - # product associated with a subscription. After the `next_billing` date - # arrives, the `snap_day` associated with the subscription will return to - # `null.` Another way of looking at this is that you willl have to wait for - # the next billing cycle to arrive before the `snap_date` will reset to - # `null`. + # > Note: If you change the product associated with a subscription that + # contains a `snap_day` and immediately `READ/GET` the subscription data, it + # will still contain original `snap_day`. The `snap_day`will will reset to + # 'null on the next billing cycle. This is because a product change is + # instantanous and only affects the product associated with a subscription. # @param [Integer] subscription_id Required parameter: The Chargify id of # the subscription # @param [UpdateSubscriptionRequest] body Optional parameter: TODO: type @@ -1097,8 +375,8 @@ def find_subscription(reference: nil) # record and/or payment profiles by passing `cascade` parameters. For # example, to delete just the customer record, the query params would be: # `?ack={customer_id}&cascade[]=customer` - # If you need to remove subscriptions from a live site, please contact - # support to discuss your use case. + # If you need to remove subscriptions from a live site, contact support to + # discuss your use case. # ### Delete customer and payment profile # The query params will be: # `?ack={customer_id}&cascade[]=customer&cascade[]=payment_profile` @@ -1171,7 +449,7 @@ def update_prepaid_subscription_configuration(subscription_id, # Subscriber's Summary. # A subscription will not be created by utilizing this endpoint; it is meant # to serve as a prediction. - # For more information, please see our documentation + # For more information, see our documentation # [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscrib # er-Interface-Overview). # ## Taxable Subscriptions @@ -1182,24 +460,24 @@ def update_prepaid_subscription_configuration(subscription_id, # or combination of the two. # + The subscription payload must contain a full billing or shipping address # in order to calculate tax - # For more information about creating taxable previews, please see our + # For more information about creating taxable previews, see our # documentation guide on how to create [taxable # subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325 # -Taxes) # You do **not** need to include a card number to generate tax information - # when you are previewing a subscription. However, please note that when you - # actually want to create the subscription, you must include the credit card - # information if you want the billing address to be stored in Advanced - # Billing. The billing address and the credit card information are stored - # together within the payment profile object. Also, you may not send a - # billing address to Advanced Billing without payment profile information, - # as the address is stored on the card. + # when you are previewing a subscription. However, when you actually want to + # create the subscription, you must include the credit card information if + # you want the billing address to be stored in Advanced Billing. The billing + # address and the credit card information are stored together within the + # payment profile object. Also, you may not send a billing address to + # Advanced Billing without payment profile information, as the address is + # stored on the card. # You can pass shipping and billing addresses and still decide not to # calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` # attribute. # ## Non-taxable Subscriptions - # If you'd like to calculate subscriptions that do not include tax, please - # feel free to leave off the billing information. + # If you'd like to calculate subscriptions that do not include tax you may + # leave off the billing information. # @param [CreateSubscriptionRequest] body Optional parameter: TODO: type # description here # @return [SubscriptionPreviewResponse] Response from the API call. @@ -1267,7 +545,7 @@ def apply_coupons_to_subscription(subscription_id, # Use this endpoint to remove a coupon from an existing subscription. # For more information on the expected behaviour of removing a coupon from a - # subscription, please see our documentation + # subscription, See our documentation # [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 diff --git a/lib/advanced_billing/http/auth/basic_auth.rb b/lib/advanced_billing/http/auth/basic_auth.rb index a8f5313c..04dbda45 100644 --- a/lib/advanced_billing/http/auth/basic_auth.rb +++ b/lib/advanced_billing/http/auth/basic_auth.rb @@ -40,6 +40,18 @@ def initialize(username:, password:) @password = password end + def self.from_env + username = ENV['USERNAME'] + password = ENV['PASSWORD'] + all_nil = [ + username, + password + ].all?(&:nil?) + return nil if all_nil + + new(username: username, password: password) + end + def clone_with(username: nil, password: nil) username ||= self.username password ||= self.password diff --git a/lib/advanced_billing/http/proxy_settings.rb b/lib/advanced_billing/http/proxy_settings.rb index aacb4e07..7d86a019 100644 --- a/lib/advanced_billing/http/proxy_settings.rb +++ b/lib/advanced_billing/http/proxy_settings.rb @@ -9,5 +9,14 @@ module AdvancedBilling # including optional basic authentication. # class ProxySettings < CoreLibrary::ProxySettings + def self.from_env + address = ENV['PROXY_ADDRESS'] + port = ENV['PROXY_PORT'] + username = ENV['PROXY_USERNAME'] + password = ENV['PROXY_PASSWORD'] + return nil if address.nil? || address.strip.empty? + + new(address: address, port: port, username: username, password: password) + end end end diff --git a/lib/advanced_billing/models/activate_event_based_component.rb b/lib/advanced_billing/models/activate_event_based_component.rb index 06d4bf6d..0c58ff1d 100644 --- a/lib/advanced_billing/models/activate_event_based_component.rb +++ b/lib/advanced_billing/models/activate_event_based_component.rb @@ -15,8 +15,7 @@ class ActivateEventBasedComponent < BaseModel # This attribute is particularly useful when you need to align billing # events for different components on distinct schedules within a - # subscription. Please note this only works for site with Multifrequency - # enabled + # subscription. This only works for site with Multifrequency enabled. # @return [BillingSchedule] attr_accessor :billing_schedule diff --git a/lib/advanced_billing/models/all_vaults.rb b/lib/advanced_billing/models/all_vaults.rb index 8e8d0377..7e0c5526 100644 --- a/lib/advanced_billing/models/all_vaults.rb +++ b/lib/advanced_billing/models/all_vaults.rb @@ -116,5 +116,50 @@ def self.validate(value) ALL_VAULTS.include?(value) end + + def self.from_value(value, default_value = ADYEN) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'adyen' then ADYEN + when 'authorizenet' then AUTHORIZENET + when 'beanstream' then BEANSTREAM + when 'blue_snap' then BLUE_SNAP + when 'bogus' then BOGUS + when 'braintree1' then BRAINTREE1 + when 'braintree_blue' then BRAINTREE_BLUE + when 'checkout' then CHECKOUT + when 'cybersource' then CYBERSOURCE + when 'elavon' then ELAVON + when 'eway' then EWAY + when 'eway_rapid' then EWAY_RAPID + when 'eway_rapid_std' then EWAY_RAPID_STD + when 'firstdata' then FIRSTDATA + when 'forte' then FORTE + when 'gocardless' then GOCARDLESS + when 'litle' then LITLE + when 'maxio_payments' then MAXIO_PAYMENTS + when 'maxp' then MAXP + when 'moduslink' then MODUSLINK + when 'moneris' then MONERIS + when 'nmi' then NMI + when 'orbital' then ORBITAL + when 'payment_express' then PAYMENT_EXPRESS + when 'paymill' then PAYMILL + when 'paypal' then PAYPAL + when 'paypal_complete' then PAYPAL_COMPLETE + when 'pin' then PIN + when 'square' then SQUARE + when 'stripe' then STRIPE + when 'stripe_connect' then STRIPE_CONNECT + when 'trust_commerce' then TRUST_COMMERCE + when 'unipaas' then UNIPAAS + when 'wirecard' then WIRECARD + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/allocation_preview_direction.rb b/lib/advanced_billing/models/allocation_preview_direction.rb index 1e56514c..ba7e9edb 100644 --- a/lib/advanced_billing/models/allocation_preview_direction.rb +++ b/lib/advanced_billing/models/allocation_preview_direction.rb @@ -19,5 +19,18 @@ def self.validate(value) ALLOCATION_PREVIEW_DIRECTION.include?(value) end + + def self.from_value(value, default_value = UPGRADE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'upgrade' then UPGRADE + when 'downgrade' then DOWNGRADE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/allocation_preview_line_item_kind.rb b/lib/advanced_billing/models/allocation_preview_line_item_kind.rb index b6cdf865..98c429f6 100644 --- a/lib/advanced_billing/models/allocation_preview_line_item_kind.rb +++ b/lib/advanced_billing/models/allocation_preview_line_item_kind.rb @@ -25,5 +25,20 @@ def self.validate(value) ALLOCATION_PREVIEW_LINE_ITEM_KIND.include?(value) end + + def self.from_value(value, default_value = QUANTITY_BASED_COMPONENT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'quantity_based_component' then QUANTITY_BASED_COMPONENT + when 'on_off_component' then ON_OFF_COMPONENT + when 'coupon' then COUPON + when 'tax' then TAX + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/apple_pay_vault.rb b/lib/advanced_billing/models/apple_pay_vault.rb index 7f92aefb..9cdeb47e 100644 --- a/lib/advanced_billing/models/apple_pay_vault.rb +++ b/lib/advanced_billing/models/apple_pay_vault.rb @@ -16,5 +16,11 @@ def self.validate(value) APPLE_PAY_VAULT.include?(value) end + + def self.from_value(value, default_value = BRAINTREE_BLUE) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/auto_invite.rb b/lib/advanced_billing/models/auto_invite.rb index ef44b4c5..1b702d11 100644 --- a/lib/advanced_billing/models/auto_invite.rb +++ b/lib/advanced_billing/models/auto_invite.rb @@ -19,5 +19,24 @@ def self.validate(value) AUTO_INVITE.include?(value) end + + def self.from_value(value, default_value = NO) + return default_value if value.nil? + + str = value.to_s.strip + if str.match?(/\A\d+\z/) + num = str.to_i + return num if AUTO_INVITE.include?(num) + + return default_value + end + + case str.downcase + when 'no' then NO + when 'yes' then YES + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/bank_account_holder_type.rb b/lib/advanced_billing/models/bank_account_holder_type.rb index 6250b2b2..920e7f85 100644 --- a/lib/advanced_billing/models/bank_account_holder_type.rb +++ b/lib/advanced_billing/models/bank_account_holder_type.rb @@ -19,5 +19,18 @@ def self.validate(value) BANK_ACCOUNT_HOLDER_TYPE.include?(value) end + + def self.from_value(value, default_value = PERSONAL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'personal' then PERSONAL + when 'business' then BUSINESS + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/bank_account_type.rb b/lib/advanced_billing/models/bank_account_type.rb index 6156a515..5118bfb2 100644 --- a/lib/advanced_billing/models/bank_account_type.rb +++ b/lib/advanced_billing/models/bank_account_type.rb @@ -19,5 +19,18 @@ def self.validate(value) BANK_ACCOUNT_TYPE.include?(value) end + + def self.from_value(value, default_value = CHECKING) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'checking' then CHECKING + when 'savings' then SAVINGS + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/bank_account_vault.rb b/lib/advanced_billing/models/bank_account_vault.rb index ecde915d..a11abc16 100644 --- a/lib/advanced_billing/models/bank_account_vault.rb +++ b/lib/advanced_billing/models/bank_account_vault.rb @@ -38,5 +38,24 @@ def self.validate(value) BANK_ACCOUNT_VAULT.include?(value) end + + def self.from_value(value, default_value = AUTHORIZENET) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'authorizenet' then AUTHORIZENET + when 'blue_snap' then BLUE_SNAP + when 'bogus' then BOGUS + when 'forte' then FORTE + when 'gocardless' then GOCARDLESS + when 'maxio_payments' then MAXIO_PAYMENTS + when 'maxp' then MAXP + when 'stripe_connect' then STRIPE_CONNECT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/basic_date_field.rb b/lib/advanced_billing/models/basic_date_field.rb index ac98bcc7..079c067b 100644 --- a/lib/advanced_billing/models/basic_date_field.rb +++ b/lib/advanced_billing/models/basic_date_field.rb @@ -19,5 +19,18 @@ def self.validate(value) BASIC_DATE_FIELD.include?(value) end + + def self.from_value(value, default_value = UPDATED_AT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'updated_at' then UPDATED_AT + when 'created_at' then CREATED_AT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/billing_manifest_line_item_kind.rb b/lib/advanced_billing/models/billing_manifest_line_item_kind.rb index 3cc40627..c5d292d0 100644 --- a/lib/advanced_billing/models/billing_manifest_line_item_kind.rb +++ b/lib/advanced_billing/models/billing_manifest_line_item_kind.rb @@ -31,5 +31,22 @@ def self.validate(value) BILLING_MANIFEST_LINE_ITEM_KIND.include?(value) end + + def self.from_value(value, default_value = BASELINE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'baseline' then BASELINE + when 'initial' then INITIAL + when 'trial' then TRIAL + when 'coupon' then COUPON + when 'component' then COMPONENT + when 'tax' then TAX + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/billing_schedule.rb b/lib/advanced_billing/models/billing_schedule.rb index e556aacd..1e21971a 100644 --- a/lib/advanced_billing/models/billing_schedule.rb +++ b/lib/advanced_billing/models/billing_schedule.rb @@ -5,8 +5,8 @@ module AdvancedBilling # This attribute is particularly useful when you need to align billing events - # for different components on distinct schedules within a subscription. Please - # note this only works for site with Multifrequency enabled + # for different components on distinct schedules within a subscription. This + # only works for site with Multifrequency enabled. class BillingSchedule < BaseModel SKIP = Object.new private_constant :SKIP diff --git a/lib/advanced_billing/models/calendar_billing.rb b/lib/advanced_billing/models/calendar_billing.rb index 70a70b4f..59dde8c5 100644 --- a/lib/advanced_billing/models/calendar_billing.rb +++ b/lib/advanced_billing/models/calendar_billing.rb @@ -38,7 +38,9 @@ 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_method.rb b/lib/advanced_billing/models/cancellation_method.rb index 5f60e911..41ced748 100644 --- a/lib/advanced_billing/models/cancellation_method.rb +++ b/lib/advanced_billing/models/cancellation_method.rb @@ -32,5 +32,22 @@ def self.validate(value) CANCELLATION_METHOD.include?(value) end + + def self.from_value(value, default_value = MERCHANT_UI) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'merchant_ui' then MERCHANT_UI + when 'merchant_api' then MERCHANT_API + when 'dunning' then DUNNING + when 'billing_portal' then BILLING_PORTAL + when 'unknown' then UNKNOWN + when 'imported' then IMPORTED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/card_type.rb b/lib/advanced_billing/models/card_type.rb index 19abc989..043e3315 100644 --- a/lib/advanced_billing/models/card_type.rb +++ b/lib/advanced_billing/models/card_type.rb @@ -121,5 +121,52 @@ def self.validate(value) CARD_TYPE.include?(value) end + + def self.from_value(value, default_value = VISA) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'visa' then VISA + when 'master' then MASTER + when 'elo' then ELO + when 'cabal' then CABAL + when 'alelo' then ALELO + when 'discover' then DISCOVER + when 'american_express' then AMERICAN_EXPRESS + when 'naranja' then NARANJA + when 'diners_club' then DINERS_CLUB + when 'jcb' then JCB + when 'dankort' then DANKORT + when 'maestro' then MAESTRO + when 'maestro_no_luhn' then MAESTRO_NO_LUHN + when 'forbrugsforeningen' then FORBRUGSFORENINGEN + when 'sodexo' then SODEXO + when 'alia' then ALIA + when 'vr' then VR + when 'unionpay' then UNIONPAY + when 'carnet' then CARNET + when 'cartes_bancaires' then CARTES_BANCAIRES + when 'olimpica' then OLIMPICA + when 'creditel' then CREDITEL + when 'confiable' then CONFIABLE + when 'synchrony' then SYNCHRONY + when 'routex' then ROUTEX + when 'mada' then MADA + when 'bp_plus' then BP_PLUS + when 'passcard' then PASSCARD + when 'edenred' then EDENRED + when 'anda' then ANDA + when 'tarjetad' then TARJETAD + when 'hipercard' then HIPERCARD + when 'bogus' then BOGUS + when 'switch' then SWITCH + when 'solo' then SOLO + when 'laser' then LASER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/chargeback_status.rb b/lib/advanced_billing/models/chargeback_status.rb index 12adc476..596d05f9 100644 --- a/lib/advanced_billing/models/chargeback_status.rb +++ b/lib/advanced_billing/models/chargeback_status.rb @@ -25,5 +25,20 @@ def self.validate(value) CHARGEBACK_STATUS.include?(value) end + + def self.from_value(value, default_value = OPEN) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'open' then OPEN + when 'lost' then LOST + when 'won' then WON + when 'closed' then CLOSED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/chargify_ebb.rb b/lib/advanced_billing/models/chargify_ebb.rb index 54fbc9d6..f6db3c21 100644 --- a/lib/advanced_billing/models/chargify_ebb.rb +++ b/lib/advanced_billing/models/chargify_ebb.rb @@ -16,14 +16,14 @@ class ChargifyEBB < BaseModel # @return [DateTime] attr_accessor :timestamp - # A unique ID set by Chargify. Please note that this field is reserved. If - # `chargify.id` is present in the request payload, it will be overwritten. + # A unique ID set by Chargify. This field is reserved. If `chargify.id` is + # present in the request payload, it will be overwritten. # @return [String] attr_accessor :id # An ISO-8601 timestamp, set by Chargify at the time each event is recorded. - # Please note that this field is reserved. If `chargify.created_at` is - # present in the request payload, it will be overwritten. + # This field is reserved. If `chargify.created_at` is present in the request + # payload, it will be overwritten. # @return [DateTime] attr_accessor :created_at diff --git a/lib/advanced_billing/models/cleanup_scope.rb b/lib/advanced_billing/models/cleanup_scope.rb index e7f9a743..69d0075f 100644 --- a/lib/advanced_billing/models/cleanup_scope.rb +++ b/lib/advanced_billing/models/cleanup_scope.rb @@ -22,5 +22,18 @@ def self.validate(value) CLEANUP_SCOPE.include?(value) end + + def self.from_value(value, default_value = ALL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'all' then ALL + when 'customers' then CUSTOMERS + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/collection_method.rb b/lib/advanced_billing/models/collection_method.rb index 6d635a7b..fbfd6fa9 100644 --- a/lib/advanced_billing/models/collection_method.rb +++ b/lib/advanced_billing/models/collection_method.rb @@ -28,5 +28,20 @@ def self.validate(value) COLLECTION_METHOD.include?(value) end + + def self.from_value(value, default_value = AUTOMATIC) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'automatic' then AUTOMATIC + when 'remittance' then REMITTANCE + when 'prepaid' then PREPAID + when 'invoice' then INVOICE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/component.rb b/lib/advanced_billing/models/component.rb index 4df878fe..ad768aee 100644 --- a/lib/advanced_billing/models/component.rb +++ b/lib/advanced_billing/models/component.rb @@ -62,10 +62,6 @@ class Component < BaseModel # @return [TrueClass | FalseClass] attr_accessor :archived - # Boolean flag describing whether a component is taxable or not. - # @return [TrueClass | FalseClass] - attr_accessor :taxable - # The description of the component. # @return [String] attr_accessor :description @@ -98,15 +94,19 @@ class Component < BaseModel # @return [String] attr_accessor :default_price_point_name + # Boolean flag describing whether a component is taxable or not. + # @return [TrueClass | FalseClass] + attr_accessor :taxable + # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [TrueClass | FalseClass] attr_accessor :recurring @@ -193,7 +193,6 @@ def self.names @_hash['price_per_unit_in_cents'] = 'price_per_unit_in_cents' @_hash['kind'] = 'kind' @_hash['archived'] = 'archived' - @_hash['taxable'] = 'taxable' @_hash['description'] = 'description' @_hash['default_price_point_id'] = 'default_price_point_id' @_hash['overage_prices'] = 'overage_prices' @@ -201,6 +200,7 @@ def self.names @_hash['price_point_count'] = 'price_point_count' @_hash['price_points_url'] = 'price_points_url' @_hash['default_price_point_name'] = 'default_price_point_name' + @_hash['taxable'] = 'taxable' @_hash['tax_code'] = 'tax_code' @_hash['recurring'] = 'recurring' @_hash['upgrade_charge'] = 'upgrade_charge' @@ -235,7 +235,6 @@ def self.optionals price_per_unit_in_cents kind archived - taxable description default_price_point_id overage_prices @@ -243,6 +242,7 @@ def self.optionals price_point_count price_points_url default_price_point_name + taxable tax_code recurring upgrade_charge @@ -288,13 +288,13 @@ def initialize(id: SKIP, name: SKIP, handle: SKIP, pricing_scheme: SKIP, unit_name: SKIP, unit_price: SKIP, product_family_id: SKIP, product_family_name: SKIP, product_family_handle: SKIP, price_per_unit_in_cents: SKIP, kind: SKIP, archived: SKIP, - taxable: SKIP, description: SKIP, - default_price_point_id: SKIP, overage_prices: SKIP, - prices: SKIP, price_point_count: SKIP, + description: SKIP, default_price_point_id: SKIP, + overage_prices: SKIP, prices: SKIP, price_point_count: SKIP, price_points_url: SKIP, default_price_point_name: SKIP, - tax_code: SKIP, recurring: SKIP, upgrade_charge: SKIP, - downgrade_credit: SKIP, created_at: SKIP, updated_at: SKIP, - archived_at: SKIP, hide_date_range_on_invoice: SKIP, + taxable: SKIP, tax_code: SKIP, recurring: SKIP, + upgrade_charge: SKIP, downgrade_credit: SKIP, + created_at: SKIP, updated_at: SKIP, archived_at: SKIP, + hide_date_range_on_invoice: SKIP, allow_fractional_quantities: SKIP, item_category: SKIP, use_site_exchange_rate: SKIP, accounting_code: SKIP, event_based_billing_metric_id: SKIP, interval: SKIP, @@ -316,7 +316,6 @@ def initialize(id: SKIP, name: SKIP, handle: SKIP, pricing_scheme: SKIP, @price_per_unit_in_cents = price_per_unit_in_cents unless price_per_unit_in_cents == SKIP @kind = kind unless kind == SKIP @archived = archived unless archived == SKIP - @taxable = taxable unless taxable == SKIP @description = description unless description == SKIP @default_price_point_id = default_price_point_id unless default_price_point_id == SKIP @overage_prices = overage_prices unless overage_prices == SKIP @@ -324,6 +323,7 @@ def initialize(id: SKIP, name: SKIP, handle: SKIP, pricing_scheme: SKIP, @price_point_count = price_point_count unless price_point_count == SKIP @price_points_url = price_points_url unless price_points_url == SKIP @default_price_point_name = default_price_point_name unless default_price_point_name == SKIP + @taxable = taxable unless taxable == SKIP @tax_code = tax_code unless tax_code == SKIP @recurring = recurring unless recurring == SKIP @upgrade_charge = upgrade_charge unless upgrade_charge == SKIP @@ -372,7 +372,6 @@ def self.from_hash(hash) hash.key?('price_per_unit_in_cents') ? hash['price_per_unit_in_cents'] : SKIP kind = hash.key?('kind') ? hash['kind'] : SKIP archived = hash.key?('archived') ? hash['archived'] : SKIP - taxable = hash.key?('taxable') ? hash['taxable'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP default_price_point_id = hash.key?('default_price_point_id') ? hash['default_price_point_id'] : SKIP @@ -402,6 +401,7 @@ def self.from_hash(hash) hash.key?('price_points_url') ? hash['price_points_url'] : SKIP default_price_point_name = hash.key?('default_price_point_name') ? hash['default_price_point_name'] : SKIP + taxable = hash.key?('taxable') ? hash['taxable'] : SKIP tax_code = hash.key?('tax_code') ? hash['tax_code'] : SKIP recurring = hash.key?('recurring') ? hash['recurring'] : SKIP upgrade_charge = @@ -453,7 +453,6 @@ def self.from_hash(hash) price_per_unit_in_cents: price_per_unit_in_cents, kind: kind, archived: archived, - taxable: taxable, description: description, default_price_point_id: default_price_point_id, overage_prices: overage_prices, @@ -461,6 +460,7 @@ def self.from_hash(hash) price_point_count: price_point_count, price_points_url: price_points_url, default_price_point_name: default_price_point_name, + taxable: taxable, tax_code: tax_code, recurring: recurring, upgrade_charge: upgrade_charge, @@ -498,13 +498,13 @@ def to_s " #{@pricing_scheme}, unit_name: #{@unit_name}, unit_price: #{@unit_price},"\ " product_family_id: #{@product_family_id}, product_family_name: #{@product_family_name},"\ " product_family_handle: #{@product_family_handle}, price_per_unit_in_cents:"\ - " #{@price_per_unit_in_cents}, kind: #{@kind}, archived: #{@archived}, taxable: #{@taxable},"\ - " description: #{@description}, default_price_point_id: #{@default_price_point_id},"\ - " overage_prices: #{@overage_prices}, prices: #{@prices}, price_point_count:"\ - " #{@price_point_count}, price_points_url: #{@price_points_url}, default_price_point_name:"\ - " #{@default_price_point_name}, tax_code: #{@tax_code}, recurring: #{@recurring},"\ - " upgrade_charge: #{@upgrade_charge}, downgrade_credit: #{@downgrade_credit}, created_at:"\ - " #{@created_at}, updated_at: #{@updated_at}, archived_at: #{@archived_at},"\ + " #{@price_per_unit_in_cents}, kind: #{@kind}, archived: #{@archived}, description:"\ + " #{@description}, default_price_point_id: #{@default_price_point_id}, overage_prices:"\ + " #{@overage_prices}, prices: #{@prices}, price_point_count: #{@price_point_count},"\ + " price_points_url: #{@price_points_url}, default_price_point_name:"\ + " #{@default_price_point_name}, taxable: #{@taxable}, tax_code: #{@tax_code}, recurring:"\ + " #{@recurring}, upgrade_charge: #{@upgrade_charge}, downgrade_credit: #{@downgrade_credit},"\ + " created_at: #{@created_at}, updated_at: #{@updated_at}, archived_at: #{@archived_at},"\ " hide_date_range_on_invoice: #{@hide_date_range_on_invoice}, allow_fractional_quantities:"\ " #{@allow_fractional_quantities}, item_category: #{@item_category}, use_site_exchange_rate:"\ " #{@use_site_exchange_rate}, accounting_code: #{@accounting_code},"\ @@ -521,11 +521,11 @@ def inspect " product_family_name: #{@product_family_name.inspect}, product_family_handle:"\ " #{@product_family_handle.inspect}, price_per_unit_in_cents:"\ " #{@price_per_unit_in_cents.inspect}, kind: #{@kind.inspect}, archived:"\ - " #{@archived.inspect}, taxable: #{@taxable.inspect}, description: #{@description.inspect},"\ - " default_price_point_id: #{@default_price_point_id.inspect}, overage_prices:"\ - " #{@overage_prices.inspect}, prices: #{@prices.inspect}, price_point_count:"\ - " #{@price_point_count.inspect}, price_points_url: #{@price_points_url.inspect},"\ - " default_price_point_name: #{@default_price_point_name.inspect}, tax_code:"\ + " #{@archived.inspect}, description: #{@description.inspect}, default_price_point_id:"\ + " #{@default_price_point_id.inspect}, overage_prices: #{@overage_prices.inspect}, prices:"\ + " #{@prices.inspect}, price_point_count: #{@price_point_count.inspect}, price_points_url:"\ + " #{@price_points_url.inspect}, default_price_point_name:"\ + " #{@default_price_point_name.inspect}, taxable: #{@taxable.inspect}, tax_code:"\ " #{@tax_code.inspect}, recurring: #{@recurring.inspect}, upgrade_charge:"\ " #{@upgrade_charge.inspect}, downgrade_credit: #{@downgrade_credit.inspect}, created_at:"\ " #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, archived_at:"\ diff --git a/lib/advanced_billing/models/component_custom_price.rb b/lib/advanced_billing/models/component_custom_price.rb index 4c74bfdb..d1cf7e69 100644 --- a/lib/advanced_billing/models/component_custom_price.rb +++ b/lib/advanced_billing/models/component_custom_price.rb @@ -35,6 +35,26 @@ class ComponentCustomPrice < BaseModel # @return [Array[Price]] attr_accessor :prices + # Applicable only to prepaid usage components. Controls whether the + # allocated quantity renews each period. + # @return [TrueClass | FalseClass] + attr_accessor :renew_prepaid_allocation + + # Applicable only to prepaid usage components. Controls whether remaining + # units roll over to the next period. + # @return [TrueClass | FalseClass] + attr_accessor :rollover_prepaid_remainder + + # Applicable only when rollover is enabled. Number of + # `expiration_interval_unit`s after which rollover amounts expire. + # @return [Integer] + attr_accessor :expiration_interval + + # Applicable only when rollover is enabled. Interval unit for rollover + # expiration (month or day). + # @return [ExpirationIntervalUnit] + attr_accessor :expiration_interval_unit + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @@ -43,6 +63,10 @@ def self.names @_hash['interval'] = 'interval' @_hash['interval_unit'] = 'interval_unit' @_hash['prices'] = 'prices' + @_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 end @@ -53,6 +77,10 @@ def self.optionals pricing_scheme interval interval_unit + renew_prepaid_allocation + rollover_prepaid_remainder + expiration_interval + expiration_interval_unit ] end @@ -60,12 +88,16 @@ def self.optionals def self.nullables %w[ interval_unit + expiration_interval + expiration_interval_unit ] end def initialize(prices:, tax_included: SKIP, pricing_scheme: SKIP, interval: SKIP, interval_unit: SKIP, - additional_properties: {}) + renew_prepaid_allocation: SKIP, + rollover_prepaid_remainder: 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) @@ -76,6 +108,13 @@ def initialize(prices:, tax_included: SKIP, pricing_scheme: SKIP, @interval = interval unless interval == SKIP @interval_unit = interval_unit unless interval_unit == SKIP @prices = prices + @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 end # Creates an instance of the object from a hash. @@ -98,6 +137,14 @@ 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 + 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 # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } @@ -108,6 +155,10 @@ def self.from_hash(hash) pricing_scheme: pricing_scheme, interval: interval, interval_unit: interval_unit, + renew_prepaid_allocation: renew_prepaid_allocation, + rollover_prepaid_remainder: rollover_prepaid_remainder, + expiration_interval: expiration_interval, + expiration_interval_unit: expiration_interval_unit, additional_properties: additional_properties) end @@ -134,7 +185,10 @@ 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},"\ - " additional_properties: #{get_additional_properties}>" + " 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. @@ -142,7 +196,11 @@ 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}, additional_properties:"\ + " #{@interval_unit.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}>" end end diff --git a/lib/advanced_billing/models/component_kind.rb b/lib/advanced_billing/models/component_kind.rb index acdb6534..410ba462 100644 --- a/lib/advanced_billing/models/component_kind.rb +++ b/lib/advanced_billing/models/component_kind.rb @@ -28,5 +28,21 @@ def self.validate(value) COMPONENT_KIND.include?(value) end + + def self.from_value(value, default_value = METERED_COMPONENT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'metered_component' then METERED_COMPONENT + when 'quantity_based_component' then QUANTITY_BASED_COMPONENT + when 'on_off_component' then ON_OFF_COMPONENT + when 'prepaid_usage_component' then PREPAID_USAGE_COMPONENT + when 'event_based_component' then EVENT_BASED_COMPONENT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/compounding_strategy.rb b/lib/advanced_billing/models/compounding_strategy.rb index dda2ac1f..62d50c1f 100644 --- a/lib/advanced_billing/models/compounding_strategy.rb +++ b/lib/advanced_billing/models/compounding_strategy.rb @@ -23,5 +23,18 @@ def self.validate(value) COMPOUNDING_STRATEGY.include?(value) end + + def self.from_value(value, default_value = COMPOUND) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'compound' then COMPOUND + when 'fullprice' then FULLPRICE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/create_allocation.rb b/lib/advanced_billing/models/create_allocation.rb index ed95beb4..223c5994 100644 --- a/lib/advanced_billing/models/create_allocation.rb +++ b/lib/advanced_billing/models/create_allocation.rb @@ -68,8 +68,7 @@ class CreateAllocation < BaseModel # This attribute is particularly useful when you need to align billing # events for different components on distinct schedules within a - # subscription. Please note this only works for site with Multifrequency - # enabled + # subscription. This only works for site with Multifrequency enabled. # @return [BillingSchedule] attr_accessor :billing_schedule diff --git a/lib/advanced_billing/models/create_invoice_coupon.rb b/lib/advanced_billing/models/create_invoice_coupon.rb index 75222338..88dce4c5 100644 --- a/lib/advanced_billing/models/create_invoice_coupon.rb +++ b/lib/advanced_billing/models/create_invoice_coupon.rb @@ -13,6 +13,10 @@ class CreateInvoiceCoupon < BaseModel # @return [String] attr_accessor :code + # TODO: Write general description for this method + # @return [String] + attr_accessor :subcode + # TODO: Write general description for this method # @return [Object] attr_accessor :percentage @@ -41,6 +45,7 @@ class CreateInvoiceCoupon < BaseModel def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' + @_hash['subcode'] = 'subcode' @_hash['percentage'] = 'percentage' @_hash['amount'] = 'amount' @_hash['description'] = 'description' @@ -53,6 +58,7 @@ def self.names def self.optionals %w[ code + subcode percentage amount description @@ -66,7 +72,7 @@ def self.nullables [] end - def initialize(code: SKIP, percentage: SKIP, amount: SKIP, + def initialize(code: SKIP, subcode: SKIP, percentage: SKIP, amount: SKIP, description: SKIP, product_family_id: SKIP, compounding_strategy: SKIP, additional_properties: {}) # Add additional model properties to the instance. @@ -75,6 +81,7 @@ def initialize(code: SKIP, percentage: SKIP, amount: SKIP, end @code = code unless code == SKIP + @subcode = subcode unless subcode == SKIP @percentage = percentage unless percentage == SKIP @amount = amount unless amount == SKIP @description = description unless description == SKIP @@ -88,6 +95,7 @@ def self.from_hash(hash) # Extract variables from the hash. code = hash.key?('code') ? hash['code'] : SKIP + subcode = hash.key?('subcode') ? hash['subcode'] : SKIP percentage = hash.key?('percentage') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateInvoiceCouponPercentage), hash['percentage'] ) : SKIP @@ -106,6 +114,7 @@ def self.from_hash(hash) # Create object from extracted values. CreateInvoiceCoupon.new(code: code, + subcode: subcode, percentage: percentage, amount: amount, description: description, @@ -127,8 +136,8 @@ 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} code: #{@code}, percentage: #{@percentage}, amount: #{@amount},"\ - " description: #{@description}, product_family_id: #{@product_family_id},"\ + "<#{class_name} code: #{@code}, subcode: #{@subcode}, percentage: #{@percentage}, amount:"\ + " #{@amount}, description: #{@description}, product_family_id: #{@product_family_id},"\ " compounding_strategy: #{@compounding_strategy}, additional_properties:"\ " #{get_additional_properties}>" end @@ -136,10 +145,10 @@ def to_s # Provides a debugging-friendly string with detailed object information. def inspect class_name = self.class.name.split('::').last - "<#{class_name} code: #{@code.inspect}, percentage: #{@percentage.inspect}, amount:"\ - " #{@amount.inspect}, description: #{@description.inspect}, product_family_id:"\ - " #{@product_family_id.inspect}, compounding_strategy: #{@compounding_strategy.inspect},"\ - " additional_properties: #{get_additional_properties}>" + "<#{class_name} code: #{@code.inspect}, subcode: #{@subcode.inspect}, percentage:"\ + " #{@percentage.inspect}, amount: #{@amount.inspect}, description: #{@description.inspect},"\ + " product_family_id: #{@product_family_id.inspect}, compounding_strategy:"\ + " #{@compounding_strategy.inspect}, additional_properties: #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/create_invoice_item.rb b/lib/advanced_billing/models/create_invoice_item.rb index 999beaa0..50a35a75 100644 --- a/lib/advanced_billing/models/create_invoice_item.rb +++ b/lib/advanced_billing/models/create_invoice_item.rb @@ -26,14 +26,14 @@ class CreateInvoiceItem < BaseModel attr_accessor :unit_price # Set to true to automatically calculate taxes. Site must be configured to - # use and calculate taxes. - # If using Avalara, a tax_code parameter must also be sent. + # use and calculate taxes. If using AvaTax, a tax_code parameter must also + # be sent. # @return [TrueClass | FalseClass] attr_accessor :taxable - # Set to true to automatically calculate taxes. Site must be configured to - # use and calculate taxes. - # If using Avalara, a tax_code parameter must also be sent. + # A string representing the tax code related to the product type. This is + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/create_invoice_status.rb b/lib/advanced_billing/models/create_invoice_status.rb index 9c521503..725ebf81 100644 --- a/lib/advanced_billing/models/create_invoice_status.rb +++ b/lib/advanced_billing/models/create_invoice_status.rb @@ -19,5 +19,18 @@ def self.validate(value) CREATE_INVOICE_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 'open' then OPEN + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/create_metafield.rb b/lib/advanced_billing/models/create_metafield.rb index 21778144..4a6cd763 100644 --- a/lib/advanced_billing/models/create_metafield.rb +++ b/lib/advanced_billing/models/create_metafield.rb @@ -19,11 +19,9 @@ class CreateMetafield < BaseModel # @return [MetafieldScope] attr_accessor :scope - # Indicates how data should be added to the metafield. For example, a text - # type is just a string, so a given metafield of this type can have any - # value attached. On the other hand, dropdown and radio have a set of - # allowed values that can be input, and appear differently on a Public - # Signup Page. Defaults to 'text' + # Indicates the type of metafield. A text metafield allows any string value. + # Dropdown and radio metafields have a set of values that can be selected. + # Defaults to 'text'. # @return [MetafieldInput] attr_accessor :input_type diff --git a/lib/advanced_billing/models/create_or_update_product.rb b/lib/advanced_billing/models/create_or_update_product.rb index 5d5046cb..97329629 100644 --- a/lib/advanced_billing/models/create_or_update_product.rb +++ b/lib/advanced_billing/models/create_or_update_product.rb @@ -26,8 +26,8 @@ class CreateOrUpdateProduct < BaseModel attr_accessor :accounting_code # Deprecated value that can be ignored unless you have legacy hosted pages. - # For Public Signup Page users, please read this attribute from under the - # signup page. + # For Public Signup Page users, read this attribute from under the signup + # page. # @return [TrueClass | FalseClass] attr_accessor :require_credit_card @@ -60,9 +60,13 @@ class CreateOrUpdateProduct < BaseModel # @return [IntervalUnit] attr_accessor :trial_interval_unit - # A string representing the trial interval unit for this product, either - # month or day - # @return [String] + # Indicates how a trial is handled when the trail period ends and there is + # no credit card on file. For `no_obligation`, the subscription transitions + # to a Trial Ended state. Maxio will not send any emails or statements. For + # `payment_expected`, the subscription transitions to a Past Due state. + # Maxio will send normal dunning emails and statements according to your + # other settings. + # @return [TrialType] attr_accessor :trial_type # The numerical expiration interval. i.e. an expiration_interval of ‘30’ @@ -82,8 +86,8 @@ class CreateOrUpdateProduct < BaseModel attr_accessor :auto_create_signup_page # A string representing the tax code related to the product type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code @@ -130,6 +134,7 @@ def self.optionals def self.nullables %w[ trial_interval_unit + trial_type expiration_interval_unit ] end diff --git a/lib/advanced_billing/models/create_payment_profile.rb b/lib/advanced_billing/models/create_payment_profile.rb index ca636a49..f456831d 100644 --- a/lib/advanced_billing/models/create_payment_profile.rb +++ b/lib/advanced_billing/models/create_payment_profile.rb @@ -9,15 +9,15 @@ class CreatePaymentProfile < BaseModel SKIP = Object.new private_constant :SKIP - # Token received after sending billing informations using chargify.js. + # Token received after sending billing information using chargify.js. # @return [String] attr_accessor :chargify_token - # Token received after sending billing informations using chargify.js. + # Token received after sending billing information using chargify.js. # @return [Integer] attr_accessor :id - # Token received after sending billing informations using chargify.js. + # Token received after sending billing information using chargify.js. # @return [PaymentType] attr_accessor :payment_type @@ -81,9 +81,9 @@ class CreatePaymentProfile < BaseModel # The credit card or bank account billing address country, required in # [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) # format (i.e. “US”). This value is merely passed through to the payment - # gateway. Some gateways require country codes in a specific format. Please - # check your gateway’s documentation. If creating an ACH subscription, only - # US is supported at this time. + # gateway. Some gateways require country codes in a specific format. Check + # your gateway’s documentation. If creating an ACH subscription, only US is + # supported at this time. # @return [String] attr_accessor :billing_country diff --git a/lib/advanced_billing/models/create_prepayment_method.rb b/lib/advanced_billing/models/create_prepayment_method.rb index d78d4602..79e1932c 100644 --- a/lib/advanced_billing/models/create_prepayment_method.rb +++ b/lib/advanced_billing/models/create_prepayment_method.rb @@ -40,5 +40,24 @@ def self.validate(value) CREATE_PREPAYMENT_METHOD.include?(value) end + + def self.from_value(value, default_value = CHECK) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'check' then CHECK + when 'cash' then CASH + when 'money_order' then MONEY_ORDER + when 'ach' then ACH + when 'paypal_account' then PAYPAL_ACCOUNT + when 'credit_card' then CREDIT_CARD + when 'credit_card_on_file' then CREDIT_CARD_ON_FILE + when 'other' then OTHER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/create_product_price_point.rb b/lib/advanced_billing/models/create_product_price_point.rb index 93a841aa..aa172c1f 100644 --- a/lib/advanced_billing/models/create_product_price_point.rb +++ b/lib/advanced_billing/models/create_product_price_point.rb @@ -47,9 +47,13 @@ class CreateProductPricePoint < BaseModel # @return [IntervalUnit] attr_accessor :trial_interval_unit - # A string representing the trial interval unit for this product price - # point, either month or day - # @return [String] + # Indicates how a trial is handled when the trail period ends and there is + # no credit card on file. For `no_obligation`, the subscription transitions + # to a Trial Ended state. Maxio will not send any emails or statements. For + # `payment_expected`, the subscription transitions to a Past Due state. + # Maxio will send normal dunning emails and statements according to your + # other settings. + # @return [TrialType] attr_accessor :trial_type # The product price point initial charge, in integer cents @@ -115,6 +119,7 @@ def self.optionals # An array for nullable fields def self.nullables %w[ + trial_type expiration_interval_unit ] end diff --git a/lib/advanced_billing/models/create_signup_proforma_preview_include.rb b/lib/advanced_billing/models/create_signup_proforma_preview_include.rb index d8511a1b..114ebcb0 100644 --- a/lib/advanced_billing/models/create_signup_proforma_preview_include.rb +++ b/lib/advanced_billing/models/create_signup_proforma_preview_include.rb @@ -16,5 +16,11 @@ def self.validate(value) CREATE_SIGNUP_PROFORMA_PREVIEW_INCLUDE.include?(value) end + + def self.from_value(value, default_value = NEXT_PROFORMA_INVOICE) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/create_usage.rb b/lib/advanced_billing/models/create_usage.rb index 48d6466c..1abf9ffd 100644 --- a/lib/advanced_billing/models/create_usage.rb +++ b/lib/advanced_billing/models/create_usage.rb @@ -26,11 +26,15 @@ class CreateUsage < BaseModel # This attribute is particularly useful when you need to align billing # events for different components on distinct schedules within a - # subscription. Please note this only works for site with Multifrequency - # enabled + # subscription. This only works for site with Multifrequency enabled. # @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? @@ -38,6 +42,7 @@ def self.names @_hash['price_point_id'] = 'price_point_id' @_hash['memo'] = 'memo' @_hash['billing_schedule'] = 'billing_schedule' + @_hash['custom_price'] = 'custom_price' @_hash end @@ -48,6 +53,7 @@ def self.optionals price_point_id memo billing_schedule + custom_price ] end @@ -57,7 +63,8 @@ def self.nullables end def initialize(quantity: SKIP, price_point_id: SKIP, memo: 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) @@ -67,6 +74,7 @@ def initialize(quantity: SKIP, price_point_id: SKIP, memo: SKIP, @price_point_id = price_point_id unless price_point_id == SKIP @memo = memo unless memo == 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. @@ -80,6 +88,7 @@ def self.from_hash(hash) memo = hash.key?('memo') ? hash['memo'] : 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) } @@ -89,6 +98,7 @@ def self.from_hash(hash) price_point_id: price_point_id, memo: memo, billing_schedule: billing_schedule, + custom_price: custom_price, additional_properties: additional_properties) end @@ -96,16 +106,16 @@ def self.from_hash(hash) def to_s class_name = self.class.name.split('::').last "<#{class_name} quantity: #{@quantity}, price_point_id: #{@price_point_id}, memo: #{@memo},"\ - " billing_schedule: #{@billing_schedule}, additional_properties:"\ - " #{get_additional_properties}>" + " billing_schedule: #{@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}, price_point_id: #{@price_point_id.inspect},"\ - " memo: #{@memo.inspect}, billing_schedule: #{@billing_schedule.inspect},"\ - " additional_properties: #{get_additional_properties}>" + " memo: #{@memo.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/credit_card_vault.rb b/lib/advanced_billing/models/credit_card_vault.rb index 8e362175..ea284b06 100644 --- a/lib/advanced_billing/models/credit_card_vault.rb +++ b/lib/advanced_billing/models/credit_card_vault.rb @@ -113,5 +113,49 @@ def self.validate(value) CREDIT_CARD_VAULT.include?(value) end + + def self.from_value(value, default_value = ADYEN) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'adyen' then ADYEN + when 'authorizenet' then AUTHORIZENET + when 'beanstream' then BEANSTREAM + when 'blue_snap' then BLUE_SNAP + when 'bogus' then BOGUS + when 'braintree1' then BRAINTREE1 + when 'braintree_blue' then BRAINTREE_BLUE + when 'checkout' then CHECKOUT + when 'cybersource' then CYBERSOURCE + when 'elavon' then ELAVON + when 'eway' then EWAY + when 'eway_rapid' then EWAY_RAPID + when 'eway_rapid_std' then EWAY_RAPID_STD + when 'firstdata' then FIRSTDATA + when 'forte' then FORTE + when 'litle' then LITLE + when 'maxio_payments' then MAXIO_PAYMENTS + when 'maxp' then MAXP + when 'moduslink' then MODUSLINK + when 'moneris' then MONERIS + when 'nmi' then NMI + when 'orbital' then ORBITAL + when 'payment_express' then PAYMENT_EXPRESS + when 'paymill' then PAYMILL + when 'paypal' then PAYPAL + when 'paypal_complete' then PAYPAL_COMPLETE + when 'pin' then PIN + when 'square' then SQUARE + when 'stripe' then STRIPE + when 'stripe_connect' then STRIPE_CONNECT + when 'trust_commerce' then TRUST_COMMERCE + when 'unipaas' then UNIPAAS + when 'wirecard' then WIRECARD + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/credit_note_status.rb b/lib/advanced_billing/models/credit_note_status.rb index f66a4e04..8c666f10 100644 --- a/lib/advanced_billing/models/credit_note_status.rb +++ b/lib/advanced_billing/models/credit_note_status.rb @@ -19,5 +19,18 @@ def self.validate(value) CREDIT_NOTE_STATUS.include?(value) end + + def self.from_value(value, default_value = OPEN) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'open' then OPEN + when 'applied' then APPLIED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/credit_scheme.rb b/lib/advanced_billing/models/credit_scheme.rb index a7db0329..44093e77 100644 --- a/lib/advanced_billing/models/credit_scheme.rb +++ b/lib/advanced_billing/models/credit_scheme.rb @@ -22,5 +22,19 @@ def self.validate(value) CREDIT_SCHEME.include?(value) end + + def self.from_value(value, default_value = NONE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'none' then NONE + when 'credit' then CREDIT + when 'refund' then REFUND + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/credit_type.rb b/lib/advanced_billing/models/credit_type.rb index 76a6c5cf..5b03c3ea 100644 --- a/lib/advanced_billing/models/credit_type.rb +++ b/lib/advanced_billing/models/credit_type.rb @@ -24,5 +24,19 @@ def self.validate(value) 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/currency_price_role.rb b/lib/advanced_billing/models/currency_price_role.rb index 90ef8832..f478c89d 100644 --- a/lib/advanced_billing/models/currency_price_role.rb +++ b/lib/advanced_billing/models/currency_price_role.rb @@ -22,5 +22,19 @@ def self.validate(value) CURRENCY_PRICE_ROLE.include?(value) end + + def self.from_value(value, default_value = BASELINE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'baseline' then BASELINE + when 'trial' then TRIAL + when 'initial' then INITIAL + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/custom_field_owner.rb b/lib/advanced_billing/models/custom_field_owner.rb index f9c27990..c75838eb 100644 --- a/lib/advanced_billing/models/custom_field_owner.rb +++ b/lib/advanced_billing/models/custom_field_owner.rb @@ -19,5 +19,18 @@ def self.validate(value) CUSTOM_FIELD_OWNER.include?(value) end + + def self.from_value(value, default_value = CUSTOMER) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'customer' then CUSTOMER + when 'subscription' then SUBSCRIPTION + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/debit_note_role.rb b/lib/advanced_billing/models/debit_note_role.rb index d4013fd9..7680802a 100644 --- a/lib/advanced_billing/models/debit_note_role.rb +++ b/lib/advanced_billing/models/debit_note_role.rb @@ -19,5 +19,18 @@ def self.validate(value) DEBIT_NOTE_ROLE.include?(value) end + + def self.from_value(value, default_value = CHARGEBACK) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'chargeback' then CHARGEBACK + when 'refund' then REFUND + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/debit_note_status.rb b/lib/advanced_billing/models/debit_note_status.rb index 65751cbd..bcb77177 100644 --- a/lib/advanced_billing/models/debit_note_status.rb +++ b/lib/advanced_billing/models/debit_note_status.rb @@ -25,5 +25,20 @@ def self.validate(value) DEBIT_NOTE_STATUS.include?(value) end + + def self.from_value(value, default_value = OPEN) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'open' then OPEN + when 'applied' then APPLIED + when 'banished' then BANISHED + when 'paid' then PAID + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/direction.rb b/lib/advanced_billing/models/direction.rb index 97a29bed..8a2f86d4 100644 --- a/lib/advanced_billing/models/direction.rb +++ b/lib/advanced_billing/models/direction.rb @@ -19,5 +19,18 @@ def self.validate(value) DIRECTION.include?(value) end + + def self.from_value(value, default_value = ASC) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'asc' then ASC + when 'desc' then DESC + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/discount_type.rb b/lib/advanced_billing/models/discount_type.rb index e91a9ab5..596c157d 100644 --- a/lib/advanced_billing/models/discount_type.rb +++ b/lib/advanced_billing/models/discount_type.rb @@ -19,5 +19,18 @@ def self.validate(value) DISCOUNT_TYPE.include?(value) end + + def self.from_value(value, default_value = AMOUNT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'amount' then AMOUNT + when 'percent' then PERCENT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/ebb_component.rb b/lib/advanced_billing/models/ebb_component.rb index 4509600b..2e0cd938 100644 --- a/lib/advanced_billing/models/ebb_component.rb +++ b/lib/advanced_billing/models/ebb_component.rb @@ -66,8 +66,8 @@ class EBBComponent < BaseModel attr_accessor :unit_price # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/event_key.rb b/lib/advanced_billing/models/event_key.rb index 78422a0b..d0d25279 100644 --- a/lib/advanced_billing/models/event_key.rb +++ b/lib/advanced_billing/models/event_key.rb @@ -260,5 +260,96 @@ def self.validate(value) EVENT_KEY.include?(value) end + + def self.from_value(value, default_value = PAYMENT_SUCCESS) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'payment_success' then PAYMENT_SUCCESS + when 'payment_failure' then PAYMENT_FAILURE + when 'signup_success' then SIGNUP_SUCCESS + when 'signup_failure' then SIGNUP_FAILURE + when 'delayed_signup_creation_success' then DELAYED_SIGNUP_CREATION_SUCCESS + when 'delayed_signup_creation_failure' then DELAYED_SIGNUP_CREATION_FAILURE + when 'billing_date_change' then BILLING_DATE_CHANGE + when 'expiration_date_change' then EXPIRATION_DATE_CHANGE + when 'renewal_success' then RENEWAL_SUCCESS + when 'renewal_failure' then RENEWAL_FAILURE + when 'subscription_state_change' then SUBSCRIPTION_STATE_CHANGE + when 'subscription_product_change' then SUBSCRIPTION_PRODUCT_CHANGE + when 'pending_cancellation_change' then PENDING_CANCELLATION_CHANGE + when 'expiring_card' then EXPIRING_CARD + when 'customer_update' then CUSTOMER_UPDATE + when 'customer_create' then CUSTOMER_CREATE + when 'customer_delete' then CUSTOMER_DELETE + when 'component_allocation_change' then COMPONENT_ALLOCATION_CHANGE + when 'metered_usage' then METERED_USAGE + when 'prepaid_usage' then PREPAID_USAGE + when 'upgrade_downgrade_success' then UPGRADE_DOWNGRADE_SUCCESS + when 'upgrade_downgrade_failure' then UPGRADE_DOWNGRADE_FAILURE + when 'statement_closed' then STATEMENT_CLOSED + when 'statement_settled' then STATEMENT_SETTLED + when 'subscription_card_update' then SUBSCRIPTION_CARD_UPDATE + when 'subscription_group_card_update' then SUBSCRIPTION_GROUP_CARD_UPDATE + when 'subscription_bank_account_update' then SUBSCRIPTION_BANK_ACCOUNT_UPDATE + when 'refund_success' then REFUND_SUCCESS + when 'refund_failure' then REFUND_FAILURE + when 'upcoming_renewal_notice' then UPCOMING_RENEWAL_NOTICE + when 'trial_end_notice' then TRIAL_END_NOTICE + when 'dunning_step_reached' then DUNNING_STEP_REACHED + when 'invoice_issued' then INVOICE_ISSUED + when 'prepaid_subscription_balance_changed' then PREPAID_SUBSCRIPTION_BALANCE_CHANGED + when 'subscription_group_signup_success' then SUBSCRIPTION_GROUP_SIGNUP_SUCCESS + when 'subscription_group_signup_failure' then SUBSCRIPTION_GROUP_SIGNUP_FAILURE + when 'direct_debit_payment_paid_out' then DIRECT_DEBIT_PAYMENT_PAID_OUT + when 'direct_debit_payment_rejected' then DIRECT_DEBIT_PAYMENT_REJECTED + when 'direct_debit_payment_pending' then DIRECT_DEBIT_PAYMENT_PENDING + when 'pending_payment_created' then PENDING_PAYMENT_CREATED + when 'pending_payment_failed' then PENDING_PAYMENT_FAILED + when 'pending_payment_completed' then PENDING_PAYMENT_COMPLETED + when 'proforma_invoice_issued' then PROFORMA_INVOICE_ISSUED + when 'subscription_prepayment_account_balance_changed' then SUBSCRIPTION_PREPAYMENT_ACCOUNT_BALANCE_CHANGED + when 'subscription_service_credit_account_balance_changed' then SUBSCRIPTION_SERVICE_CREDIT_ACCOUNT_BALANCE_CHANGED + when 'custom_field_value_change' then CUSTOM_FIELD_VALUE_CHANGE + when 'item_price_point_changed' then ITEM_PRICE_POINT_CHANGED + when 'renewal_success_recreated' then RENEWAL_SUCCESS_RECREATED + when 'renewal_failure_recreated' then RENEWAL_FAILURE_RECREATED + when 'payment_success_recreated' then PAYMENT_SUCCESS_RECREATED + when 'payment_failure_recreated' then PAYMENT_FAILURE_RECREATED + when 'subscription_deletion' then SUBSCRIPTION_DELETION + when 'subscription_group_bank_account_update' then SUBSCRIPTION_GROUP_BANK_ACCOUNT_UPDATE + when 'subscription_paypal_account_update' then SUBSCRIPTION_PAYPAL_ACCOUNT_UPDATE + when 'subscription_group_paypal_account_update' then SUBSCRIPTION_GROUP_PAYPAL_ACCOUNT_UPDATE + when 'subscription_customer_change' then SUBSCRIPTION_CUSTOMER_CHANGE + when 'account_transaction_changed' then ACCOUNT_TRANSACTION_CHANGED + when 'go_cardless_payment_paid_out' then GO_CARDLESS_PAYMENT_PAID_OUT + when 'go_cardless_payment_rejected' then GO_CARDLESS_PAYMENT_REJECTED + when 'go_cardless_payment_pending' then GO_CARDLESS_PAYMENT_PENDING + when 'stripe_direct_debit_payment_paid_out' then STRIPE_DIRECT_DEBIT_PAYMENT_PAID_OUT + when 'stripe_direct_debit_payment_rejected' then STRIPE_DIRECT_DEBIT_PAYMENT_REJECTED + when 'stripe_direct_debit_payment_pending' then STRIPE_DIRECT_DEBIT_PAYMENT_PENDING + when 'maxio_payments_direct_debit_payment_paid_out' then MAXIO_PAYMENTS_DIRECT_DEBIT_PAYMENT_PAID_OUT + when 'maxio_payments_direct_debit_payment_rejected' then MAXIO_PAYMENTS_DIRECT_DEBIT_PAYMENT_REJECTED + when 'maxio_payments_direct_debit_payment_pending' then MAXIO_PAYMENTS_DIRECT_DEBIT_PAYMENT_PENDING + when 'invoice_in_collections_canceled' then INVOICE_IN_COLLECTIONS_CANCELED + when 'subscription_added_to_group' then SUBSCRIPTION_ADDED_TO_GROUP + when 'subscription_removed_from_group' then SUBSCRIPTION_REMOVED_FROM_GROUP + when 'chargeback_opened' then CHARGEBACK_OPENED + when 'chargeback_lost' then CHARGEBACK_LOST + when 'chargeback_accepted' then CHARGEBACK_ACCEPTED + when 'chargeback_closed' then CHARGEBACK_CLOSED + when 'chargeback_won' then CHARGEBACK_WON + when 'payment_collection_method_changed' then PAYMENT_COLLECTION_METHOD_CHANGED + when 'component_billing_date_changed' then COMPONENT_BILLING_DATE_CHANGED + when 'subscription_term_renewal_scheduled' then SUBSCRIPTION_TERM_RENEWAL_SCHEDULED + when 'subscription_term_renewal_pending' then SUBSCRIPTION_TERM_RENEWAL_PENDING + when 'subscription_term_renewal_activated' then SUBSCRIPTION_TERM_RENEWAL_ACTIVATED + when 'subscription_term_renewal_removed' then SUBSCRIPTION_TERM_RENEWAL_REMOVED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/expiration_interval_unit.rb b/lib/advanced_billing/models/expiration_interval_unit.rb index 4b961fa1..8a1f1689 100644 --- a/lib/advanced_billing/models/expiration_interval_unit.rb +++ b/lib/advanced_billing/models/expiration_interval_unit.rb @@ -22,5 +22,19 @@ def self.validate(value) EXPIRATION_INTERVAL_UNIT.include?(value) end + + def self.from_value(value, default_value = DAY) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'day' then DAY + when 'month' then MONTH + when 'never' then NEVER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/failed_payment_action.rb b/lib/advanced_billing/models/failed_payment_action.rb index 18fc7668..c96d1e25 100644 --- a/lib/advanced_billing/models/failed_payment_action.rb +++ b/lib/advanced_billing/models/failed_payment_action.rb @@ -33,5 +33,19 @@ def self.validate(value) FAILED_PAYMENT_ACTION.include?(value) end + + def self.from_value(value, default_value = LEAVE_OPEN_INVOICE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'leave_open_invoice' then LEAVE_OPEN_INVOICE + when 'rollback_to_pending' then ROLLBACK_TO_PENDING + when 'initiate_dunning' then INITIATE_DUNNING + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/first_charge_type.rb b/lib/advanced_billing/models/first_charge_type.rb index b808255a..f8043e0f 100644 --- a/lib/advanced_billing/models/first_charge_type.rb +++ b/lib/advanced_billing/models/first_charge_type.rb @@ -22,5 +22,19 @@ def self.validate(value) FIRST_CHARGE_TYPE.include?(value) end + + def self.from_value(value, default_value = PRORATED) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'prorated' then PRORATED + when 'immediate' then IMMEDIATE + when 'delayed' then DELAYED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/group_target_type.rb b/lib/advanced_billing/models/group_target_type.rb index 5c4f530b..401276e8 100644 --- a/lib/advanced_billing/models/group_target_type.rb +++ b/lib/advanced_billing/models/group_target_type.rb @@ -28,5 +28,21 @@ def self.validate(value) GROUP_TARGET_TYPE.include?(value) end + + def self.from_value(value, default_value = CUSTOMER) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'customer' then CUSTOMER + when 'subscription' then SUBSCRIPTION + when 'enum_self' then ENUM_SELF + when 'parent' then PARENT + when 'eldest' then ELDEST + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/group_type.rb b/lib/advanced_billing/models/group_type.rb index 3a8ecbf6..7de3b8ef 100644 --- a/lib/advanced_billing/models/group_type.rb +++ b/lib/advanced_billing/models/group_type.rb @@ -19,5 +19,18 @@ def self.validate(value) GROUP_TYPE.include?(value) end + + def self.from_value(value, default_value = SINGLE_CUSTOMER) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'single_customer' then SINGLE_CUSTOMER + when 'multiple_customers' then MULTIPLE_CUSTOMERS + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/include_not_null.rb b/lib/advanced_billing/models/include_not_null.rb index 424d3fad..33e23eed 100644 --- a/lib/advanced_billing/models/include_not_null.rb +++ b/lib/advanced_billing/models/include_not_null.rb @@ -16,5 +16,11 @@ def self.validate(value) INCLUDE_NOT_NULL.include?(value) end + + def self.from_value(value, default_value = NOT_NULL) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/include_null_or_not_null.rb b/lib/advanced_billing/models/include_null_or_not_null.rb index 4237bbb3..3d406485 100644 --- a/lib/advanced_billing/models/include_null_or_not_null.rb +++ b/lib/advanced_billing/models/include_null_or_not_null.rb @@ -19,5 +19,18 @@ def self.validate(value) INCLUDE_NULL_OR_NOT_NULL.include?(value) end + + def self.from_value(value, default_value = NOT_NULL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'not_null' then NOT_NULL + when 'null' then NULL + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/include_option.rb b/lib/advanced_billing/models/include_option.rb index 331311e4..fae50077 100644 --- a/lib/advanced_billing/models/include_option.rb +++ b/lib/advanced_billing/models/include_option.rb @@ -19,5 +19,18 @@ def self.validate(value) INCLUDE_OPTION.include?(value) end + + def self.from_value(value, default_value = EXCLUDE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'exclude' then EXCLUDE + when 'include' then INCLUDE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/interval_unit.rb b/lib/advanced_billing/models/interval_unit.rb index 955f6cd9..f29ae501 100644 --- a/lib/advanced_billing/models/interval_unit.rb +++ b/lib/advanced_billing/models/interval_unit.rb @@ -19,5 +19,18 @@ def self.validate(value) INTERVAL_UNIT.include?(value) end + + def self.from_value(value, default_value = DAY) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'day' then DAY + when 'month' then MONTH + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_consolidation_level.rb b/lib/advanced_billing/models/invoice_consolidation_level.rb index 49704543..99f8f20d 100644 --- a/lib/advanced_billing/models/invoice_consolidation_level.rb +++ b/lib/advanced_billing/models/invoice_consolidation_level.rb @@ -30,5 +30,19 @@ def self.validate(value) INVOICE_CONSOLIDATION_LEVEL.include?(value) end + + def self.from_value(value, default_value = NONE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'none' then NONE + when 'child' then CHILD + when 'parent' then PARENT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_date_field.rb b/lib/advanced_billing/models/invoice_date_field.rb index 78513bfd..76a19cda 100644 --- a/lib/advanced_billing/models/invoice_date_field.rb +++ b/lib/advanced_billing/models/invoice_date_field.rb @@ -28,5 +28,21 @@ def self.validate(value) INVOICE_DATE_FIELD.include?(value) end + + def self.from_value(value, default_value = CREATED_AT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'created_at' then CREATED_AT + when 'due_date' then DUE_DATE + when 'issue_date' then ISSUE_DATE + when 'updated_at' then UPDATED_AT + when 'paid_date' then PAID_DATE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_discount_source_type.rb b/lib/advanced_billing/models/invoice_discount_source_type.rb index 4995104e..94ac4703 100644 --- a/lib/advanced_billing/models/invoice_discount_source_type.rb +++ b/lib/advanced_billing/models/invoice_discount_source_type.rb @@ -22,5 +22,19 @@ def self.validate(value) INVOICE_DISCOUNT_SOURCE_TYPE.include?(value) end + + def self.from_value(value, default_value = COUPON) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'coupon' then COUPON + when 'referral' then REFERRAL + when 'enum_ad_hoc_coupon' then ENUM_AD_HOC_COUPON + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_discount_type.rb b/lib/advanced_billing/models/invoice_discount_type.rb index b97c84d7..b307044b 100644 --- a/lib/advanced_billing/models/invoice_discount_type.rb +++ b/lib/advanced_billing/models/invoice_discount_type.rb @@ -22,5 +22,19 @@ def self.validate(value) INVOICE_DISCOUNT_TYPE.include?(value) end + + def self.from_value(value, default_value = PERCENTAGE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'percentage' then PERCENTAGE + when 'flat_amount' then FLAT_AMOUNT + when 'rollover' then ROLLOVER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_event_payment_method.rb b/lib/advanced_billing/models/invoice_event_payment_method.rb index 4b4b5695..7a025199 100644 --- a/lib/advanced_billing/models/invoice_event_payment_method.rb +++ b/lib/advanced_billing/models/invoice_event_payment_method.rb @@ -28,5 +28,21 @@ def self.validate(value) INVOICE_EVENT_PAYMENT_METHOD.include?(value) end + + def self.from_value(value, default_value = APPLE_PAY) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'apple_pay' then APPLE_PAY + when 'bank_account' then BANK_ACCOUNT + when 'credit_card' then CREDIT_CARD + when 'external' then EXTERNAL + when 'paypal_account' then PAYPAL_ACCOUNT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_event_type.rb b/lib/advanced_billing/models/invoice_event_type.rb index ed544c87..e38a9952 100644 --- a/lib/advanced_billing/models/invoice_event_type.rb +++ b/lib/advanced_billing/models/invoice_event_type.rb @@ -58,5 +58,31 @@ def self.validate(value) INVOICE_EVENT_TYPE.include?(value) end + + def self.from_value(value, default_value = ISSUE_INVOICE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'issue_invoice' then ISSUE_INVOICE + when 'apply_credit_note' then APPLY_CREDIT_NOTE + when 'create_credit_note' then CREATE_CREDIT_NOTE + when 'apply_payment' then APPLY_PAYMENT + when 'apply_debit_note' then APPLY_DEBIT_NOTE + when 'create_debit_note' then CREATE_DEBIT_NOTE + when 'refund_invoice' then REFUND_INVOICE + when 'void_invoice' then VOID_INVOICE + when 'void_remainder' then VOID_REMAINDER + when 'backport_invoice' then BACKPORT_INVOICE + when 'change_invoice_status' then CHANGE_INVOICE_STATUS + when 'change_invoice_collection_method' then CHANGE_INVOICE_COLLECTION_METHOD + when 'remove_payment' then REMOVE_PAYMENT + when 'failed_payment' then FAILED_PAYMENT + when 'change_chargeback_status' then CHANGE_CHARGEBACK_STATUS + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_payment_method_type.rb b/lib/advanced_billing/models/invoice_payment_method_type.rb index cee400b1..6cbee1a6 100644 --- a/lib/advanced_billing/models/invoice_payment_method_type.rb +++ b/lib/advanced_billing/models/invoice_payment_method_type.rb @@ -31,5 +31,22 @@ def self.validate(value) INVOICE_PAYMENT_METHOD_TYPE.include?(value) end + + def self.from_value(value, default_value = CREDIT_CARD) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'credit_card' then CREDIT_CARD + when 'check' then CHECK + when 'cash' then CASH + when 'money_order' then MONEY_ORDER + when 'ach' then ACH + when 'other' then OTHER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_payment_type.rb b/lib/advanced_billing/models/invoice_payment_type.rb index b8d7325a..5f60cf68 100644 --- a/lib/advanced_billing/models/invoice_payment_type.rb +++ b/lib/advanced_billing/models/invoice_payment_type.rb @@ -25,5 +25,20 @@ def self.validate(value) INVOICE_PAYMENT_TYPE.include?(value) end + + def self.from_value(value, default_value = EXTERNAL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'external' then EXTERNAL + when 'prepayment' then PREPAYMENT + when 'service_credit' then SERVICE_CREDIT + when 'payment' then PAYMENT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_role.rb b/lib/advanced_billing/models/invoice_role.rb index 95fea6d7..a4a477d3 100644 --- a/lib/advanced_billing/models/invoice_role.rb +++ b/lib/advanced_billing/models/invoice_role.rb @@ -43,5 +43,26 @@ def self.validate(value) INVOICE_ROLE.include?(value) end + + def self.from_value(value, default_value = UNSET) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'unset' then UNSET + when 'signup' then SIGNUP + when 'renewal' then RENEWAL + when 'usage' then USAGE + when 'reactivation' then REACTIVATION + when 'proration' then PRORATION + when 'migration' then MIGRATION + when 'adhoc' then ADHOC + when 'backport' then BACKPORT + when 'backportbalancereconciliation' then BACKPORTBALANCERECONCILIATION + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_sort_field.rb b/lib/advanced_billing/models/invoice_sort_field.rb index 4a157d27..1fb6b7d3 100644 --- a/lib/advanced_billing/models/invoice_sort_field.rb +++ b/lib/advanced_billing/models/invoice_sort_field.rb @@ -37,5 +37,24 @@ def self.validate(value) INVOICE_SORT_FIELD.include?(value) end + + def self.from_value(value, default_value = STATUS) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'status' then STATUS + when 'total_amount' then TOTAL_AMOUNT + when 'due_amount' then DUE_AMOUNT + when 'created_at' then CREATED_AT + when 'updated_at' then UPDATED_AT + when 'issue_date' then ISSUE_DATE + when 'due_date' then DUE_DATE + when 'number' then NUMBER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/invoice_status.rb b/lib/advanced_billing/models/invoice_status.rb index 494764b9..4aae4afa 100644 --- a/lib/advanced_billing/models/invoice_status.rb +++ b/lib/advanced_billing/models/invoice_status.rb @@ -36,5 +36,23 @@ def self.validate(value) INVOICE_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 'open' then OPEN + when 'paid' then PAID + when 'pending' then PENDING + when 'voided' then VOIDED + when 'canceled' then CANCELED + when 'processing' then PROCESSING + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/item_category.rb b/lib/advanced_billing/models/item_category.rb index 95d9267f..afd0e12e 100644 --- a/lib/advanced_billing/models/item_category.rb +++ b/lib/advanced_billing/models/item_category.rb @@ -29,5 +29,21 @@ def self.validate(value) ITEM_CATEGORY.include?(value) end + + def self.from_value(value, default_value = ENUM_BUSINESS_SOFTWARE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'enum_business_software' then ENUM_BUSINESS_SOFTWARE + when 'enum_consumer_software' then ENUM_CONSUMER_SOFTWARE + when 'enum_digital_services' then ENUM_DIGITAL_SERVICES + when 'enum_physical_goods' then ENUM_PHYSICAL_GOODS + when 'other' then OTHER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/line_item_kind.rb b/lib/advanced_billing/models/line_item_kind.rb index df54f572..b2a952e1 100644 --- a/lib/advanced_billing/models/line_item_kind.rb +++ b/lib/advanced_billing/models/line_item_kind.rb @@ -43,5 +43,26 @@ def self.validate(value) LINE_ITEM_KIND.include?(value) end + + def self.from_value(value, default_value = BASELINE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'baseline' then BASELINE + when 'initial' then INITIAL + when 'trial' then TRIAL + when 'quantity_based_component' then QUANTITY_BASED_COMPONENT + when 'prepaid_usage_component' then PREPAID_USAGE_COMPONENT + when 'on_off_component' then ON_OFF_COMPONENT + when 'metered_component' then METERED_COMPONENT + when 'event_based_component' then EVENT_BASED_COMPONENT + when 'coupon' then COUPON + when 'tax' then TAX + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/line_item_transaction_type.rb b/lib/advanced_billing/models/line_item_transaction_type.rb index b91411d4..c91122fe 100644 --- a/lib/advanced_billing/models/line_item_transaction_type.rb +++ b/lib/advanced_billing/models/line_item_transaction_type.rb @@ -34,5 +34,23 @@ def self.validate(value) LINE_ITEM_TRANSACTION_TYPE.include?(value) end + + def self.from_value(value, default_value = CHARGE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'charge' then CHARGE + when 'credit' then CREDIT + when 'adjustment' then ADJUSTMENT + when 'payment' then PAYMENT + when 'refund' then REFUND + when 'info_transaction' then INFO_TRANSACTION + when 'payment_authorization' then PAYMENT_AUTHORIZATION + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/list_components_price_points_include.rb b/lib/advanced_billing/models/list_components_price_points_include.rb index d6661073..8ea500f8 100644 --- a/lib/advanced_billing/models/list_components_price_points_include.rb +++ b/lib/advanced_billing/models/list_components_price_points_include.rb @@ -16,5 +16,11 @@ def self.validate(value) LIST_COMPONENTS_PRICE_POINTS_INCLUDE.include?(value) end + + def self.from_value(value, default_value = CURRENCY_PRICES) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/list_coupons_filter.rb b/lib/advanced_billing/models/list_coupons_filter.rb index 4a6fef7e..1aa2c39b 100644 --- a/lib/advanced_billing/models/list_coupons_filter.rb +++ b/lib/advanced_billing/models/list_coupons_filter.rb @@ -57,11 +57,20 @@ class ListCouponsFilter < BaseModel # @return [Array[String]] attr_accessor :codes - # Allows fetching coupons with matching use_site_exchange_rate based on - # provided value. Use in query `filter[use_site_exchange_rate]=true`. + # If true, restricts the list to coupons whose pricing is recalculated from + # the site’s current exchange rates, so their currency_prices array contains + # on-the-fly conversions rather than stored price records. If false, + # restricts the list to coupons that have manually defined amounts for each + # currency, ensuring the response includes the saved currency_prices entries + # instead of exchange-rate-derived values. Use in query + # `filter[use_site_exchange_rate]=true`. # @return [TrueClass | FalseClass] attr_accessor :use_site_exchange_rate + # Controls returning archived coupons. + # @return [TrueClass | FalseClass] + attr_accessor :include_archived + # A mapping from model property names to API property names. def self.names @_hash = {} if @_hash.nil? @@ -73,6 +82,7 @@ def self.names @_hash['ids'] = 'ids' @_hash['codes'] = 'codes' @_hash['use_site_exchange_rate'] = 'use_site_exchange_rate' + @_hash['include_archived'] = 'include_archived' @_hash end @@ -87,6 +97,7 @@ def self.optionals ids codes use_site_exchange_rate + include_archived ] end @@ -98,7 +109,7 @@ def self.nullables def initialize(date_field: SKIP, start_date: SKIP, end_date: SKIP, start_datetime: SKIP, end_datetime: SKIP, ids: SKIP, codes: SKIP, use_site_exchange_rate: SKIP, - additional_properties: {}) + include_archived: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) @@ -112,6 +123,7 @@ def initialize(date_field: SKIP, start_date: SKIP, end_date: SKIP, @ids = ids unless ids == SKIP @codes = codes unless codes == SKIP @use_site_exchange_rate = use_site_exchange_rate unless use_site_exchange_rate == SKIP + @include_archived = include_archived unless include_archived == SKIP end # Creates an instance of the object from a hash. @@ -136,6 +148,8 @@ def self.from_hash(hash) codes = hash.key?('codes') ? hash['codes'] : SKIP use_site_exchange_rate = hash.key?('use_site_exchange_rate') ? hash['use_site_exchange_rate'] : SKIP + include_archived = + hash.key?('include_archived') ? hash['include_archived'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } @@ -149,6 +163,7 @@ def self.from_hash(hash) ids: ids, codes: codes, use_site_exchange_rate: use_site_exchange_rate, + include_archived: include_archived, additional_properties: additional_properties) end @@ -166,7 +181,8 @@ def to_s "<#{class_name} date_field: #{@date_field}, start_date: #{@start_date}, end_date:"\ " #{@end_date}, start_datetime: #{@start_datetime}, end_datetime: #{@end_datetime}, ids:"\ " #{@ids}, codes: #{@codes}, use_site_exchange_rate: #{@use_site_exchange_rate},"\ - " additional_properties: #{get_additional_properties}>" + " include_archived: #{@include_archived}, additional_properties:"\ + " #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. @@ -175,8 +191,8 @@ def inspect "<#{class_name} date_field: #{@date_field.inspect}, start_date: #{@start_date.inspect},"\ " end_date: #{@end_date.inspect}, start_datetime: #{@start_datetime.inspect}, end_datetime:"\ " #{@end_datetime.inspect}, ids: #{@ids.inspect}, codes: #{@codes.inspect},"\ - " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, additional_properties:"\ - " #{get_additional_properties}>" + " use_site_exchange_rate: #{@use_site_exchange_rate.inspect}, include_archived:"\ + " #{@include_archived.inspect}, additional_properties: #{get_additional_properties}>" end end end diff --git a/lib/advanced_billing/models/list_events_date_field.rb b/lib/advanced_billing/models/list_events_date_field.rb index 94c3435c..708cc674 100644 --- a/lib/advanced_billing/models/list_events_date_field.rb +++ b/lib/advanced_billing/models/list_events_date_field.rb @@ -16,5 +16,11 @@ def self.validate(value) LIST_EVENTS_DATE_FIELD.include?(value) end + + def self.from_value(value, default_value = CREATED_AT) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/list_prepayment_date_field.rb b/lib/advanced_billing/models/list_prepayment_date_field.rb index c62e059e..79ff7cd9 100644 --- a/lib/advanced_billing/models/list_prepayment_date_field.rb +++ b/lib/advanced_billing/models/list_prepayment_date_field.rb @@ -19,5 +19,18 @@ def self.validate(value) LIST_PREPAYMENT_DATE_FIELD.include?(value) end + + def self.from_value(value, default_value = CREATED_AT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'created_at' then CREATED_AT + when 'application_at' then APPLICATION_AT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/list_products_include.rb b/lib/advanced_billing/models/list_products_include.rb index b0df9ea4..7d39d5c3 100644 --- a/lib/advanced_billing/models/list_products_include.rb +++ b/lib/advanced_billing/models/list_products_include.rb @@ -16,5 +16,11 @@ def self.validate(value) LIST_PRODUCTS_INCLUDE.include?(value) end + + def self.from_value(value, default_value = PREPAID_PRODUCT_PRICE_POINT) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/list_products_price_points_include.rb b/lib/advanced_billing/models/list_products_price_points_include.rb index 636b545f..76061e30 100644 --- a/lib/advanced_billing/models/list_products_price_points_include.rb +++ b/lib/advanced_billing/models/list_products_price_points_include.rb @@ -16,5 +16,11 @@ def self.validate(value) LIST_PRODUCTS_PRICE_POINTS_INCLUDE.include?(value) end + + def self.from_value(value, default_value = CURRENCY_PRICES) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/list_subscription_components_include.rb b/lib/advanced_billing/models/list_subscription_components_include.rb index 0efbb99d..8187a29f 100644 --- a/lib/advanced_billing/models/list_subscription_components_include.rb +++ b/lib/advanced_billing/models/list_subscription_components_include.rb @@ -19,5 +19,18 @@ def self.validate(value) LIST_SUBSCRIPTION_COMPONENTS_INCLUDE.include?(value) end + + def self.from_value(value, default_value = SUBSCRIPTION) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'subscription' then SUBSCRIPTION + when 'historic_usages' then HISTORIC_USAGES + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/list_subscription_components_sort.rb b/lib/advanced_billing/models/list_subscription_components_sort.rb index 344bc5f7..54488b26 100644 --- a/lib/advanced_billing/models/list_subscription_components_sort.rb +++ b/lib/advanced_billing/models/list_subscription_components_sort.rb @@ -19,5 +19,18 @@ def self.validate(value) LIST_SUBSCRIPTION_COMPONENTS_SORT.include?(value) end + + def self.from_value(value, default_value = ID) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'id' then ID + when 'updated_at' then UPDATED_AT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/metafield.rb b/lib/advanced_billing/models/metafield.rb index 60aac36e..c91347fa 100644 --- a/lib/advanced_billing/models/metafield.rb +++ b/lib/advanced_billing/models/metafield.rb @@ -23,23 +23,20 @@ class Metafield < BaseModel # @return [MetafieldScope] attr_accessor :scope - # the amount of subscriptions this metafield has been applied to in Chargify + # The amount of subscriptions this metafield has been applied to in Advanced + # Billing. # @return [Integer] attr_accessor :data_count - # Indicates how data should be added to the metafield. For example, a text - # type is just a string, so a given metafield of this type can have any - # value attached. On the other hand, dropdown and radio have a set of - # allowed values that can be input, and appear differently on a Public - # Signup Page. Defaults to 'text' + # Indicates the type of metafield. A text metafield allows any string value. + # Dropdown and radio metafields have a set of values that can be selected. + # Defaults to 'text'. # @return [MetafieldInput] attr_accessor :input_type - # Indicates how data should be added to the metafield. For example, a text - # type is just a string, so a given metafield of this type can have any - # value attached. On the other hand, dropdown and radio have a set of - # allowed values that can be input, and appear differently on a Public - # Signup Page. Defaults to 'text' + # Indicates the type of metafield. A text metafield allows any string value. + # Dropdown and radio metafields have a set of values that can be selected. + # Defaults to 'text'. # @return [Object] attr_accessor :enum diff --git a/lib/advanced_billing/models/metafield_input.rb b/lib/advanced_billing/models/metafield_input.rb index 8a01a0e7..ab2169de 100644 --- a/lib/advanced_billing/models/metafield_input.rb +++ b/lib/advanced_billing/models/metafield_input.rb @@ -4,11 +4,9 @@ # APIMATIC v3.0 ( https://www.apimatic.io ). module AdvancedBilling - # Indicates how data should be added to the metafield. For example, a text - # type is just a string, so a given metafield of this type can have any value - # attached. On the other hand, dropdown and radio have a set of allowed values - # that can be input, and appear differently on a Public Signup Page. Defaults - # to 'text' + # Indicates the type of metafield. A text metafield allows any string value. + # Dropdown and radio metafields have a set of values that can be selected. + # Defaults to 'text'. class MetafieldInput METAFIELD_INPUT = [ # TODO: Write general description for BALANCE_TRACKER @@ -29,5 +27,20 @@ def self.validate(value) METAFIELD_INPUT.include?(value) end + + def self.from_value(value, default_value = BALANCE_TRACKER) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'balance_tracker' then BALANCE_TRACKER + when 'text' then TEXT + when 'radio' then RADIO + when 'dropdown' then DROPDOWN + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/metafield_scope.rb b/lib/advanced_billing/models/metafield_scope.rb index ff9799cd..6346baaf 100644 --- a/lib/advanced_billing/models/metafield_scope.rb +++ b/lib/advanced_billing/models/metafield_scope.rb @@ -27,16 +27,21 @@ class MetafieldScope < BaseModel # @return [IncludeOption] attr_accessor :portal - # Include (1) or exclude (0) metafields from being viewable by your - # ecosystem. + # Include (1) or exclude (0) metafields used in [Embeddable + # Components](page:development-tools/embeddable-components/overview) from + # being viewable by your ecosystem. # @return [IncludeOption] attr_accessor :public_show - # Include (1) or exclude (0) metafields from being edited by your ecosystem. + # Include (1) or exclude (0) metafields used in [Embeddable + # Components](page:development-tools/embeddable-components/overview) from + # being editable by your ecosystem. # @return [IncludeOption] attr_accessor :public_edit - # Include (1) or exclude (0) metafields from being edited by your ecosystem. + # Include (1) or exclude (0) metafields used in [Embeddable + # Components](page:development-tools/embeddable-components/overview) from + # being editable by your ecosystem. # @return [Array[String]] attr_accessor :hosted diff --git a/lib/advanced_billing/models/metered_component.rb b/lib/advanced_billing/models/metered_component.rb index 3a6df3e5..f6fd5ea7 100644 --- a/lib/advanced_billing/models/metered_component.rb +++ b/lib/advanced_billing/models/metered_component.rb @@ -68,8 +68,8 @@ class MeteredComponent < BaseModel attr_accessor :unit_price # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/nested_subscription_group.rb b/lib/advanced_billing/models/nested_subscription_group.rb index bcaff07b..1a29a3d6 100644 --- a/lib/advanced_billing/models/nested_subscription_group.rb +++ b/lib/advanced_billing/models/nested_subscription_group.rb @@ -88,6 +88,16 @@ 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 d8c4d522..b521fb0e 100644 --- a/lib/advanced_billing/models/on_off_component.rb +++ b/lib/advanced_billing/models/on_off_component.rb @@ -55,8 +55,8 @@ class OnOffComponent < BaseModel attr_accessor :unit_price # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/pay_pal_vault.rb b/lib/advanced_billing/models/pay_pal_vault.rb index d8c41cd6..97edac7e 100644 --- a/lib/advanced_billing/models/pay_pal_vault.rb +++ b/lib/advanced_billing/models/pay_pal_vault.rb @@ -25,5 +25,20 @@ def self.validate(value) PAY_PAL_VAULT.include?(value) end + + def self.from_value(value, default_value = BRAINTREE_BLUE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'braintree_blue' then BRAINTREE_BLUE + when 'paypal' then PAYPAL + when 'moduslink' then MODUSLINK + when 'paypal_complete' then PAYPAL_COMPLETE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/payment_profile_attributes.rb b/lib/advanced_billing/models/payment_profile_attributes.rb index a600d1c1..30204350 100644 --- a/lib/advanced_billing/models/payment_profile_attributes.rb +++ b/lib/advanced_billing/models/payment_profile_attributes.rb @@ -94,9 +94,9 @@ class PaymentProfileAttributes < BaseModel # required in [ISO_3166-1 # alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. # “US”). This value is merely passed through to the payment gateway. Some - # gateways require country codes in a specific format. Please check your - # gateway’s documentation. If creating an ACH subscription, only US is - # supported at this time. + # gateways require country codes in a specific format. Check your gateway’s + # documentation. If creating an ACH subscription, only US is supported at + # this time. # @return [String] attr_accessor :billing_country diff --git a/lib/advanced_billing/models/payment_type.rb b/lib/advanced_billing/models/payment_type.rb index d0d3e32b..b18a864c 100644 --- a/lib/advanced_billing/models/payment_type.rb +++ b/lib/advanced_billing/models/payment_type.rb @@ -25,5 +25,20 @@ def self.validate(value) PAYMENT_TYPE.include?(value) end + + def self.from_value(value, default_value = CREDIT_CARD) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'credit_card' then CREDIT_CARD + when 'bank_account' then BANK_ACCOUNT + when 'paypal_account' then PAYPAL_ACCOUNT + when 'apple_pay' then APPLE_PAY + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/prepaid_configuration.rb b/lib/advanced_billing/models/prepaid_configuration.rb index 090626e5..37316695 100644 --- a/lib/advanced_billing/models/prepaid_configuration.rb +++ b/lib/advanced_billing/models/prepaid_configuration.rb @@ -110,6 +110,16 @@ 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 235325bd..80e3bae0 100644 --- a/lib/advanced_billing/models/prepaid_usage_component.rb +++ b/lib/advanced_billing/models/prepaid_usage_component.rb @@ -78,8 +78,8 @@ class PrepaidUsageComponent < BaseModel attr_accessor :unit_price # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/prepayment_method.rb b/lib/advanced_billing/models/prepayment_method.rb index 3e37e173..94bb4628 100644 --- a/lib/advanced_billing/models/prepayment_method.rb +++ b/lib/advanced_billing/models/prepayment_method.rb @@ -34,5 +34,23 @@ def self.validate(value) PREPAYMENT_METHOD.include?(value) end + + def self.from_value(value, default_value = CHECK) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'check' then CHECK + when 'cash' then CASH + when 'money_order' then MONEY_ORDER + when 'ach' then ACH + when 'paypal_account' then PAYPAL_ACCOUNT + when 'credit_card' then CREDIT_CARD + when 'other' then OTHER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/price_point_type.rb b/lib/advanced_billing/models/price_point_type.rb index 4c7c2abe..7996f9ff 100644 --- a/lib/advanced_billing/models/price_point_type.rb +++ b/lib/advanced_billing/models/price_point_type.rb @@ -26,5 +26,19 @@ def self.validate(value) PRICE_POINT_TYPE.include?(value) end + + def self.from_value(value, default_value = CATALOG) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'catalog' then CATALOG + when 'default' then DEFAULT + when 'custom' then CUSTOM + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/pricing_scheme.rb b/lib/advanced_billing/models/pricing_scheme.rb index 67f3f817..20377532 100644 --- a/lib/advanced_billing/models/pricing_scheme.rb +++ b/lib/advanced_billing/models/pricing_scheme.rb @@ -27,5 +27,20 @@ def self.validate(value) PRICING_SCHEME.include?(value) end + + def self.from_value(value, default_value = STAIRSTEP) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'stairstep' then STAIRSTEP + when 'volume' then VOLUME + when 'per_unit' then PER_UNIT + when 'tiered' then TIERED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/product.rb b/lib/advanced_billing/models/product.rb index 822cf221..625450c2 100644 --- a/lib/advanced_billing/models/product.rb +++ b/lib/advanced_billing/models/product.rb @@ -31,8 +31,8 @@ class Product < BaseModel attr_accessor :accounting_code # Deprecated value that can be ignored unless you have legacy hosted pages. - # For Public Signup Page users, please read this attribute from under the - # signup page. + # For Public Signup Page users, read this attribute from under the signup + # page. # @return [TrueClass | FalseClass] attr_accessor :request_credit_card @@ -167,20 +167,20 @@ class Product < BaseModel attr_accessor :require_shipping_address # A string representing the tax code related to the product type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code # A string representing the tax code related to the product type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [Integer] attr_accessor :default_product_price_point_id # A string representing the tax code related to the product type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [TrueClass | FalseClass] attr_accessor :use_site_exchange_rate @@ -523,6 +523,16 @@ 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 eb9b03a1..cc652fab 100644 --- a/lib/advanced_billing/models/product_family.rb +++ b/lib/advanced_billing/models/product_family.rb @@ -133,6 +133,16 @@ 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 + 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_price_point.rb b/lib/advanced_billing/models/product_price_point.rb index c016eb14..f41f85f2 100644 --- a/lib/advanced_billing/models/product_price_point.rb +++ b/lib/advanced_billing/models/product_price_point.rb @@ -52,9 +52,13 @@ class ProductPricePoint < BaseModel # @return [IntervalUnit] attr_accessor :trial_interval_unit - # A string representing the trial interval unit for this product price - # point, either month or day - # @return [String] + # Indicates how a trial is handled when the trail period ends and there is + # no credit card on file. For `no_obligation`, the subscription transitions + # to a Trial Ended state. Maxio will not send any emails or statements. For + # `payment_expected`, the subscription transitions to a Past Due state. + # Maxio will send normal dunning emails and statements according to your + # other settings. + # @return [TrialType] attr_accessor :trial_type # reserved for future use @@ -188,6 +192,7 @@ def self.nullables trial_price_in_cents trial_interval trial_interval_unit + trial_type introductory_offer initial_charge_in_cents initial_charge_after_trial diff --git a/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb b/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb index 3ee466e3..bf134a50 100644 --- a/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb +++ b/lib/advanced_billing/models/proforma_invoice_discount_source_type.rb @@ -19,5 +19,18 @@ def self.validate(value) PROFORMA_INVOICE_DISCOUNT_SOURCE_TYPE.include?(value) end + + def self.from_value(value, default_value = COUPON) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'coupon' then COUPON + when 'referral' then REFERRAL + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/proforma_invoice_role.rb b/lib/advanced_billing/models/proforma_invoice_role.rb index 9463e2b9..2f11d93a 100644 --- a/lib/advanced_billing/models/proforma_invoice_role.rb +++ b/lib/advanced_billing/models/proforma_invoice_role.rb @@ -26,5 +26,20 @@ def self.validate(value) PROFORMA_INVOICE_ROLE.include?(value) end + + def self.from_value(value, default_value = UNSET) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'unset' then UNSET + when 'proforma' then PROFORMA + when 'proforma_adhoc' then PROFORMA_ADHOC + when 'proforma_automatic' then PROFORMA_AUTOMATIC + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/proforma_invoice_status.rb b/lib/advanced_billing/models/proforma_invoice_status.rb index 343b4362..8335f720 100644 --- a/lib/advanced_billing/models/proforma_invoice_status.rb +++ b/lib/advanced_billing/models/proforma_invoice_status.rb @@ -22,5 +22,19 @@ def self.validate(value) PROFORMA_INVOICE_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 'voided' then VOIDED + when 'archived' then ARCHIVED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb b/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb index 44423676..ecdedbaf 100644 --- a/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb +++ b/lib/advanced_billing/models/proforma_invoice_tax_source_type.rb @@ -19,5 +19,18 @@ def self.validate(value) PROFORMA_INVOICE_TAX_SOURCE_TYPE.include?(value) end + + def self.from_value(value, default_value = TAX) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'tax' then TAX + when 'avalara' then AVALARA + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/public_signup_page.rb b/lib/advanced_billing/models/public_signup_page.rb index c2e7d6d0..67766060 100644 --- a/lib/advanced_billing/models/public_signup_page.rb +++ b/lib/advanced_billing/models/public_signup_page.rb @@ -88,6 +88,16 @@ 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 c4876c48..012b557d 100644 --- a/lib/advanced_billing/models/quantity_based_component.rb +++ b/lib/advanced_billing/models/quantity_based_component.rb @@ -78,8 +78,8 @@ class QuantityBasedComponent < BaseModel attr_accessor :unit_price # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/reactivation_charge.rb b/lib/advanced_billing/models/reactivation_charge.rb index 66fd969b..90248032 100644 --- a/lib/advanced_billing/models/reactivation_charge.rb +++ b/lib/advanced_billing/models/reactivation_charge.rb @@ -26,5 +26,19 @@ def self.validate(value) REACTIVATION_CHARGE.include?(value) end + + def self.from_value(value, default_value = PRORATED) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'prorated' then PRORATED + when 'immediate' then IMMEDIATE + when 'delayed' then DELAYED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/recurring_scheme.rb b/lib/advanced_billing/models/recurring_scheme.rb index c9d1c390..8a409a7c 100644 --- a/lib/advanced_billing/models/recurring_scheme.rb +++ b/lib/advanced_billing/models/recurring_scheme.rb @@ -22,5 +22,19 @@ def self.validate(value) RECURRING_SCHEME.include?(value) end + + def self.from_value(value, default_value = DO_NOT_RECUR) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'do_not_recur' then DO_NOT_RECUR + when 'recur_indefinitely' then RECUR_INDEFINITELY + when 'recur_with_duration' then RECUR_WITH_DURATION + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/resource_type.rb b/lib/advanced_billing/models/resource_type.rb index 7e9d9cbc..8c3f43c2 100644 --- a/lib/advanced_billing/models/resource_type.rb +++ b/lib/advanced_billing/models/resource_type.rb @@ -19,5 +19,18 @@ def self.validate(value) RESOURCE_TYPE.include?(value) end + + def self.from_value(value, default_value = SUBSCRIPTIONS) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'subscriptions' then SUBSCRIPTIONS + when 'customers' then CUSTOMERS + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/restriction_type.rb b/lib/advanced_billing/models/restriction_type.rb index 71fba7e4..25e5c98c 100644 --- a/lib/advanced_billing/models/restriction_type.rb +++ b/lib/advanced_billing/models/restriction_type.rb @@ -19,5 +19,18 @@ def self.validate(value) RESTRICTION_TYPE.include?(value) end + + def self.from_value(value, default_value = COMPONENT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'component' then COMPONENT + when 'product' then PRODUCT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/resume_options.rb b/lib/advanced_billing/models/resume_options.rb index 1b5a6033..d7a45c3c 100644 --- a/lib/advanced_billing/models/resume_options.rb +++ b/lib/advanced_billing/models/resume_options.rb @@ -10,7 +10,7 @@ class ResumeOptions < BaseModel private_constant :SKIP # Chargify will only attempt to resume the subscription's billing period. If - # not resumable, the subscription will be left in it's current state. + # not resumable, the subscription will be left in its current state. # @return [TrueClass | FalseClass] attr_accessor :require_resume diff --git a/lib/advanced_billing/models/resumption_charge.rb b/lib/advanced_billing/models/resumption_charge.rb index 2fe3ad50..a05ade7c 100644 --- a/lib/advanced_billing/models/resumption_charge.rb +++ b/lib/advanced_billing/models/resumption_charge.rb @@ -23,5 +23,19 @@ def self.validate(value) RESUMPTION_CHARGE.include?(value) end + + def self.from_value(value, default_value = PRORATED) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'prorated' then PRORATED + when 'immediate' then IMMEDIATE + when 'delayed' then DELAYED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/service_credit_type.rb b/lib/advanced_billing/models/service_credit_type.rb index 169ddc35..9c4b88d1 100644 --- a/lib/advanced_billing/models/service_credit_type.rb +++ b/lib/advanced_billing/models/service_credit_type.rb @@ -19,5 +19,18 @@ def self.validate(value) SERVICE_CREDIT_TYPE.include?(value) end + + def self.from_value(value, default_value = CREDIT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'credit' then CREDIT + when 'debit' then DEBIT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/snap_day.rb b/lib/advanced_billing/models/snap_day.rb index ef30ef0a..87c4717e 100644 --- a/lib/advanced_billing/models/snap_day.rb +++ b/lib/advanced_billing/models/snap_day.rb @@ -4,8 +4,7 @@ # APIMATIC v3.0 ( https://www.apimatic.io ). module AdvancedBilling - # Use for subscriptions with product eligible for calendar billing only. Value - # can be 1-28 or 'end'. + # SnapDay. class SnapDay SNAP_DAY = [ # TODO: Write general description for ENUM_END @@ -17,5 +16,11 @@ def self.validate(value) 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/sorting_direction.rb b/lib/advanced_billing/models/sorting_direction.rb index 4f01a4ac..86c24071 100644 --- a/lib/advanced_billing/models/sorting_direction.rb +++ b/lib/advanced_billing/models/sorting_direction.rb @@ -19,5 +19,18 @@ def self.validate(value) SORTING_DIRECTION.include?(value) end + + def self.from_value(value, default_value = ASC) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'asc' then ASC + when 'desc' then DESC + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription.rb b/lib/advanced_billing/models/subscription.rb index 05db0552..6e826f4f 100644 --- a/lib/advanced_billing/models/subscription.rb +++ b/lib/advanced_billing/models/subscription.rb @@ -198,7 +198,7 @@ class Subscription < BaseModel # The day of the month that the subscription will charge according to # calendar billing rules, if used. - # @return [String] + # @return [Object] attr_accessor :snap_day # The type of payment collection to be used in the subscription. For legacy @@ -295,7 +295,8 @@ class Subscription < BaseModel attr_accessor :payer_id # The balance in cents plus the estimated renewal amount in cents. Returned - # ONLY for readSubscription operation as it's compute intensive operation. + # ONLY for the readSubscription operation as it's a compute intensive + # operation. # @return [Integer] attr_accessor :current_billing_amount_in_cents @@ -782,7 +783,9 @@ def self.from_hash(hash) SKIP end coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP - snap_day = hash.key?('snap_day') ? hash['snap_day'] : SKIP + snap_day = hash.key?('snap_day') ? APIHelper.deserialize_union_type( + UnionTypeLookUp.get(:SubscriptionSnapDay), 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'] @@ -986,6 +989,16 @@ 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_custom_price.rb b/lib/advanced_billing/models/subscription_custom_price.rb index f4524f13..972143b1 100644 --- a/lib/advanced_billing/models/subscription_custom_price.rb +++ b/lib/advanced_billing/models/subscription_custom_price.rb @@ -42,6 +42,15 @@ class SubscriptionCustomPrice < BaseModel # @return [IntervalUnit] attr_accessor :trial_interval_unit + # Indicates how a trial is handled when the trail period ends and there is + # no credit card on file. For `no_obligation`, the subscription transitions + # to a Trial Ended state. Maxio will not send any emails or statements. For + # `payment_expected`, the subscription transitions to a Past Due state. + # Maxio will send normal dunning emails and statements according to your + # other settings. + # @return [TrialType] + attr_accessor :trial_type + # (Optional) # @return [Object] attr_accessor :initial_charge_in_cents @@ -73,6 +82,7 @@ def self.names @_hash['trial_price_in_cents'] = 'trial_price_in_cents' @_hash['trial_interval'] = 'trial_interval' @_hash['trial_interval_unit'] = 'trial_interval_unit' + @_hash['trial_type'] = 'trial_type' @_hash['initial_charge_in_cents'] = 'initial_charge_in_cents' @_hash['initial_charge_after_trial'] = 'initial_charge_after_trial' @_hash['expiration_interval'] = 'expiration_interval' @@ -89,6 +99,7 @@ def self.optionals trial_price_in_cents trial_interval trial_interval_unit + trial_type initial_charge_in_cents initial_charge_after_trial expiration_interval @@ -101,6 +112,7 @@ def self.optionals def self.nullables %w[ interval_unit + trial_type expiration_interval_unit ] end @@ -108,7 +120,7 @@ def self.nullables def initialize(price_in_cents:, interval:, interval_unit:, name: SKIP, handle: SKIP, trial_price_in_cents: SKIP, trial_interval: SKIP, trial_interval_unit: SKIP, - initial_charge_in_cents: SKIP, + trial_type: SKIP, initial_charge_in_cents: SKIP, initial_charge_after_trial: SKIP, expiration_interval: SKIP, expiration_interval_unit: SKIP, tax_included: SKIP, additional_properties: {}) @@ -125,6 +137,7 @@ def initialize(price_in_cents:, interval:, interval_unit:, name: SKIP, @trial_price_in_cents = trial_price_in_cents unless trial_price_in_cents == SKIP @trial_interval = trial_interval unless trial_interval == SKIP @trial_interval_unit = trial_interval_unit unless trial_interval_unit == SKIP + @trial_type = trial_type unless trial_type == SKIP @initial_charge_in_cents = initial_charge_in_cents unless initial_charge_in_cents == SKIP unless initial_charge_after_trial == SKIP @initial_charge_after_trial = @@ -157,6 +170,7 @@ def self.from_hash(hash) ) : SKIP trial_interval_unit = hash.key?('trial_interval_unit') ? hash['trial_interval_unit'] : SKIP + trial_type = hash.key?('trial_type') ? hash['trial_type'] : SKIP initial_charge_in_cents = hash.key?('initial_charge_in_cents') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:SubscriptionCustomPriceInitialChargeInCents), hash['initial_charge_in_cents'] ) : SKIP @@ -181,6 +195,7 @@ def self.from_hash(hash) trial_price_in_cents: trial_price_in_cents, trial_interval: trial_interval, trial_interval_unit: trial_interval_unit, + trial_type: trial_type, initial_charge_in_cents: initial_charge_in_cents, initial_charge_after_trial: initial_charge_after_trial, expiration_interval: expiration_interval, @@ -221,10 +236,11 @@ def to_s "<#{class_name} name: #{@name}, handle: #{@handle}, price_in_cents: #{@price_in_cents},"\ " interval: #{@interval}, interval_unit: #{@interval_unit}, trial_price_in_cents:"\ " #{@trial_price_in_cents}, trial_interval: #{@trial_interval}, trial_interval_unit:"\ - " #{@trial_interval_unit}, initial_charge_in_cents: #{@initial_charge_in_cents},"\ - " initial_charge_after_trial: #{@initial_charge_after_trial}, expiration_interval:"\ - " #{@expiration_interval}, expiration_interval_unit: #{@expiration_interval_unit},"\ - " tax_included: #{@tax_included}, additional_properties: #{get_additional_properties}>" + " #{@trial_interval_unit}, trial_type: #{@trial_type}, initial_charge_in_cents:"\ + " #{@initial_charge_in_cents}, initial_charge_after_trial: #{@initial_charge_after_trial},"\ + " expiration_interval: #{@expiration_interval}, expiration_interval_unit:"\ + " #{@expiration_interval_unit}, tax_included: #{@tax_included}, additional_properties:"\ + " #{get_additional_properties}>" end # Provides a debugging-friendly string with detailed object information. @@ -234,8 +250,8 @@ def inspect " #{@price_in_cents.inspect}, interval: #{@interval.inspect}, interval_unit:"\ " #{@interval_unit.inspect}, trial_price_in_cents: #{@trial_price_in_cents.inspect},"\ " trial_interval: #{@trial_interval.inspect}, trial_interval_unit:"\ - " #{@trial_interval_unit.inspect}, initial_charge_in_cents:"\ - " #{@initial_charge_in_cents.inspect}, initial_charge_after_trial:"\ + " #{@trial_interval_unit.inspect}, trial_type: #{@trial_type.inspect},"\ + " initial_charge_in_cents: #{@initial_charge_in_cents.inspect}, initial_charge_after_trial:"\ " #{@initial_charge_after_trial.inspect}, expiration_interval:"\ " #{@expiration_interval.inspect}, expiration_interval_unit:"\ " #{@expiration_interval_unit.inspect}, tax_included: #{@tax_included.inspect},"\ diff --git a/lib/advanced_billing/models/subscription_date_field.rb b/lib/advanced_billing/models/subscription_date_field.rb index 5bfeb523..16d99ff6 100644 --- a/lib/advanced_billing/models/subscription_date_field.rb +++ b/lib/advanced_billing/models/subscription_date_field.rb @@ -40,5 +40,25 @@ def self.validate(value) SUBSCRIPTION_DATE_FIELD.include?(value) end + + def self.from_value(value, default_value = CURRENT_PERIOD_ENDS_AT) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'current_period_ends_at' then CURRENT_PERIOD_ENDS_AT + when 'current_period_starts_at' then CURRENT_PERIOD_STARTS_AT + when 'created_at' then CREATED_AT + when 'activated_at' then ACTIVATED_AT + when 'canceled_at' then CANCELED_AT + when 'expires_at' then EXPIRES_AT + when 'trial_started_at' then TRIAL_STARTED_AT + when 'trial_ended_at' then TRIAL_ENDED_AT + when 'updated_at' then UPDATED_AT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription_group_include.rb b/lib/advanced_billing/models/subscription_group_include.rb index 98c86ce3..b7c1cfd0 100644 --- a/lib/advanced_billing/models/subscription_group_include.rb +++ b/lib/advanced_billing/models/subscription_group_include.rb @@ -16,5 +16,11 @@ def self.validate(value) SUBSCRIPTION_GROUP_INCLUDE.include?(value) end + + def self.from_value(value, default_value = CURRENT_BILLING_AMOUNT_IN_CENTS) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/subscription_group_prepayment_method.rb b/lib/advanced_billing/models/subscription_group_prepayment_method.rb index f7872365..7a1cfc3c 100644 --- a/lib/advanced_billing/models/subscription_group_prepayment_method.rb +++ b/lib/advanced_billing/models/subscription_group_prepayment_method.rb @@ -31,5 +31,22 @@ def self.validate(value) SUBSCRIPTION_GROUP_PREPAYMENT_METHOD.include?(value) end + + def self.from_value(value, default_value = CHECK) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'check' then CHECK + when 'cash' then CASH + when 'money_order' then MONEY_ORDER + when 'ach' then ACH + when 'paypal_account' then PAYPAL_ACCOUNT + when 'other' then OTHER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription_groups_list_include.rb b/lib/advanced_billing/models/subscription_groups_list_include.rb index c1f83585..6b74d5a4 100644 --- a/lib/advanced_billing/models/subscription_groups_list_include.rb +++ b/lib/advanced_billing/models/subscription_groups_list_include.rb @@ -16,5 +16,11 @@ def self.validate(value) SUBSCRIPTION_GROUPS_LIST_INCLUDE.include?(value) end + + def self.from_value(value, default_value = ACCOUNT_BALANCES) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/subscription_include.rb b/lib/advanced_billing/models/subscription_include.rb index c4431004..48dc7c43 100644 --- a/lib/advanced_billing/models/subscription_include.rb +++ b/lib/advanced_billing/models/subscription_include.rb @@ -19,5 +19,18 @@ def self.validate(value) SUBSCRIPTION_INCLUDE.include?(value) end + + def self.from_value(value, default_value = COUPONS) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'coupons' then COUPONS + when 'self_service_page_token' then SELF_SERVICE_PAGE_TOKEN + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription_included_coupon.rb b/lib/advanced_billing/models/subscription_included_coupon.rb index 389f6f01..87d6ce08 100644 --- a/lib/advanced_billing/models/subscription_included_coupon.rb +++ b/lib/advanced_billing/models/subscription_included_coupon.rb @@ -117,6 +117,16 @@ 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_list_date_field.rb b/lib/advanced_billing/models/subscription_list_date_field.rb index 0ac0758d..056e1041 100644 --- a/lib/advanced_billing/models/subscription_list_date_field.rb +++ b/lib/advanced_billing/models/subscription_list_date_field.rb @@ -16,5 +16,11 @@ def self.validate(value) SUBSCRIPTION_LIST_DATE_FIELD.include?(value) end + + def self.from_value(value, default_value = UPDATED_AT) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/subscription_list_include.rb b/lib/advanced_billing/models/subscription_list_include.rb index efced80c..b6042e2a 100644 --- a/lib/advanced_billing/models/subscription_list_include.rb +++ b/lib/advanced_billing/models/subscription_list_include.rb @@ -16,5 +16,11 @@ def self.validate(value) SUBSCRIPTION_LIST_INCLUDE.include?(value) end + + def self.from_value(value, default_value = SELF_SERVICE_PAGE_TOKEN) + return default_value if value.nil? + + default_value + end end end diff --git a/lib/advanced_billing/models/subscription_purge_type.rb b/lib/advanced_billing/models/subscription_purge_type.rb index 239f98a4..72670f64 100644 --- a/lib/advanced_billing/models/subscription_purge_type.rb +++ b/lib/advanced_billing/models/subscription_purge_type.rb @@ -19,5 +19,18 @@ def self.validate(value) SUBSCRIPTION_PURGE_TYPE.include?(value) end + + def self.from_value(value, default_value = CUSTOMER) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'customer' then CUSTOMER + when 'payment_profile' then PAYMENT_PROFILE + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription_sort.rb b/lib/advanced_billing/models/subscription_sort.rb index 2436b180..9864fe99 100644 --- a/lib/advanced_billing/models/subscription_sort.rb +++ b/lib/advanced_billing/models/subscription_sort.rb @@ -31,5 +31,22 @@ def self.validate(value) SUBSCRIPTION_SORT.include?(value) end + + def self.from_value(value, default_value = SIGNUP_DATE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'signup_date' then SIGNUP_DATE + when 'period_start' then PERIOD_START + when 'period_end' then PERIOD_END + when 'next_assessment' then NEXT_ASSESSMENT + when 'updated_at' then UPDATED_AT + when 'created_at' then CREATED_AT + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription_state.rb b/lib/advanced_billing/models/subscription_state.rb index 0d48a9bb..c4acc462 100644 --- a/lib/advanced_billing/models/subscription_state.rb +++ b/lib/advanced_billing/models/subscription_state.rb @@ -114,5 +114,31 @@ def self.validate(value) SUBSCRIPTION_STATE.include?(value) end + + def self.from_value(value, default_value = PENDING) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'pending' then PENDING + when 'failed_to_create' then FAILED_TO_CREATE + when 'trialing' then TRIALING + when 'assessing' then ASSESSING + when 'active' then ACTIVE + when 'soft_failure' then SOFT_FAILURE + when 'past_due' then PAST_DUE + when 'suspended' then SUSPENDED + when 'canceled' then CANCELED + when 'expired' then EXPIRED + when 'paused' then PAUSED + when 'unpaid' then UNPAID + when 'trial_ended' then TRIAL_ENDED + when 'on_hold' then ON_HOLD + when 'awaiting_signup' then AWAITING_SIGNUP + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/subscription_state_filter.rb b/lib/advanced_billing/models/subscription_state_filter.rb index 1b656714..8e4243cb 100644 --- a/lib/advanced_billing/models/subscription_state_filter.rb +++ b/lib/advanced_billing/models/subscription_state_filter.rb @@ -49,5 +49,28 @@ def self.validate(value) SUBSCRIPTION_STATE_FILTER.include?(value) end + + def self.from_value(value, default_value = ACTIVE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'active' then ACTIVE + when 'canceled' then CANCELED + when 'expired' then EXPIRED + when 'expired_cards' then EXPIRED_CARDS + when 'on_hold' then ON_HOLD + when 'past_due' then PAST_DUE + when 'pending_cancellation' then PENDING_CANCELLATION + when 'pending_renewal' then PENDING_RENEWAL + when 'suspended' then SUSPENDED + when 'trial_ended' then TRIAL_ENDED + when 'trialing' then TRIALING + when 'unpaid' then UNPAID + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/tax_configuration_kind.rb b/lib/advanced_billing/models/tax_configuration_kind.rb index 8ae7ca6f..b45e8bef 100644 --- a/lib/advanced_billing/models/tax_configuration_kind.rb +++ b/lib/advanced_billing/models/tax_configuration_kind.rb @@ -25,5 +25,20 @@ def self.validate(value) TAX_CONFIGURATION_KIND.include?(value) end + + def self.from_value(value, default_value = CUSTOM) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'custom' then CUSTOM + when 'enum_managed_avalara' then ENUM_MANAGED_AVALARA + when 'enum_linked_avalara' then ENUM_LINKED_AVALARA + when 'enum_digital_river' then ENUM_DIGITAL_RIVER + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/tax_destination_address.rb b/lib/advanced_billing/models/tax_destination_address.rb index 3e5d46e0..4e96b82f 100644 --- a/lib/advanced_billing/models/tax_destination_address.rb +++ b/lib/advanced_billing/models/tax_destination_address.rb @@ -25,5 +25,20 @@ def self.validate(value) TAX_DESTINATION_ADDRESS.include?(value) end + + def self.from_value(value, default_value = SHIPPING_THEN_BILLING) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'shipping_then_billing' then SHIPPING_THEN_BILLING + when 'billing_then_shipping' then BILLING_THEN_SHIPPING + when 'shipping_only' then SHIPPING_ONLY + when 'billing_only' then BILLING_ONLY + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/trial_type.rb b/lib/advanced_billing/models/trial_type.rb new file mode 100644 index 00000000..8e66dc52 --- /dev/null +++ b/lib/advanced_billing/models/trial_type.rb @@ -0,0 +1,41 @@ +# advanced_billing +# +# This file was automatically generated for Maxio by +# APIMATIC v3.0 ( https://www.apimatic.io ). + +module AdvancedBilling + # Indicates how a trial is handled when the trail period ends and there is no + # credit card on file. For `no_obligation`, the subscription transitions to a + # Trial Ended state. Maxio will not send any emails or statements. For + # `payment_expected`, the subscription transitions to a Past Due state. Maxio + # will send normal dunning emails and statements according to your other + # settings. + class TrialType + TRIAL_TYPE = [ + # TODO: Write general description for NO_OBLIGATION + NO_OBLIGATION = 'no_obligation'.freeze, + + # TODO: Write general description for PAYMENT_EXPECTED + PAYMENT_EXPECTED = 'payment_expected'.freeze + ].freeze + + def self.validate(value) + return false if value.nil? + + TRIAL_TYPE.include?(value) + end + + def self.from_value(value, default_value = NO_OBLIGATION) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'no_obligation' then NO_OBLIGATION + when 'payment_expected' then PAYMENT_EXPECTED + else + default_value + end + end + end +end diff --git a/lib/advanced_billing/models/update_component.rb b/lib/advanced_billing/models/update_component.rb index 33aa1e33..5bc0db63 100644 --- a/lib/advanced_billing/models/update_component.rb +++ b/lib/advanced_billing/models/update_component.rb @@ -31,8 +31,8 @@ class UpdateComponent < BaseModel attr_accessor :taxable # A string representing the tax code related to the component type. This is - # especially important when using the Avalara service to tax based on - # locale. This attribute has a max length of 10 characters. + # especially important when using AvaTax to tax based on locale. This + # attribute has a max length of 25 characters. # @return [String] attr_accessor :tax_code diff --git a/lib/advanced_billing/models/update_metafield.rb b/lib/advanced_billing/models/update_metafield.rb index 9cfcc53b..9370f8f5 100644 --- a/lib/advanced_billing/models/update_metafield.rb +++ b/lib/advanced_billing/models/update_metafield.rb @@ -23,15 +23,13 @@ class UpdateMetafield < BaseModel # @return [MetafieldScope] attr_accessor :scope - # Indicates how data should be added to the metafield. For example, a text - # type is just a string, so a given metafield of this type can have any - # value attached. On the other hand, dropdown and radio have a set of - # allowed values that can be input, and appear differently on a Public - # Signup Page. Defaults to 'text' + # Indicates the type of metafield. A text metafield allows any string value. + # Dropdown and radio metafields have a set of values that can be selected. + # Defaults to 'text'. # @return [MetafieldInput] attr_accessor :input_type - # Only applicable when input_type is radio or dropdown + # Only applicable when input_type is radio or dropdown. # @return [Array[String]] attr_accessor :enum diff --git a/lib/advanced_billing/models/update_payment_profile.rb b/lib/advanced_billing/models/update_payment_profile.rb index 7e060e3e..f4807b9a 100644 --- a/lib/advanced_billing/models/update_payment_profile.rb +++ b/lib/advanced_billing/models/update_payment_profile.rb @@ -68,9 +68,9 @@ class UpdatePaymentProfile < BaseModel # The credit card or bank account billing address country, required in # [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) # format (i.e. “US”). This value is merely passed through to the payment - # gateway. Some gateways require country codes in a specific format. Please - # check your gateway’s documentation. If creating an ACH subscription, only - # US is supported at this time. + # gateway. Some gateways require country codes in a specific format. Check + # your gateway’s documentation. If creating an ACH subscription, only US is + # supported at this time. # @return [String] attr_accessor :billing_country diff --git a/lib/advanced_billing/models/update_subscription.rb b/lib/advanced_billing/models/update_subscription.rb index 6ebe485f..fb78b289 100644 --- a/lib/advanced_billing/models/update_subscription.rb +++ b/lib/advanced_billing/models/update_subscription.rb @@ -207,6 +207,7 @@ 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/webhook_order.rb b/lib/advanced_billing/models/webhook_order.rb index db4f709e..cfbe45fc 100644 --- a/lib/advanced_billing/models/webhook_order.rb +++ b/lib/advanced_billing/models/webhook_order.rb @@ -19,5 +19,18 @@ def self.validate(value) WEBHOOK_ORDER.include?(value) end + + def self.from_value(value, default_value = NEWEST_FIRST) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'newest_first' then NEWEST_FIRST + when 'oldest_first' then OLDEST_FIRST + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/webhook_status.rb b/lib/advanced_billing/models/webhook_status.rb index 9f8587d1..6bbcaaca 100644 --- a/lib/advanced_billing/models/webhook_status.rb +++ b/lib/advanced_billing/models/webhook_status.rb @@ -25,5 +25,20 @@ def self.validate(value) WEBHOOK_STATUS.include?(value) end + + def self.from_value(value, default_value = SUCCESSFUL) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'successful' then SUCCESSFUL + when 'failed' then FAILED + when 'pending' then PENDING + when 'paused' then PAUSED + else + default_value + end + end end end diff --git a/lib/advanced_billing/models/webhook_subscription.rb b/lib/advanced_billing/models/webhook_subscription.rb index e9cb67fd..ac5796b8 100644 --- a/lib/advanced_billing/models/webhook_subscription.rb +++ b/lib/advanced_billing/models/webhook_subscription.rb @@ -120,5 +120,51 @@ def self.validate(value) WEBHOOK_SUBSCRIPTION.include?(value) end + + def self.from_value(value, default_value = BILLING_DATE_CHANGE) + return default_value if value.nil? + + str = value.to_s.strip + + case str.downcase + when 'billing_date_change' then BILLING_DATE_CHANGE + when 'component_allocation_change' then COMPONENT_ALLOCATION_CHANGE + when 'customer_create' then CUSTOMER_CREATE + when 'customer_update' then CUSTOMER_UPDATE + when 'dunning_step_reached' then DUNNING_STEP_REACHED + when 'expiring_card' then EXPIRING_CARD + when 'expiration_date_change' then EXPIRATION_DATE_CHANGE + when 'invoice_issued' then INVOICE_ISSUED + when 'metered_usage' then METERED_USAGE + when 'payment_failure' then PAYMENT_FAILURE + when 'payment_success' then PAYMENT_SUCCESS + when 'direct_debit_payment_pending' then DIRECT_DEBIT_PAYMENT_PENDING + when 'direct_debit_payment_paid_out' then DIRECT_DEBIT_PAYMENT_PAID_OUT + when 'direct_debit_payment_rejected' then DIRECT_DEBIT_PAYMENT_REJECTED + when 'prepaid_subscription_balance_changed' then PREPAID_SUBSCRIPTION_BALANCE_CHANGED + when 'prepaid_usage' then PREPAID_USAGE + when 'refund_failure' then REFUND_FAILURE + when 'refund_success' then REFUND_SUCCESS + when 'renewal_failure' then RENEWAL_FAILURE + when 'renewal_success' then RENEWAL_SUCCESS + when 'signup_failure' then SIGNUP_FAILURE + when 'signup_success' then SIGNUP_SUCCESS + when 'statement_closed' then STATEMENT_CLOSED + when 'statement_settled' then STATEMENT_SETTLED + when 'subscription_card_update' then SUBSCRIPTION_CARD_UPDATE + when 'subscription_group_card_update' then SUBSCRIPTION_GROUP_CARD_UPDATE + when 'subscription_product_change' then SUBSCRIPTION_PRODUCT_CHANGE + when 'subscription_state_change' then SUBSCRIPTION_STATE_CHANGE + when 'trial_end_notice' then TRIAL_END_NOTICE + when 'upcoming_renewal_notice' then UPCOMING_RENEWAL_NOTICE + when 'upgrade_downgrade_failure' then UPGRADE_DOWNGRADE_FAILURE + when 'upgrade_downgrade_success' then UPGRADE_DOWNGRADE_SUCCESS + when 'pending_cancellation_change' then PENDING_CANCELLATION_CHANGE + when 'subscription_prepayment_account_balance_changed' then SUBSCRIPTION_PREPAYMENT_ACCOUNT_BALANCE_CHANGED + when 'subscription_service_credit_account_balance_changed' then SUBSCRIPTION_SERVICE_CREDIT_ACCOUNT_BALANCE_CHANGED + 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 29c2bc4a..bc9feae3 100644 --- a/lib/advanced_billing/utilities/union_type_lookup.rb +++ b/lib/advanced_billing/utilities/union_type_lookup.rb @@ -275,10 +275,11 @@ def self.union_types :CalendarBillingSnapDay => OneOf.new( [ LeafType.new(Integer), - LeafType.new(String) + LeafType.new(SnapDay) ], UnionTypeContext.new( - is_optional: true + is_optional: true, + is_nullable: true ) ), @@ -850,6 +851,17 @@ 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), @@ -1036,11 +1048,12 @@ def self.union_types :UpdateSubscriptionSnapDay => OneOf.new( [ - LeafType.new(SnapDay), - LeafType.new(Integer) + LeafType.new(Integer), + LeafType.new(SnapDay) ], UnionTypeContext.new( - is_optional: true + is_optional: true, + is_nullable: true ) ),