From 9ade3e1bff6c6ea7ffba8ffc96731372057d75e9 Mon Sep 17 00:00:00 2001 From: lucassus Date: Tue, 9 Dec 2025 12:19:30 +0000 Subject: [PATCH 1/2] Automated commit message --- src/Models/SnapDay.php | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/src/Models/SnapDay.php b/src/Models/SnapDay.php index 4887c77..93bf87e 100644 --- a/src/Models/SnapDay.php +++ b/src/Models/SnapDay.php @@ -23,35 +23,18 @@ class SnapDay /** * Ensures that all the given values are present in this Enum. * - * @param array|stdClass|null|string|int $value Value or a list/map of values to be checked + * @param array|stdClass|null|string $value Value or a list/map of values to be checked * - * @return array|null|string|int Input value(s), if all are a part of this Enum + * @return array|null|string Input value(s), if all are a part of this Enum * * @throws Exception Throws exception if any given value is not in this Enum */ public static function checkValue($value) { $value = json_decode(json_encode($value), true); // converts stdClass into array - - // If value is a numeric string (1-28), convert it to an integer - // This handles cases where the API returns numeric snap_day as a string - if (is_string($value) && is_numeric($value)) { - $numericValue = (int)$value; - if ($numericValue >= 1 && $numericValue <= 28) { - return $numericValue; - } - } - - // Check if it's a valid enum value (e.g., "end") if (CoreHelper::checkValueOrValuesInList($value, self::_ALL_VALUES)) { return $value; } - - // For integer values (1-28), pass them through - if (is_int($value) && $value >= 1 && $value <= 28) { - return $value; - } - throw new Exception("$value is invalid for SnapDay."); } } From 04088f0c8967aac17820330c80a27374ef232cea Mon Sep 17 00:00:00 2001 From: lucassus Date: Thu, 26 Feb 2026 14:18:19 +0000 Subject: [PATCH 2/2] Automated commit message --- LICENSE | 2 +- README.md | 89 +- composer.json | 2 +- doc/client.md | 3 +- doc/controllers/advance-invoice.md | 44 +- doc/controllers/api-exports.md | 96 +- doc/controllers/billing-portal.md | 48 +- doc/controllers/component-price-points.md | 327 +++++- doc/controllers/components.md | 192 +++- doc/controllers/coupons.md | 212 +++- doc/controllers/custom-fields.md | 120 +- doc/controllers/customers.md | 78 +- .../events-based-billing-segments.md | 104 +- doc/controllers/events.md | 32 +- doc/controllers/insights.md | 42 +- doc/controllers/invoices.md | 240 +++- doc/controllers/offers.md | 50 +- doc/controllers/payment-profiles.md | 174 ++- doc/controllers/product-families.md | 51 +- doc/controllers/product-price-points.md | 176 ++- doc/controllers/products.md | 72 +- doc/controllers/proforma-invoices.md | 191 ++- doc/controllers/reason-codes.md | 56 +- doc/controllers/referral-codes.md | 12 +- doc/controllers/sales-commissions.md | 44 +- doc/controllers/sites.md | 28 +- doc/controllers/subscription-components.md | 420 ++++--- .../subscription-group-invoice-account.md | 58 +- doc/controllers/subscription-group-status.md | 54 +- doc/controllers/subscription-groups.md | 123 +- .../subscription-invoice-account.md | 118 +- doc/controllers/subscription-notes.md | 92 +- doc/controllers/subscription-products.md | 40 +- doc/controllers/subscription-renewals.md | 1019 +++++++++++++++++ doc/controllers/subscription-status.md | 177 ++- doc/controllers/subscriptions.md | 192 +++- doc/controllers/webhooks.md | 70 +- doc/models/activate-event-based-component.md | 4 +- doc/models/allocate-components.md | 20 +- doc/models/allocation-preview-item.md | 4 +- doc/models/allocation-settings.md | 4 +- doc/models/allocation.md | 4 +- doc/models/available-actions.md | 24 + doc/models/cancellation-options.md | 12 +- doc/models/cancellation-request.md | 5 +- .../clone-component-price-point-request.md | 24 + doc/models/clone-component-price-point.md | 23 + doc/models/component-custom-price.md | 6 +- ...t-price-point-currency-overage-response.md | 27 + doc/models/component-price-point.md | 2 +- doc/models/component.md | 4 +- ...lone-component-price-point-component-id.md | 14 + ...ne-component-price-point-price-point-id.md | 14 + ...item-request-renewal-configuration-item.md | 14 + ...ed-renewal-product-price-point-interval.md | 14 + ...ewal-product-price-point-price-in-cents.md | 14 + ...date-request-renewal-configuration-item.md | 14 + doc/models/contract.md | 34 + doc/models/create-allocation-request.md | 8 +- doc/models/create-allocation.md | 22 +- doc/models/create-subscription.md | 2 +- doc/models/create-usage-request.md | 4 +- doc/models/create-usage.md | 4 +- doc/models/credit-type.md | 1 - doc/models/currency-overage-prices.md | 50 + .../deliver-proforma-invoice-request.md | 33 + doc/models/downgrade-credit-credit-type.md | 23 + doc/models/on-off-component.md | 4 +- doc/models/prepaid-usage-component.md | 4 +- doc/models/preview-allocations-request.md | 12 +- doc/models/product-family.md | 1 + doc/models/proforma-invoice.md | 1 + doc/models/quantity-based-component.md | 4 +- doc/models/reactivate-subscription-request.md | 2 +- doc/models/register.md | 27 + ...cheduled-renewal-component-custom-price.md | 33 + ...uled-renewal-configuration-item-request.md | 42 + ...led-renewal-configuration-item-response.md | 27 + .../scheduled-renewal-configuration-item.md | 35 + ...uled-renewal-configuration-request-body.md | 29 + ...scheduled-renewal-configuration-request.md | 27 + ...cheduled-renewal-configuration-response.md | 27 + doc/models/scheduled-renewal-configuration.md | 34 + ...heduled-renewal-configurations-response.md | 43 + ...led-renewal-item-request-body-component.md | 44 + ...duled-renewal-item-request-body-product.md | 38 + .../scheduled-renewal-lock-in-request.md | 21 + .../scheduled-renewal-product-price-point.md | 38 + .../scheduled-renewal-update-request.md | 42 + doc/models/send-email.md | 23 + doc/models/send-invoice-request.md | 5 + doc/models/status.md | 18 + doc/models/subscription-component.md | 4 +- doc/models/subscription-custom-price.md | 2 +- ...bscription-group-component-custom-price.md | 4 +- doc/models/subscription-group-response.md | 4 +- .../subscription-group-signup-component.md | 12 +- doc/models/subscription-group-signup-item.md | 2 +- doc/models/subscription-group.md | 5 +- doc/models/subscription-sort.md | 4 + doc/models/subscription.md | 4 +- doc/models/update-component.md | 2 +- doc/models/update-subscription-component.md | 4 +- doc/models/update-subscription.md | 2 +- doc/models/upgrade-charge-credit-type.md | 23 + src/AdvancedBillingClient.php | 16 +- src/Controllers/AdvanceInvoiceController.php | 6 +- .../ComponentPricePointsController.php | 62 +- src/Controllers/InvoicesController.php | 14 +- src/Controllers/PaymentProfilesController.php | 10 +- .../ProformaInvoicesController.php | 48 +- .../SubscriptionComponentsController.php | 124 +- .../SubscriptionGroupsController.php | 8 +- .../SubscriptionInvoiceAccountController.php | 12 +- .../SubscriptionNotesController.php | 10 +- .../SubscriptionProductsController.php | 4 +- .../SubscriptionRenewalsController.php | 425 +++++++ .../SubscriptionStatusController.php | 50 +- src/Controllers/SubscriptionsController.php | 22 +- src/Models/AllocateComponents.php | 6 - src/Models/Allocation.php | 6 - src/Models/AllocationPreviewItem.php | 6 - src/Models/AllocationSettings.php | 6 - src/Models/AvailableActions.php | 101 ++ .../Builders/AvailableActionsBuilder.php | 72 ++ .../Builders/CancellationOptionsBuilder.php | 42 + .../CloneComponentPricePointBuilder.php | 73 ++ ...CloneComponentPricePointRequestBuilder.php | 63 + .../Builders/ComponentCustomPriceBuilder.php | 31 + ...icePointCurrencyOverageResponseBuilder.php | 63 + src/Models/Builders/ContractBuilder.php | 114 ++ .../Builders/CreateAllocationBuilder.php | 67 +- .../Builders/CurrencyOveragePricesBuilder.php | 380 ++++++ .../DeliverProformaInvoiceRequestBuilder.php | 93 ++ src/Models/Builders/ProductFamilyBuilder.php | 20 + .../Builders/ProformaInvoiceBuilder.php | 12 + src/Models/Builders/RegisterBuilder.php | 104 ++ ...uledRenewalComponentCustomPriceBuilder.php | 75 ++ .../ScheduledRenewalConfigurationBuilder.php | 172 +++ ...heduledRenewalConfigurationItemBuilder.php | 181 +++ ...RenewalConfigurationItemRequestBuilder.php | 64 ++ ...enewalConfigurationItemResponseBuilder.php | 72 ++ ...RenewalConfigurationRequestBodyBuilder.php | 115 ++ ...uledRenewalConfigurationRequestBuilder.php | 63 + ...ledRenewalConfigurationResponseBuilder.php | 72 ++ ...edRenewalConfigurationsResponseBuilder.php | 72 ++ ...RenewalItemRequestBodyComponentBuilder.php | 96 ++ ...edRenewalItemRequestBodyProductBuilder.php | 96 ++ .../ScheduledRenewalLockInRequestBuilder.php | 62 + ...heduledRenewalProductPricePointBuilder.php | 149 +++ .../ScheduledRenewalUpdateRequestBuilder.php | 64 ++ src/Models/Builders/SendEmailBuilder.php | 63 + .../Builders/SendInvoiceRequestBuilder.php | 11 + .../Builders/SubscriptionGroupBuilder.php | 11 + src/Models/CancellationOptions.php | 132 ++- src/Models/CloneComponentPricePoint.php | 138 +++ .../CloneComponentPricePointRequest.php | 108 ++ src/Models/Component.php | 6 - src/Models/ComponentCustomPrice.php | 79 +- src/Models/ComponentPricePoint.php | 6 +- ...onentPricePointCurrencyOverageResponse.php | 111 ++ src/Models/Contract.php | 199 ++++ src/Models/CreateAllocation.php | 273 ++++- src/Models/CreateSubscription.php | 6 +- src/Models/CreditType.php | 1 - src/Models/CurrencyOveragePrices.php | 895 +++++++++++++++ src/Models/DeliverProformaInvoiceRequest.php | 170 +++ src/Models/DowngradeCreditCreditType.php | 54 + src/Models/OnOffComponent.php | 6 - src/Models/PrepaidUsageComponent.php | 6 - src/Models/PreviewAllocationsRequest.php | 6 - src/Models/ProductFamily.php | 45 + src/Models/ProformaInvoice.php | 27 + src/Models/QuantityBasedComponent.php | 6 - src/Models/ReactivateSubscriptionRequest.php | 22 +- src/Models/Register.php | 187 +++ .../ScheduledRenewalComponentCustomPrice.php | 180 +++ src/Models/ScheduledRenewalConfiguration.php | 364 ++++++ .../ScheduledRenewalConfigurationItem.php | 376 ++++++ ...heduledRenewalConfigurationItemRequest.php | 122 ++ ...eduledRenewalConfigurationItemResponse.php | 106 ++ .../ScheduledRenewalConfigurationRequest.php | 111 ++ ...heduledRenewalConfigurationRequestBody.php | 231 ++++ .../ScheduledRenewalConfigurationResponse.php | 105 ++ ...ScheduledRenewalConfigurationsResponse.php | 108 ++ ...heduledRenewalItemRequestBodyComponent.php | 228 ++++ ...ScheduledRenewalItemRequestBodyProduct.php | 227 ++++ src/Models/ScheduledRenewalLockInRequest.php | 112 ++ .../ScheduledRenewalProductPricePoint.php | 387 +++++++ src/Models/ScheduledRenewalUpdateRequest.php | 121 ++ src/Models/SendEmail.php | 139 +++ src/Models/SendInvoiceRequest.php | 33 + src/Models/Status.php | 51 + src/Models/Subscription.php | 12 +- src/Models/SubscriptionComponent.php | 6 - src/Models/SubscriptionCustomPrice.php | 3 +- src/Models/SubscriptionGroup.php | 27 + src/Models/SubscriptionGroupSignupItem.php | 6 +- src/Models/SubscriptionSort.php | 14 +- src/Models/UpdateComponent.php | 3 - src/Models/UpdateSubscription.php | 6 +- src/Models/UpgradeChargeCreditType.php | 54 + 202 files changed, 13903 insertions(+), 1149 deletions(-) create mode 100644 doc/controllers/subscription-renewals.md create mode 100644 doc/models/available-actions.md create mode 100644 doc/models/clone-component-price-point-request.md create mode 100644 doc/models/clone-component-price-point.md create mode 100644 doc/models/component-price-point-currency-overage-response.md create mode 100644 doc/models/containers/clone-component-price-point-component-id.md create mode 100644 doc/models/containers/clone-component-price-point-price-point-id.md create mode 100644 doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md create mode 100644 doc/models/containers/scheduled-renewal-product-price-point-interval.md create mode 100644 doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md create mode 100644 doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md create mode 100644 doc/models/contract.md create mode 100644 doc/models/currency-overage-prices.md create mode 100644 doc/models/deliver-proforma-invoice-request.md create mode 100644 doc/models/downgrade-credit-credit-type.md create mode 100644 doc/models/register.md create mode 100644 doc/models/scheduled-renewal-component-custom-price.md create mode 100644 doc/models/scheduled-renewal-configuration-item-request.md create mode 100644 doc/models/scheduled-renewal-configuration-item-response.md create mode 100644 doc/models/scheduled-renewal-configuration-item.md create mode 100644 doc/models/scheduled-renewal-configuration-request-body.md create mode 100644 doc/models/scheduled-renewal-configuration-request.md create mode 100644 doc/models/scheduled-renewal-configuration-response.md create mode 100644 doc/models/scheduled-renewal-configuration.md create mode 100644 doc/models/scheduled-renewal-configurations-response.md create mode 100644 doc/models/scheduled-renewal-item-request-body-component.md create mode 100644 doc/models/scheduled-renewal-item-request-body-product.md create mode 100644 doc/models/scheduled-renewal-lock-in-request.md create mode 100644 doc/models/scheduled-renewal-product-price-point.md create mode 100644 doc/models/scheduled-renewal-update-request.md create mode 100644 doc/models/send-email.md create mode 100644 doc/models/status.md create mode 100644 doc/models/upgrade-charge-credit-type.md create mode 100644 src/Controllers/SubscriptionRenewalsController.php create mode 100644 src/Models/AvailableActions.php create mode 100644 src/Models/Builders/AvailableActionsBuilder.php create mode 100644 src/Models/Builders/CloneComponentPricePointBuilder.php create mode 100644 src/Models/Builders/CloneComponentPricePointRequestBuilder.php create mode 100644 src/Models/Builders/ComponentPricePointCurrencyOverageResponseBuilder.php create mode 100644 src/Models/Builders/ContractBuilder.php create mode 100644 src/Models/Builders/CurrencyOveragePricesBuilder.php create mode 100644 src/Models/Builders/DeliverProformaInvoiceRequestBuilder.php create mode 100644 src/Models/Builders/RegisterBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalComponentCustomPriceBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationItemBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationItemRequestBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationItemResponseBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationRequestBodyBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationRequestBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationResponseBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalConfigurationsResponseBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalItemRequestBodyComponentBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalItemRequestBodyProductBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalLockInRequestBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalProductPricePointBuilder.php create mode 100644 src/Models/Builders/ScheduledRenewalUpdateRequestBuilder.php create mode 100644 src/Models/Builders/SendEmailBuilder.php create mode 100644 src/Models/CloneComponentPricePoint.php create mode 100644 src/Models/CloneComponentPricePointRequest.php create mode 100644 src/Models/ComponentPricePointCurrencyOverageResponse.php create mode 100644 src/Models/Contract.php create mode 100644 src/Models/CurrencyOveragePrices.php create mode 100644 src/Models/DeliverProformaInvoiceRequest.php create mode 100644 src/Models/DowngradeCreditCreditType.php create mode 100644 src/Models/Register.php create mode 100644 src/Models/ScheduledRenewalComponentCustomPrice.php create mode 100644 src/Models/ScheduledRenewalConfiguration.php create mode 100644 src/Models/ScheduledRenewalConfigurationItem.php create mode 100644 src/Models/ScheduledRenewalConfigurationItemRequest.php create mode 100644 src/Models/ScheduledRenewalConfigurationItemResponse.php create mode 100644 src/Models/ScheduledRenewalConfigurationRequest.php create mode 100644 src/Models/ScheduledRenewalConfigurationRequestBody.php create mode 100644 src/Models/ScheduledRenewalConfigurationResponse.php create mode 100644 src/Models/ScheduledRenewalConfigurationsResponse.php create mode 100644 src/Models/ScheduledRenewalItemRequestBodyComponent.php create mode 100644 src/Models/ScheduledRenewalItemRequestBodyProduct.php create mode 100644 src/Models/ScheduledRenewalLockInRequest.php create mode 100644 src/Models/ScheduledRenewalProductPricePoint.php create mode 100644 src/Models/ScheduledRenewalUpdateRequest.php create mode 100644 src/Models/SendEmail.php create mode 100644 src/Models/Status.php create mode 100644 src/Models/UpgradeChargeCreditType.php diff --git a/LICENSE b/LICENSE index b85cedd..4771c25 100644 --- a/LICENSE +++ b/LICENSE @@ -3,7 +3,7 @@ License: The MIT License (MIT) http://opensource.org/licenses/MIT -Copyright (c) 2014 - 2025 APIMATIC Limited +Copyright (c) 2014 - 2026 APIMATIC Limited Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index b6cde1a..b00986e 100644 --- a/README.md +++ b/README.md @@ -29,30 +29,30 @@ curl -u :x -H Accept:application/json -H Content-Type:application/json Run the following command to install the package and automatically add the dependency to your composer.json file: ```bash -composer require "maxio/advanced-billing-sdk:8.0.0" +composer require "maxio/advanced-billing-sdk:9.0.0" ``` Or add it to the composer.json file manually as given below: ```json "require": { - "maxio/advanced-billing-sdk": "8.0.0" + "maxio/advanced-billing-sdk": "9.0.0" } ``` You can also view the package at: -https://packagist.org/packages/maxio/advanced-billing-sdk#8.0.0 +https://packagist.org/packages/maxio/advanced-billing-sdk#9.0.0 ## Initialize the API Client -**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/client.md) The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | site | `string` | The subdomain for your Advanced Billing site.
*Default*: `'subdomain'` | -| environment | `Environment` | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/README.md#environments) | The API environment.
**Default: `Environment.US`** | | timeout | `int` | Timeout for API calls in seconds.
*Default*: `120` | | enableRetries | `bool` | Whether to enable retries and backoff feature.
*Default*: `false` | | numberOfRetries | `int` | The number of retries to make.
*Default*: `0` | @@ -62,8 +62,8 @@ The following parameters are configurable for the API Client: | retryOnTimeout | `bool` | Whether to retry on request timeout.
*Default*: `true` | | httpStatusCodesToRetry | `array` | Http status codes to retry against.
*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` | | httpMethodsToRetry | `array` | Http methods to retry against.
*Default*: `'GET', 'PUT'` | -| proxyConfiguration | [`ProxyConfigurationBuilder`](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/proxy-configuration-builder.md) | Represents the proxy configurations for API calls | -| basicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | +| proxyConfiguration | [`ProxyConfigurationBuilder`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/proxy-configuration-builder.md) | Represents the proxy configurations for API calls | +| basicAuthCredentials | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | The API client can be initialized as follows: @@ -99,55 +99,56 @@ 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-php-sdk/tree/8.0.0/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-products.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/billing-portal.md) +* [Component Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/component-price-points.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-products.md) +* [Subscription Renewals](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-renewals.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/controllers/webhooks.md) ## SDK Infrastructure ### Configuration -* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/proxy-configuration-builder.md) +* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/proxy-configuration-builder.md) ### HTTP -* [HttpRequest](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/http-request.md) -* [HttpResponse](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/http-response.md) +* [HttpRequest](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/http-request.md) +* [HttpResponse](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/http-response.md) ### Utilities -* [ApiException](https://www.github.com/maxio-com/ab-php-sdk/tree/8.0.0/doc/api-exception.md) +* [ApiException](https://www.github.com/maxio-com/ab-php-sdk/tree/9.0.0/doc/api-exception.md) diff --git a/composer.json b/composer.json index cfda0f7..e1be85d 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "ext-curl": "*", "apimatic/unirest-php": "^4.0.6", "apimatic/core-interfaces": "~0.1.5", - "apimatic/core": "~0.3.16" + "apimatic/core": "~0.3.17" }, "require-dev": { "squizlabs/php_codesniffer": "^3.5", diff --git a/doc/client.md b/doc/client.md index e224d5d..2b022e0 100644 --- a/doc/client.md +++ b/doc/client.md @@ -6,7 +6,7 @@ The following parameters are configurable for the API Client: | Parameter | Type | Description | | --- | --- | --- | | site | `string` | The subdomain for your Advanced Billing site.
*Default*: `'subdomain'` | -| environment | `Environment` | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](../README.md#environments) | The API environment.
**Default: `Environment.US`** | | timeout | `int` | Timeout for API calls in seconds.
*Default*: `120` | | enableRetries | `bool` | Whether to enable retries and backoff feature.
*Default*: `false` | | numberOfRetries | `int` | The number of retries to make.
*Default*: `0` | @@ -76,6 +76,7 @@ The gateway for the SDK. This class acts as a factory for the Controllers and al | getSubscriptionInvoiceAccountController() | Gets SubscriptionInvoiceAccountController | | getSubscriptionNotesController() | Gets SubscriptionNotesController | | getSubscriptionProductsController() | Gets SubscriptionProductsController | +| getSubscriptionRenewalsController() | Gets SubscriptionRenewalsController | | getSubscriptionStatusController() | Gets SubscriptionStatusController | | getWebhooksController() | Gets WebhooksController | diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md index ca833b0..2422643 100644 --- a/doc/controllers/advance-invoice.md +++ b/doc/controllers/advance-invoice.md @@ -30,7 +30,7 @@ function issueAdvanceInvoice(int $subscriptionId, ?IssueAdvanceInvoiceRequest $b | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?IssueAdvanceInvoiceRequest`](../../doc/models/issue-advance-invoice-request.md) | Body, Optional | - | ## Response Type @@ -46,10 +46,20 @@ $body = IssueAdvanceInvoiceRequestBuilder::init() ->force(true) ->build(); -$result = $advanceInvoiceController->issueAdvanceInvoice( - $subscriptionId, - $body -); +$advanceInvoiceController = $client->getAdvanceInvoiceController(); + +try { + $result = $advanceInvoiceController->issueAdvanceInvoice( + $subscriptionId, + $body + ); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -72,7 +82,7 @@ function readAdvanceInvoice(int $subscriptionId): Invoice | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -83,7 +93,15 @@ function readAdvanceInvoice(int $subscriptionId): Invoice ```php $subscriptionId = 222; -$result = $advanceInvoiceController->readAdvanceInvoice($subscriptionId); +$advanceInvoiceController = $client->getAdvanceInvoiceController(); + +try { + $result = $advanceInvoiceController->readAdvanceInvoice($subscriptionId); + echo 'Invoice:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -106,7 +124,7 @@ function voidAdvanceInvoice(int $subscriptionId, ?VoidInvoiceRequest $body = nul | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?VoidInvoiceRequest`](../../doc/models/void-invoice-request.md) | Body, Optional | - | ## Response Type @@ -118,7 +136,15 @@ function voidAdvanceInvoice(int $subscriptionId, ?VoidInvoiceRequest $body = nul ```php $subscriptionId = 222; -$result = $advanceInvoiceController->voidAdvanceInvoice($subscriptionId); +$advanceInvoiceController = $client->getAdvanceInvoiceController(); + +try { + $result = $advanceInvoiceController->voidAdvanceInvoice($subscriptionId); + echo 'Invoice:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/api-exports.md b/doc/controllers/api-exports.md index e56d98a..3f3d66b 100644 --- a/doc/controllers/api-exports.md +++ b/doc/controllers/api-exports.md @@ -52,7 +52,15 @@ $collect = [ 'page' => 1 ]; -$result = $aPIExportsController->listExportedProformaInvoices($collect); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->listExportedProformaInvoices($collect); + echo 'ProformaInvoice[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -93,7 +101,15 @@ $collect = [ 'page' => 1 ]; -$result = $aPIExportsController->listExportedInvoices($collect); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->listExportedInvoices($collect); + echo 'Invoice[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -134,7 +150,15 @@ $collect = [ 'page' => 1 ]; -$result = $aPIExportsController->listExportedSubscriptions($collect); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->listExportedSubscriptions($collect); + echo 'Subscription[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -161,7 +185,17 @@ function exportProformaInvoices(): BatchJobResponse ## Example Usage ```php -$result = $aPIExportsController->exportProformaInvoices(); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->exportProformaInvoices(); + echo 'BatchJobResponse:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -187,7 +221,17 @@ function exportInvoices(): BatchJobResponse ## Example Usage ```php -$result = $aPIExportsController->exportInvoices(); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->exportInvoices(); + echo 'BatchJobResponse:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -213,7 +257,17 @@ function exportSubscriptions(): BatchJobResponse ## Example Usage ```php -$result = $aPIExportsController->exportSubscriptions(); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->exportSubscriptions(); + echo 'BatchJobResponse:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -246,7 +300,15 @@ function readProformaInvoicesExport(string $batchId): BatchJobResponse ```php $batchId = 'batch_id8'; -$result = $aPIExportsController->readProformaInvoicesExport($batchId); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->readProformaInvoicesExport($batchId); + echo 'BatchJobResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -279,7 +341,15 @@ function readInvoicesExport(string $batchId): BatchJobResponse ```php $batchId = 'batch_id8'; -$result = $aPIExportsController->readInvoicesExport($batchId); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->readInvoicesExport($batchId); + echo 'BatchJobResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -312,7 +382,15 @@ function readSubscriptionsExport(string $batchId): BatchJobResponse ```php $batchId = 'batch_id8'; -$result = $aPIExportsController->readSubscriptionsExport($batchId); +$aPIExportsController = $client->getAPIExportsController(); + +try { + $result = $aPIExportsController->readSubscriptionsExport($batchId); + echo 'BatchJobResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/billing-portal.md b/doc/controllers/billing-portal.md index 87d5b6c..f154dd8 100644 --- a/doc/controllers/billing-portal.md +++ b/doc/controllers/billing-portal.md @@ -54,7 +54,17 @@ function enableBillingPortalForCustomer(int $customerId, ?int $autoInvite = null ```php $customerId = 150; -$result = $billingPortalController->enableBillingPortalForCustomer($customerId); +$billingPortalController = $client->getBillingPortalController(); + +try { + $result = $billingPortalController->enableBillingPortalForCustomer($customerId); + echo 'CustomerResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -95,7 +105,19 @@ function readBillingPortalLink(int $customerId): PortalManagementLink ```php $customerId = 150; -$result = $billingPortalController->readBillingPortalLink($customerId); +$billingPortalController = $client->getBillingPortalController(); + +try { + $result = $billingPortalController->readBillingPortalLink($customerId); + echo 'PortalManagementLink:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (TooManyManagementLinkRequestsErrorException $exp) { + echo 'Caught TooManyManagementLinkRequestsErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -154,7 +176,17 @@ function resendBillingPortalInvitation(int $customerId): ResentInvitation ```php $customerId = 150; -$result = $billingPortalController->resendBillingPortalInvitation($customerId); +$billingPortalController = $client->getBillingPortalController(); + +try { + $result = $billingPortalController->resendBillingPortalInvitation($customerId); + echo 'ResentInvitation:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -205,7 +237,15 @@ function revokeBillingPortalAccess(int $customerId): RevokedInvitation ```php $customerId = 150; -$result = $billingPortalController->revokeBillingPortalAccess($customerId); +$billingPortalController = $client->getBillingPortalController(); + +try { + $result = $billingPortalController->revokeBillingPortalAccess($customerId); + echo 'RevokedInvitation:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index b47fd42..0948579 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -14,6 +14,7 @@ $componentPricePointsController = $client->getComponentPricePointsController(); * [Create Component Price Point](../../doc/controllers/component-price-points.md#create-component-price-point) * [List Component Price Points](../../doc/controllers/component-price-points.md#list-component-price-points) * [Bulk Create Component Price Points](../../doc/controllers/component-price-points.md#bulk-create-component-price-points) +* [Clone Component Price Point](../../doc/controllers/component-price-points.md#clone-component-price-point) * [Update Component Price Point](../../doc/controllers/component-price-points.md#update-component-price-point) * [Read Component Price Point](../../doc/controllers/component-price-points.md#read-component-price-point) * [Archive Component Price Point](../../doc/controllers/component-price-points.md#archive-component-price-point) @@ -53,10 +54,18 @@ $componentId = 222; $pricePointId = 10; -$result = $componentPricePointsController->promoteComponentPricePointToDefault( - $componentId, - $pricePointId -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->promoteComponentPricePointToDefault( + $componentId, + $pricePointId + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -148,10 +157,20 @@ $body = CreateComponentPricePointRequestBuilder::init( ->build() )->build(); -$result = $componentPricePointsController->createComponentPricePoint( - $componentId, - $body -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->createComponentPricePoint( + $componentId, + $body + ); + echo 'ComponentPricePointResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -199,7 +218,15 @@ $collect = [ 'filterType' => Liquid error: Value cannot be null. (Parameter 'key') ]; -$result = $componentPricePointsController->listComponentPricePoints($collect); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->listComponentPricePoints($collect); + echo 'ComponentPricePointsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -320,10 +347,20 @@ $body = CreateComponentPricePointsRequestBuilder::init( ] )->build(); -$result = $componentPricePointsController->bulkCreateComponentPricePoints( - $componentId, - $body -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->bulkCreateComponentPricePoints( + $componentId, + $body + ); + echo 'ComponentPricePointsResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -382,6 +419,148 @@ $result = $componentPricePointsController->bulkCreateComponentPricePoints( | 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | +# Clone Component Price Point + +Clones a component price point. Custom price points (tied to a specific subscription) cannot be cloned. The following attributes are copied from the source price point: + +- Pricing scheme +- All price tiers (with starting/ending quantities and unit prices) +- Tax included setting +- Currency prices (if definitive pricing is set) +- Overage pricing (for prepaid usage components) +- Interval settings (if multi-frequency is enabled) +- Event-based billing segments (if applicable) + +```php +function cloneComponentPricePoint( + $componentId, + $pricePointId, + ?CloneComponentPricePointRequest $body = null +): ComponentPricePointCurrencyOverageResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `componentId` | int\|string | Template, Required | This is a container for one-of cases. | +| `pricePointId` | int\|string | Template, Required | This is a container for one-of cases. | +| `body` | [`?CloneComponentPricePointRequest`](../../doc/models/clone-component-price-point-request.md) | Body, Optional | - | + +## Response Type + +[`ComponentPricePointCurrencyOverageResponse`](../../doc/models/component-price-point-currency-overage-response.md) + +## Example Usage + +```php +$componentId = 144; + +$pricePointId = 188; + +$body = CloneComponentPricePointRequestBuilder::init( + CloneComponentPricePointBuilder::init( + 'Pro Usage Tiered Clone' + )->build() +)->build(); + +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->cloneComponentPricePoint( + $componentId, + $pricePointId, + $body + ); + echo 'ComponentPricePointCurrencyOverageResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "price_point": { + "id": 9012, + "name": "Pro Usage Tiered Clone", + "type": "catalog", + "pricing_scheme": "tiered", + "component_id": 1234, + "handle": "pro-usage-tiered-clone", + "archived_at": null, + "created_at": "2024-05-01T12:34:56-04:00", + "updated_at": "2024-05-01T12:34:56-04:00", + "use_site_exchange_rate": false, + "currency_prices": [ + { + "id": 3001, + "currency": "EUR", + "price": "9.99", + "formatted_price": "€9.99", + "price_id": 4001, + "price_point_id": 9012 + } + ], + "currency_overage_prices": [ + { + "id": 3002, + "currency": "EUR", + "price": "2.50", + "formatted_price": "€2.50", + "price_id": 4002, + "price_point_id": 9012 + } + ], + "renew_prepaid_allocation": true, + "rollover_prepaid_remainder": false, + "expiration_interval": 1, + "expiration_interval_unit": "month", + "overage_pricing_scheme": "tiered", + "subscription_id": 4321, + "prices": [ + { + "id": 4001, + "component_id": 1234, + "starting_quantity": 1, + "ending_quantity": 100, + "unit_price": "9.99", + "price_point_id": 9012, + "formatted_unit_price": "$9.99", + "segment_id": null + } + ], + "overage_prices": [ + { + "id": 4002, + "component_id": 1234, + "starting_quantity": 101, + "ending_quantity": null, + "unit_price": "2.50", + "price_point_id": 9012, + "formatted_unit_price": "$2.50", + "segment_id": null + } + ], + "tax_included": false, + "interval": 1, + "interval_unit": "month" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | `ApiException` | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + # Update Component Price Point When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones. @@ -452,11 +631,21 @@ $body = UpdateComponentPricePointRequestBuilder::init() ) ->build(); -$result = $componentPricePointsController->updateComponentPricePoint( - $componentId, - $pricePointId, - $body -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->updateComponentPricePoint( + $componentId, + $pricePointId, + $body + ); + echo 'ComponentPricePointResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -475,7 +664,7 @@ function readComponentPricePoint( $componentId, $pricePointId, ?bool $currencyPrices = null -): ComponentPricePointResponse +): ComponentPricePointCurrencyOverageResponse ``` ## Parameters @@ -488,7 +677,7 @@ function readComponentPricePoint( ## Response Type -[`ComponentPricePointResponse`](../../doc/models/component-price-point-response.md) +[`ComponentPricePointCurrencyOverageResponse`](../../doc/models/component-price-point-currency-overage-response.md) ## Example Usage @@ -497,10 +686,18 @@ $componentId = 144; $pricePointId = 188; -$result = $componentPricePointsController->readComponentPricePoint( - $componentId, - $pricePointId -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->readComponentPricePoint( + $componentId, + $pricePointId + ); + echo 'ComponentPricePointCurrencyOverageResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -530,10 +727,20 @@ $componentId = 144; $pricePointId = 188; -$result = $componentPricePointsController->archiveComponentPricePoint( - $componentId, - $pricePointId -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->archiveComponentPricePoint( + $componentId, + $pricePointId + ); + echo 'ComponentPricePointResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -603,10 +810,18 @@ $componentId = 222; $pricePointId = 10; -$result = $componentPricePointsController->unarchiveComponentPricePoint( - $componentId, - $pricePointId -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->unarchiveComponentPricePoint( + $componentId, + $pricePointId + ); + echo 'ComponentPricePointResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -690,10 +905,20 @@ $body = CreateCurrencyPricesRequestBuilder::init( ] )->build(); -$result = $componentPricePointsController->createCurrencyPrices( - $pricePointId, - $body -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->createCurrencyPrices( + $pricePointId, + $body + ); + echo 'ComponentCurrencyPricesResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -762,10 +987,20 @@ $body = UpdateCurrencyPricesRequestBuilder::init( ] )->build(); -$result = $componentPricePointsController->updateCurrencyPrices( - $pricePointId, - $body -); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->updateCurrencyPrices( + $pricePointId, + $body + ); + echo 'ComponentCurrencyPricesResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -843,7 +1078,17 @@ $collect = [ ->build() ]; -$result = $componentPricePointsController->listAllComponentPricePoints($collect); +$componentPricePointsController = $client->getComponentPricePointsController(); + +try { + $result = $componentPricePointsController->listAllComponentPricePoints($collect); + echo 'ListComponentsPricePointsResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/components.md b/doc/controllers/components.md index 05b1ef3..63dab57 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -74,10 +74,20 @@ $body = CreateMeteredComponentBuilder::init( )->build() )->build(); -$result = $componentsController->createMeteredComponent( - $productFamilyId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->createMeteredComponent( + $productFamilyId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -200,10 +210,20 @@ $body = CreateQuantityBasedComponentBuilder::init( ->build() )->build(); -$result = $componentsController->createQuantityBasedComponent( - $productFamilyId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->createQuantityBasedComponent( + $productFamilyId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -308,10 +328,20 @@ $body = CreateOnOffComponentBuilder::init( ->build() )->build(); -$result = $componentsController->createOnOffComponent( - $productFamilyId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->createOnOffComponent( + $productFamilyId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -426,10 +456,20 @@ $body = CreatePrepaidComponentBuilder::init( ->build() )->build(); -$result = $componentsController->createPrepaidUsageComponent( - $productFamilyId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->createPrepaidUsageComponent( + $productFamilyId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -552,10 +592,20 @@ $body = CreateEBBComponentBuilder::init( )->build() )->build(); -$result = $componentsController->createEventBasedComponent( - $productFamilyId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->createEventBasedComponent( + $productFamilyId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -628,7 +678,15 @@ function findComponent(string $handle): ComponentResponse ```php $handle = 'handle6'; -$result = $componentsController->findComponent($handle); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->findComponent($handle); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -690,10 +748,18 @@ $productFamilyId = 140; $componentId = 'component_id8'; -$result = $componentsController->readComponent( - $productFamilyId, - $componentId -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->readComponent( + $productFamilyId, + $componentId + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -767,11 +833,21 @@ $body = UpdateComponentRequestBuilder::init( ->build() )->build(); -$result = $componentsController->updateProductFamilyComponent( - $productFamilyId, - $componentId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->updateProductFamilyComponent( + $productFamilyId, + $componentId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -837,10 +913,20 @@ $productFamilyId = 140; $componentId = 'component_id8'; -$result = $componentsController->archiveComponent( - $productFamilyId, - $componentId -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->archiveComponent( + $productFamilyId, + $componentId + ); + echo 'Component:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -920,7 +1006,15 @@ $collect = [ ->build() ]; -$result = $componentsController->listComponents($collect); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->listComponents($collect); + echo 'ComponentResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1055,10 +1149,20 @@ $body = UpdateComponentRequestBuilder::init( ->build() )->build(); -$result = $componentsController->updateComponent( - $componentId, - $body -); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->updateComponent( + $componentId, + $body + ); + echo 'ComponentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1144,7 +1248,15 @@ $collect = [ 'dateField' => BasicDateField::UPDATED_AT ]; -$result = $componentsController->listComponentsForProductFamily($collect); +$componentsController = $client->getComponentsController(); + +try { + $result = $componentsController->listComponentsForProductFamily($collect); + echo 'ComponentResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md index b94be73..6954528 100644 --- a/doc/controllers/coupons.md +++ b/doc/controllers/coupons.md @@ -95,10 +95,20 @@ $body = CouponRequestBuilder::init() ) ->build(); -$result = $couponsController->createCoupon( - $productFamilyId, - $body -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->createCoupon( + $productFamilyId, + $body + ); + echo 'CouponResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -159,7 +169,15 @@ $collect = [ 'currencyPrices' => true ]; -$result = $couponsController->listCouponsForProductFamily($collect); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->listCouponsForProductFamily($collect); + echo 'CouponResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -285,11 +303,19 @@ function findCoupon( ```php $currencyPrices = true; -$result = $couponsController->findCoupon( - null, - null, - $currencyPrices -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->findCoupon( + null, + null, + $currencyPrices + ); + echo 'CouponResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -327,11 +353,19 @@ $couponId = 162; $currencyPrices = true; -$result = $couponsController->readCoupon( - $productFamilyId, - $couponId, - $currencyPrices -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->readCoupon( + $productFamilyId, + $couponId, + $currencyPrices + ); + echo 'CouponResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -426,11 +460,21 @@ $body = CouponRequestBuilder::init() ) ->build(); -$result = $couponsController->updateCoupon( - $productFamilyId, - $couponId, - $body -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->updateCoupon( + $productFamilyId, + $couponId, + $body + ); + echo 'CouponResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -497,10 +541,18 @@ $productFamilyId = 140; $couponId = 162; -$result = $couponsController->archiveCoupon( - $productFamilyId, - $couponId -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->archiveCoupon( + $productFamilyId, + $couponId + ); + echo 'CouponResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -582,7 +634,15 @@ $collect = [ 'currencyPrices' => true ]; -$result = $couponsController->listCoupons($collect); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->listCoupons($collect); + echo 'CouponResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -660,10 +720,18 @@ $productFamilyId = 140; $couponId = 162; -$result = $couponsController->readCouponUsage( - $productFamilyId, - $couponId -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->readCouponUsage( + $productFamilyId, + $couponId + ); + echo 'CouponUsage[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -745,7 +813,17 @@ function validateCoupon(string $code, ?int $productFamilyId = null): CouponRespo ```php $code = 'code8'; -$result = $couponsController->validateCoupon($code); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->validateCoupon($code); + echo 'CouponResponse:'; + var_dump($result); +} catch (SingleStringErrorResponseException $exp) { + echo 'Caught SingleStringErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -826,10 +904,20 @@ $body = CouponCurrencyRequestBuilder::init( ] )->build(); -$result = $couponsController->createOrUpdateCouponCurrencyPrices( - $couponId, - $body -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->createOrUpdateCouponCurrencyPrices( + $couponId, + $body + ); + echo 'CouponCurrencyResponse:'; + var_dump($result); +} catch (ErrorStringMapResponseException $exp) { + echo 'Caught ErrorStringMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -912,10 +1000,18 @@ $body = CouponSubcodesBuilder::init() ) ->build(); -$result = $couponsController->createCouponSubcodes( - $couponId, - $body -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->createCouponSubcodes( + $couponId, + $body + ); + echo 'CouponSubcodesResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -960,7 +1056,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $couponsController->listCouponSubcodes($collect); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->listCouponSubcodes($collect); + echo 'CouponSubcodes:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1037,10 +1141,18 @@ $body = CouponSubcodesBuilder::init() ) ->build(); -$result = $couponsController->updateCouponSubcodes( - $couponId, - $body -); +$couponsController = $client->getCouponsController(); + +try { + $result = $couponsController->updateCouponSubcodes( + $couponId, + $body + ); + echo 'CouponSubcodesResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -1091,10 +1203,16 @@ $couponId = 162; $subcode = 'subcode4'; -$couponsController->deleteCouponSubcode( - $couponId, - $subcode -); +$couponsController = $client->getCouponsController(); + +try { + $couponsController->deleteCouponSubcode( + $couponId, + $subcode + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/custom-fields.md b/doc/controllers/custom-fields.md index 2c8bead..e4fafae 100644 --- a/doc/controllers/custom-fields.md +++ b/doc/controllers/custom-fields.md @@ -79,10 +79,20 @@ $body = CreateMetafieldsRequestBuilder::init( ->build() )->build(); -$result = $customFieldsController->createMetafields( - $resourceType, - $body -); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->createMetafields( + $resourceType, + $body + ); + echo 'Metafield[]:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -154,7 +164,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $customFieldsController->listMetafields($collect); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->listMetafields($collect); + echo 'ListMetafieldsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -236,7 +254,17 @@ function updateMetafield(string $resourceType, ?UpdateMetafieldsRequest $body = ```php $resourceType = ResourceType::SUBSCRIPTIONS; -$result = $customFieldsController->updateMetafield($resourceType); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->updateMetafield($resourceType); + echo 'Metafield[]:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -270,7 +298,13 @@ function deleteMetafield(string $resourceType, ?string $name = null): void ```php $resourceType = ResourceType::SUBSCRIPTIONS; -$customFieldsController->deleteMetafield($resourceType); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $customFieldsController->deleteMetafield($resourceType); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -324,11 +358,21 @@ $body = CreateMetadataRequestBuilder::init( ] )->build(); -$result = $customFieldsController->createMetadata( - $resourceType, - $resourceId, - $body -); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->createMetadata( + $resourceType, + $resourceId, + $body + ); + echo 'Metadata[]:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -369,7 +413,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $customFieldsController->listMetadata($collect); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->listMetadata($collect); + echo 'PaginatedMetadata:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -425,10 +477,20 @@ $resourceType = ResourceType::SUBSCRIPTIONS; $resourceId = 60; -$result = $customFieldsController->updateMetadata( - $resourceType, - $resourceId -); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->updateMetadata( + $resourceType, + $resourceId + ); + echo 'Metadata[]:'; + var_dump($result); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -466,10 +528,16 @@ $resourceType = ResourceType::SUBSCRIPTIONS; $resourceId = 60; -$customFieldsController->deleteMetadata( - $resourceType, - $resourceId -); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $customFieldsController->deleteMetadata( + $resourceType, + $resourceId + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -517,6 +585,14 @@ $collect = [ 'dateField' => BasicDateField::UPDATED_AT ]; -$result = $customFieldsController->listMetadataForResourceType($collect); +$customFieldsController = $client->getCustomFieldsController(); + +try { + $result = $customFieldsController->listMetadataForResourceType($collect); + echo 'PaginatedMetadata:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index b879f43..cc853ba 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -83,7 +83,17 @@ $body = CreateCustomerRequestBuilder::init( ->build() )->build(); -$result = $customersController->createCustomer($body); +$customersController = $client->getCustomersController(); + +try { + $result = $customersController->createCustomer($body); + echo 'CustomerResponse:'; + var_dump($result); +} catch (CustomerErrorResponseException $exp) { + echo 'Caught CustomerErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -177,7 +187,15 @@ $collect = [ 'dateField' => BasicDateField::UPDATED_AT ]; -$result = $customersController->listCustomers($collect); +$customersController = $client->getCustomersController(); + +try { + $result = $customersController->listCustomers($collect); + echo 'CustomerResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -288,7 +306,15 @@ function readCustomer(int $id): CustomerResponse ```php $id = 112; -$result = $customersController->readCustomer($id); +$customersController = $client->getCustomersController(); + +try { + $result = $customersController->readCustomer($id); + echo 'CustomerResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -361,10 +387,20 @@ $body = UpdateCustomerRequestBuilder::init( ->build() )->build(); -$result = $customersController->updateCustomer( - $id, - $body -); +$customersController = $client->getCustomersController(); + +try { + $result = $customersController->updateCustomer( + $id, + $body + ); + echo 'CustomerResponse:'; + var_dump($result); +} catch (CustomerErrorResponseException $exp) { + echo 'Caught CustomerErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -429,7 +465,13 @@ function deleteCustomer(int $id): void ```php $id = 112; -$customersController->deleteCustomer($id); +$customersController = $client->getCustomersController(); + +try { + $customersController->deleteCustomer($id); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -456,7 +498,15 @@ function readCustomerByReference(string $reference): CustomerResponse ```php $reference = 'reference4'; -$result = $customersController->readCustomerByReference($reference); +$customersController = $client->getCustomersController(); + +try { + $result = $customersController->readCustomerByReference($reference); + echo 'CustomerResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -483,6 +533,14 @@ function listCustomerSubscriptions(int $customerId): array ```php $customerId = 150; -$result = $customersController->listCustomerSubscriptions($customerId); +$customersController = $client->getCustomersController(); + +try { + $result = $customersController->listCustomerSubscriptions($customerId); + echo 'SubscriptionResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md index de62374..ef25bcf 100644 --- a/doc/controllers/events-based-billing-segments.md +++ b/doc/controllers/events-based-billing-segments.md @@ -79,11 +79,21 @@ $body = CreateSegmentRequestBuilder::init( ->build() )->build(); -$result = $eventsBasedBillingSegmentsController->createSegment( - $componentId, - $pricePointId, - $body -); +$eventsBasedBillingSegmentsController = $client->getEventsBasedBillingSegmentsController(); + +try { + $result = $eventsBasedBillingSegmentsController->createSegment( + $componentId, + $pricePointId, + $body + ); + echo 'SegmentResponse:'; + var_dump($result); +} catch (EventBasedBillingSegmentErrorsException $exp) { + echo 'Caught EventBasedBillingSegmentErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -133,7 +143,17 @@ $collect = [ ->build() ]; -$result = $eventsBasedBillingSegmentsController->listSegmentsForPricePoint($collect); +$eventsBasedBillingSegmentsController = $client->getEventsBasedBillingSegmentsController(); + +try { + $result = $eventsBasedBillingSegmentsController->listSegmentsForPricePoint($collect); + echo 'ListSegmentsResponse:'; + var_dump($result); +} catch (EventBasedBillingListSegmentsErrorsException $exp) { + echo 'Caught EventBasedBillingListSegmentsErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -181,11 +201,21 @@ $pricePointId = 'price_point_id8'; $id = 60; -$result = $eventsBasedBillingSegmentsController->updateSegment( - $componentId, - $pricePointId, - $id -); +$eventsBasedBillingSegmentsController = $client->getEventsBasedBillingSegmentsController(); + +try { + $result = $eventsBasedBillingSegmentsController->updateSegment( + $componentId, + $pricePointId, + $id + ); + echo 'SegmentResponse:'; + var_dump($result); +} catch (EventBasedBillingSegmentErrorsException $exp) { + echo 'Caught EventBasedBillingSegmentErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -227,11 +257,17 @@ $pricePointId = 'price_point_id8'; $id = 60; -$eventsBasedBillingSegmentsController->deleteSegment( - $componentId, - $pricePointId, - $id -); +$eventsBasedBillingSegmentsController = $client->getEventsBasedBillingSegmentsController(); + +try { + $eventsBasedBillingSegmentsController->deleteSegment( + $componentId, + $pricePointId, + $id + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -277,10 +313,20 @@ $componentId = 'component_id8'; $pricePointId = 'price_point_id8'; -$result = $eventsBasedBillingSegmentsController->bulkCreateSegments( - $componentId, - $pricePointId -); +$eventsBasedBillingSegmentsController = $client->getEventsBasedBillingSegmentsController(); + +try { + $result = $eventsBasedBillingSegmentsController->bulkCreateSegments( + $componentId, + $pricePointId + ); + echo 'ListSegmentsResponse:'; + var_dump($result); +} catch (EventBasedBillingSegmentException $exp) { + echo 'Caught EventBasedBillingSegmentException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -326,10 +372,20 @@ $componentId = 'component_id8'; $pricePointId = 'price_point_id8'; -$result = $eventsBasedBillingSegmentsController->bulkUpdateSegments( - $componentId, - $pricePointId -); +$eventsBasedBillingSegmentsController = $client->getEventsBasedBillingSegmentsController(); + +try { + $result = $eventsBasedBillingSegmentsController->bulkUpdateSegments( + $componentId, + $pricePointId + ); + echo 'ListSegmentsResponse:'; + var_dump($result); +} catch (EventBasedBillingSegmentException $exp) { + echo 'Caught EventBasedBillingSegmentException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/events.md b/doc/controllers/events.md index a831302..1e2ec85 100644 --- a/doc/controllers/events.md +++ b/doc/controllers/events.md @@ -124,7 +124,15 @@ $collect = [ 'dateField' => ListEventsDateField::CREATED_AT ]; -$result = $eventsController->listEvents($collect); +$eventsController = $client->getEventsController(); + +try { + $result = $eventsController->listEvents($collect); + echo 'EventResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -212,7 +220,7 @@ function listSubscriptionEvents(array $options): array | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `page` | `?int` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

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

**Default**: `20`

**Constraints**: `<= 200` | | `sinceId` | `?int` | Query, Optional | Returns events with an id greater than or equal to the one specified | @@ -238,7 +246,15 @@ $collect = [ ] ]; -$result = $eventsController->listSubscriptionEvents($collect); +$eventsController = $client->getEventsController(); + +try { + $result = $eventsController->listSubscriptionEvents($collect); + echo 'EventResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -321,7 +337,15 @@ $collect = [ ] ]; -$result = $eventsController->readEventsCount($collect); +$eventsController = $client->getEventsController(); + +try { + $result = $eventsController->readEventsCount($collect); + echo 'CountResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/insights.md b/doc/controllers/insights.md index c1902db..afb1c92 100644 --- a/doc/controllers/insights.md +++ b/doc/controllers/insights.md @@ -39,7 +39,15 @@ function readSiteStats(): SiteSummary ## Example Usage ```php -$result = $insightsController->readSiteStats(); +$insightsController = $client->getInsightsController(); + +try { + $result = $insightsController->readSiteStats(); + echo 'SiteSummary:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -86,7 +94,15 @@ function readMrr(?\DateTime $atTime = null, ?int $subscriptionId = null): MRRRes ## Example Usage ```php -$result = $insightsController->readMrr(); +$insightsController = $client->getInsightsController(); + +try { + $result = $insightsController->readMrr(); + echo 'MRRResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -164,7 +180,15 @@ $collect = [ 'perPage' => 20 ]; -$result = $insightsController->listMrrMovements($collect); +$insightsController = $client->getInsightsController(); + +try { + $result = $insightsController->listMrrMovements($collect); + echo 'ListMRRResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -263,7 +287,17 @@ $collect = [ 'direction' => Direction::DESC ]; -$result = $insightsController->listMrrPerSubscription($collect); +$insightsController = $client->getInsightsController(); + +try { + $result = $insightsController->listMrrPerSubscription($collect); + echo 'SubscriptionMRRResponse:'; + var_dump($result); +} catch (SubscriptionsMrrErrorResponseException $exp) { + echo 'Caught SubscriptionsMrrErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index fae428b..fa22ebc 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -71,10 +71,20 @@ $body = RefundInvoiceRequestBuilder::init( ->build() )->build(); -$result = $invoicesController->refundInvoice( - $uid, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->refundInvoice( + $uid, + $body + ); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -155,7 +165,15 @@ $collect = [ 'sort' => InvoiceSortField::TOTAL_AMOUNT ]; -$result = $invoicesController->listInvoices($collect); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->listInvoices($collect); + echo 'ListInvoicesResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -468,7 +486,15 @@ function readInvoice(string $uid): Invoice ```php $uid = 'uid0'; -$result = $invoicesController->readInvoice($uid); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->readInvoice($uid); + echo 'Invoice:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -636,7 +662,15 @@ $collect = [ 'perPage' => 100 ]; -$result = $invoicesController->listInvoiceEvents($collect); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->listInvoiceEvents($collect); + echo 'ListInvoiceEventsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1058,10 +1092,20 @@ $body = CreateInvoicePaymentRequestBuilder::init( ->build() )->build(); -$result = $invoicesController->recordPaymentForInvoice( - $uid, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->recordPaymentForInvoice( + $uid, + $body + ); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -1139,7 +1183,17 @@ $body = CreateMultiInvoicePaymentRequestBuilder::init( ->build() )->build(); -$result = $invoicesController->recordPaymentForMultipleInvoices($body); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->recordPaymentForMultipleInvoices($body); + echo 'MultiInvoicePaymentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1213,7 +1267,15 @@ $collect = [ 'applications' => false ]; -$result = $invoicesController->listCreditNotes($collect); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->listCreditNotes($collect); + echo 'ListCreditNotesResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1541,7 +1603,15 @@ function readCreditNote(string $uid): CreditNote ```php $uid = 'uid0'; -$result = $invoicesController->readCreditNote($uid); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->readCreditNote($uid); + echo 'CreditNote:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1875,7 +1945,7 @@ function recordPaymentForSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?RecordPaymentRequest`](../../doc/models/record-payment-request.md) | Body, Optional | - | ## Response Type @@ -1896,10 +1966,20 @@ $body = RecordPaymentRequestBuilder::init( )->build() )->build(); -$result = $invoicesController->recordPaymentForSubscription( - $subscriptionId, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->recordPaymentForSubscription( + $subscriptionId, + $body + ); + echo 'RecordPaymentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1965,7 +2045,17 @@ function reopenInvoice(string $uid): Invoice ```php $uid = 'uid0'; -$result = $invoicesController->reopenInvoice($uid); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->reopenInvoice($uid); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -2006,10 +2096,20 @@ $body = VoidInvoiceRequestBuilder::init( )->build() )->build(); -$result = $invoicesController->voidInvoice( - $uid, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->voidInvoice( + $uid, + $body + ); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -2051,7 +2151,15 @@ $collect = [ 'direction' => Direction::ASC ]; -$result = $invoicesController->listConsolidatedInvoiceSegments($collect); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->listConsolidatedInvoiceSegments($collect); + echo 'ConsolidatedInvoice:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -2546,7 +2654,7 @@ function createInvoice(int $subscriptionId, ?CreateInvoiceRequest $body = null): | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?CreateInvoiceRequest`](../../doc/models/create-invoice-request.md) | Body, Optional | - | ## Response Type @@ -2576,10 +2684,20 @@ $body = CreateInvoiceRequestBuilder::init( ->build() )->build(); -$result = $invoicesController->createInvoice( - $subscriptionId, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->createInvoice( + $subscriptionId, + $body + ); + echo 'InvoiceResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -2690,6 +2808,8 @@ $result = $invoicesController->createInvoice( This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. +**File Attachments**: You can attach files to invoice emails using `attachment_urls[]` parameter by providing URLs to the files you want to attach. When using attachments, the request must use `multipart/form-data` content type. Max 10 files, 10MB per file. + If no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address. On success, a 204 no-content response will be returned. The response does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned. @@ -2732,10 +2852,18 @@ $body = SendInvoiceRequestBuilder::init() ) ->build(); -$invoicesController->sendInvoice( - $uid, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $invoicesController->sendInvoice( + $uid, + $body + ); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -2770,7 +2898,17 @@ function previewCustomerInformationChanges(string $uid): CustomerChangesPreviewR ```php $uid = 'uid0'; -$result = $invoicesController->previewCustomerInformationChanges($uid); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->previewCustomerInformationChanges($uid); + echo 'CustomerChangesPreviewResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -2859,7 +2997,17 @@ function updateCustomerInformation(string $uid): Invoice ```php $uid = 'uid0'; -$result = $invoicesController->updateCustomerInformation($uid); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->updateCustomerInformation($uid); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -3060,7 +3208,7 @@ $result = $invoicesController->updateCustomerInformation($uid); # Issue Invoice -This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. +This endpoint allows you to issue an invoice that is in "pending" or "draft" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. You cannot issue a pending child invoice that was created for a member subscription in a group. @@ -3096,10 +3244,20 @@ $body = IssueInvoiceRequestBuilder::init() ->onFailedPayment(FailedPaymentAction::LEAVE_OPEN_INVOICE) ->build(); -$result = $invoicesController->issueInvoice( - $uid, - $body -); +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->issueInvoice( + $uid, + $body + ); + echo 'Invoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md index 2210301..520b073 100644 --- a/doc/controllers/offers.md +++ b/doc/controllers/offers.md @@ -74,7 +74,17 @@ $body = CreateOfferRequestBuilder::init( ->build() )->build(); -$result = $offersController->createOffer($body); +$offersController = $client->getOffersController(); + +try { + $result = $offersController->createOffer($body); + echo 'OfferResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -155,7 +165,17 @@ $collect = [ 'includeArchived' => true ]; -$result = $offersController->listOffers($collect); +$offersController = $client->getOffersController(); + +try { + $result = $offersController->listOffers($collect); + echo 'ListOffersResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -243,7 +263,15 @@ function readOffer(int $offerId): OfferResponse ```php $offerId = 130; -$result = $offersController->readOffer($offerId); +$offersController = $client->getOffersController(); + +try { + $result = $offersController->readOffer($offerId); + echo 'OfferResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -270,7 +298,13 @@ function archiveOffer(int $offerId): void ```php $offerId = 130; -$offersController->archiveOffer($offerId); +$offersController = $client->getOffersController(); + +try { + $offersController->archiveOffer($offerId); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -297,6 +331,12 @@ function unarchiveOffer(int $offerId): void ```php $offerId = 130; -$offersController->unarchiveOffer($offerId); +$offersController = $client->getOffersController(); + +try { + $offersController->unarchiveOffer($offerId); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 0ed6438..f0d9525 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -129,7 +129,17 @@ $body = CreatePaymentProfileRequestBuilder::init( ->build() )->build(); -$result = $paymentProfilesController->createPaymentProfile($body); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->createPaymentProfile($body); + echo 'PaymentProfileResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -197,7 +207,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $paymentProfilesController->listPaymentProfiles($collect); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->listPaymentProfiles($collect); + echo 'PaymentProfileResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -323,7 +341,15 @@ function readPaymentProfile(int $paymentProfileId): PaymentProfileResponse ```php $paymentProfileId = 198; -$result = $paymentProfilesController->readPaymentProfile($paymentProfileId); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->readPaymentProfile($paymentProfileId); + echo 'PaymentProfileResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -437,10 +463,20 @@ $body = UpdatePaymentProfileRequestBuilder::init( ->build() )->build(); -$result = $paymentProfilesController->updatePaymentProfile( - $paymentProfileId, - $body -); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->updatePaymentProfile( + $paymentProfileId, + $body + ); + echo 'PaymentProfileResponse:'; + var_dump($result); +} catch (ErrorStringMapResponseException $exp) { + echo 'Caught ErrorStringMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -495,7 +531,15 @@ function deleteUnusedPaymentProfile(int $paymentProfileId): void ```php $paymentProfileId = 198; -$paymentProfilesController->deleteUnusedPaymentProfile($paymentProfileId); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $paymentProfilesController->deleteUnusedPaymentProfile($paymentProfileId); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -508,7 +552,7 @@ $paymentProfilesController->deleteUnusedPaymentProfile($paymentProfileId); # Delete Subscriptions Payment Profile -This will delete a payment profile belonging to the customer on the subscription. +Deletes a payment profile belonging to the customer on the subscription. + If the customer has multiple subscriptions, the payment profile will be removed from all of them. @@ -522,7 +566,7 @@ function deleteSubscriptionsPaymentProfile(int $subscriptionId, int $paymentProf | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile | ## Response Type @@ -536,10 +580,16 @@ $subscriptionId = 222; $paymentProfileId = 198; -$paymentProfilesController->deleteSubscriptionsPaymentProfile( - $subscriptionId, - $paymentProfileId -); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $paymentProfilesController->deleteSubscriptionsPaymentProfile( + $subscriptionId, + $paymentProfileId + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -577,10 +627,20 @@ $body = BankAccountVerificationRequestBuilder::init( ->build() )->build(); -$result = $paymentProfilesController->verifyBankAccount( - $bankAccountId, - $body -); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->verifyBankAccount( + $bankAccountId, + $body + ); + echo 'BankAccountResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -621,7 +681,7 @@ $result = $paymentProfilesController->verifyBankAccount( # Delete Subscription Group Payment Profile -This will delete a Payment Profile belonging to a Subscription Group. +Deletes a Payment Profile belonging to a Subscription Group. **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them. @@ -647,10 +707,16 @@ $uid = 'uid0'; $paymentProfileId = 198; -$paymentProfilesController->deleteSubscriptionGroupPaymentProfile( - $uid, - $paymentProfileId -); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $paymentProfilesController->deleteSubscriptionGroupPaymentProfile( + $uid, + $paymentProfileId + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -671,7 +737,7 @@ function changeSubscriptionDefaultPaymentProfile( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile | ## Response Type @@ -685,10 +751,20 @@ $subscriptionId = 222; $paymentProfileId = 198; -$result = $paymentProfilesController->changeSubscriptionDefaultPaymentProfile( - $subscriptionId, - $paymentProfileId -); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->changeSubscriptionDefaultPaymentProfile( + $subscriptionId, + $paymentProfileId + ); + echo 'PaymentProfileResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -761,10 +837,20 @@ $uid = 'uid0'; $paymentProfileId = 198; -$result = $paymentProfilesController->changeSubscriptionGroupDefaultPaymentProfile( - $uid, - $paymentProfileId -); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->changeSubscriptionGroupDefaultPaymentProfile( + $uid, + $paymentProfileId + ); + echo 'PaymentProfileResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -830,7 +916,17 @@ function readOneTimeToken(string $chargifyToken): GetOneTimeTokenRequest ```php $chargifyToken = 'chargify_token8'; -$result = $paymentProfilesController->readOneTimeToken($chargifyToken); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $result = $paymentProfilesController->readOneTimeToken($chargifyToken); + echo 'GetOneTimeTokenRequest:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -858,7 +954,7 @@ function sendRequestUpdatePaymentEmail(int $subscriptionId): void | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -869,7 +965,15 @@ function sendRequestUpdatePaymentEmail(int $subscriptionId): void ```php $subscriptionId = 222; -$paymentProfilesController->sendRequestUpdatePaymentEmail($subscriptionId); +$paymentProfilesController = $client->getPaymentProfilesController(); + +try { + $paymentProfilesController->sendRequestUpdatePaymentEmail($subscriptionId); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md index 1fe6f61..ea82d47 100644 --- a/doc/controllers/product-families.md +++ b/doc/controllers/product-families.md @@ -64,7 +64,15 @@ $collect = [ 'mInclude' => ListProductsInclude::PREPAID_PRODUCT_PRICE_POINT ]; -$result = $productFamiliesController->listProductsForProductFamily($collect); +$productFamiliesController = $client->getProductFamiliesController(); + +try { + $result = $productFamiliesController->listProductsForProductFamily($collect); + echo 'ProductResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -204,7 +212,17 @@ $body = CreateProductFamilyRequestBuilder::init( ->build() )->build(); -$result = $productFamiliesController->createProductFamily($body); +$productFamiliesController = $client->getProductFamiliesController(); + +try { + $result = $productFamiliesController->createProductFamily($body); + echo 'ProductFamilyResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -257,7 +275,15 @@ $collect = [ 'dateField' => BasicDateField::UPDATED_AT ]; -$result = $productFamiliesController->listProductFamilies($collect); +$productFamiliesController = $client->getProductFamiliesController(); + +try { + $result = $productFamiliesController->listProductFamilies($collect); + echo 'ProductFamilyResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -272,7 +298,8 @@ $result = $productFamiliesController->listProductFamilies($collect); "handle": "acme-projects", "accounting_code": null, "created_at": "2013-02-20T15:05:51-07:00", - "updated_at": "2013-02-20T15:05:51-07:00" + "updated_at": "2013-02-20T15:05:51-07:00", + "archived_at": null } }, { @@ -283,7 +310,8 @@ $result = $productFamiliesController->listProductFamilies($collect); "handle": "bat-family", "accounting_code": null, "created_at": "2014-04-16T12:41:13-06:00", - "updated_at": "2014-04-16T12:41:13-06:00" + "updated_at": "2014-04-16T12:41:13-06:00", + "archived_at": "2024-11-05T09:30:00-07:00" } } ] @@ -315,7 +343,15 @@ function readProductFamily(int $id): ProductFamilyResponse ```php $id = 112; -$result = $productFamiliesController->readProductFamily($id); +$productFamiliesController = $client->getProductFamiliesController(); + +try { + $result = $productFamiliesController->readProductFamily($id); + echo 'ProductFamilyResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -327,7 +363,8 @@ $result = $productFamiliesController->readProductFamily($id); "name": "Acme Projects", "description": "", "handle": "billing-plans", - "accounting_code": null + "accounting_code": null, + "archived_at": null } } ``` diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md index db14d84..b0a22b0 100644 --- a/doc/controllers/product-price-points.md +++ b/doc/controllers/product-price-points.md @@ -69,10 +69,20 @@ $body = CreateProductPricePointRequestBuilder::init( ->build() )->build(); -$result = $productPricePointsController->createProductPricePoint( - $productId, - $body -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->createProductPricePoint( + $productId, + $body + ); + echo 'ProductPricePointResponse:'; + var_dump($result); +} catch (ProductPricePointErrorResponseException $exp) { + echo 'Caught ProductPricePointErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -142,7 +152,15 @@ $collect = [ 'filterType' => Liquid error: Value cannot be null. (Parameter 'key') ]; -$result = $productPricePointsController->listProductPricePoints($collect); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->listProductPricePoints($collect); + echo 'ListProductPricePointsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -215,11 +233,19 @@ $body = UpdateProductPricePointRequestBuilder::init( ->build() )->build(); -$result = $productPricePointsController->updateProductPricePoint( - $productId, - $pricePointId, - $body -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->updateProductPricePoint( + $productId, + $pricePointId, + $body + ); + echo 'ProductPricePointResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -281,10 +307,18 @@ $productId = 124; $pricePointId = 188; -$result = $productPricePointsController->readProductPricePoint( - $productId, - $pricePointId -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->readProductPricePoint( + $productId, + $pricePointId + ); + echo 'ProductPricePointResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -341,10 +375,20 @@ $productId = 124; $pricePointId = 188; -$result = $productPricePointsController->archiveProductPricePoint( - $productId, - $pricePointId -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->archiveProductPricePoint( + $productId, + $pricePointId + ); + echo 'ProductPricePointResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -407,10 +451,18 @@ $productId = 202; $pricePointId = 10; -$result = $productPricePointsController->unarchiveProductPricePoint( - $productId, - $pricePointId -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->unarchiveProductPricePoint( + $productId, + $pricePointId + ); + echo 'ProductPricePointResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -469,10 +521,18 @@ $productId = 202; $pricePointId = 10; -$result = $productPricePointsController->promoteProductPricePointToDefault( - $productId, - $pricePointId -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->promoteProductPricePointToDefault( + $productId, + $pricePointId + ); + echo 'ProductResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -593,10 +653,18 @@ $body = BulkCreateProductPricePointsRequestBuilder::init( ] )->build(); -$result = $productPricePointsController->bulkCreateProductPricePoints( - $productId, - $body -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->bulkCreateProductPricePoints( + $productId, + $body + ); + echo 'BulkCreateProductPricePointsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -686,10 +754,20 @@ $body = CreateProductCurrencyPricesRequestBuilder::init( ] )->build(); -$result = $productPricePointsController->createProductCurrencyPrices( - $productPricePointId, - $body -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->createProductCurrencyPrices( + $productPricePointId, + $body + ); + echo 'CurrencyPricesResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -760,10 +838,20 @@ $body = UpdateCurrencyPricesRequestBuilder::init( ] )->build(); -$result = $productPricePointsController->updateProductCurrencyPrices( - $productPricePointId, - $body -); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->updateProductCurrencyPrices( + $productPricePointId, + $body + ); + echo 'CurrencyPricesResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -841,7 +929,17 @@ $collect = [ 'perPage' => 50 ]; -$result = $productPricePointsController->listAllProductPricePoints($collect); +$productPricePointsController = $client->getProductPricePointsController(); + +try { + $result = $productPricePointsController->listAllProductPricePoints($collect); + echo 'ListProductPricePointsResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/products.md b/doc/controllers/products.md index 3099ce9..d0d1371 100644 --- a/doc/controllers/products.md +++ b/doc/controllers/products.md @@ -63,10 +63,20 @@ $body = CreateOrUpdateProductRequestBuilder::init( ->build() )->build(); -$result = $productsController->createProduct( - $productFamilyId, - $body -); +$productsController = $client->getProductsController(); + +try { + $result = $productsController->createProduct( + $productFamilyId, + $body + ); + echo 'ProductResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -148,7 +158,15 @@ function readProduct(int $productId): ProductResponse ```php $productId = 202; -$result = $productsController->readProduct($productId); +$productsController = $client->getProductsController(); + +try { + $result = $productsController->readProduct($productId); + echo 'ProductResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -227,7 +245,17 @@ function updateProduct(int $productId, ?CreateOrUpdateProductRequest $body = nul ```php $productId = 202; -$result = $productsController->updateProduct($productId); +$productsController = $client->getProductsController(); + +try { + $result = $productsController->updateProduct($productId); + echo 'ProductResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -310,7 +338,17 @@ function archiveProduct(int $productId): ProductResponse ```php $productId = 202; -$result = $productsController->archiveProduct($productId); +$productsController = $client->getProductsController(); + +try { + $result = $productsController->archiveProduct($productId); + echo 'ProductResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -386,7 +424,15 @@ function readProductByHandle(string $apiHandle): ProductResponse ```php $apiHandle = 'api_handle6'; -$result = $productsController->readProductByHandle($apiHandle); +$productsController = $client->getProductsController(); + +try { + $result = $productsController->readProductByHandle($apiHandle); + echo 'ProductResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -505,7 +551,15 @@ $collect = [ 'mInclude' => ListProductsInclude::PREPAID_PRODUCT_PRICE_POINT ]; -$result = $productsController->listProducts($collect); +$productsController = $client->getProductsController(); + +try { + $result = $productsController->listProducts($collect); + echo 'ProductResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md index bc7cf2a..24223ca 100644 --- a/doc/controllers/proforma-invoices.md +++ b/doc/controllers/proforma-invoices.md @@ -13,6 +13,7 @@ $proformaInvoicesController = $client->getProformaInvoicesController(); * [Create Consolidated Proforma Invoice](../../doc/controllers/proforma-invoices.md#create-consolidated-proforma-invoice) * [List Subscription Group Proforma Invoices](../../doc/controllers/proforma-invoices.md#list-subscription-group-proforma-invoices) * [Read Proforma Invoice](../../doc/controllers/proforma-invoices.md#read-proforma-invoice) +* [Deliver Proforma Invoice](../../doc/controllers/proforma-invoices.md#deliver-proforma-invoice) * [Create Proforma Invoice](../../doc/controllers/proforma-invoices.md#create-proforma-invoice) * [List Proforma Invoices](../../doc/controllers/proforma-invoices.md#list-proforma-invoices) * [Void Proforma Invoice](../../doc/controllers/proforma-invoices.md#void-proforma-invoice) @@ -50,7 +51,15 @@ function createConsolidatedProformaInvoice(string $uid): void ```php $uid = 'uid0'; -$proformaInvoicesController->createConsolidatedProformaInvoice($uid); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $proformaInvoicesController->createConsolidatedProformaInvoice($uid); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -99,7 +108,15 @@ $collect = [ 'customFields' => false ]; -$result = $proformaInvoicesController->listSubscriptionGroupProformaInvoices($collect); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->listSubscriptionGroupProformaInvoices($collect); + echo 'ListProformaInvoicesResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -136,7 +153,88 @@ function readProformaInvoice(string $proformaInvoiceUid): ProformaInvoice ```php $proformaInvoiceUid = 'proforma_invoice_uid4'; -$result = $proformaInvoicesController->readProformaInvoice($proformaInvoiceUid); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->readProformaInvoice($proformaInvoiceUid); + echo 'ProformaInvoice:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | `ApiException` | + + +# Deliver Proforma Invoice + +Allows for proforma invoices to be programmatically delivered via email. Supports email +delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. + +If `recipient_emails` is omitted, the system will fall back to the primary recipient derived from the invoice or +subscription. At least one recipient must be present, either via the request body or via this default behavior, so an +empty body may still succeed when defaults are available. + +```php +function deliverProformaInvoice( + string $proformaInvoiceUid, + ?DeliverProformaInvoiceRequest $body = null +): ProformaInvoice +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `proformaInvoiceUid` | `string` | Template, Required | The uid of the proforma invoice | +| `body` | [`?DeliverProformaInvoiceRequest`](../../doc/models/deliver-proforma-invoice-request.md) | Body, Optional | - | + +## Response Type + +[`ProformaInvoice`](../../doc/models/proforma-invoice.md) + +## Example Usage + +```php +$proformaInvoiceUid = 'proforma_invoice_uid4'; + +$body = DeliverProformaInvoiceRequestBuilder::init() + ->recipientEmails( + [ + 'user0@example.com' + ] + ) + ->ccRecipientEmails( + [ + 'user1@example.com' + ] + ) + ->bccRecipientEmails( + [ + 'user2@example.com' + ] + ) + ->build(); + +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->deliverProformaInvoice( + $proformaInvoiceUid, + $body + ); + echo 'ProformaInvoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -144,6 +242,7 @@ $result = $proformaInvoicesController->readProformaInvoice($proformaInvoiceUid); | HTTP Status Code | Error Description | Exception Class | | --- | --- | --- | | 404 | Not Found | `ApiException` | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | # Create Proforma Invoice @@ -164,7 +263,7 @@ function createProformaInvoice(int $subscriptionId): ProformaInvoice | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -175,7 +274,17 @@ function createProformaInvoice(int $subscriptionId): ProformaInvoice ```php $subscriptionId = 222; -$result = $proformaInvoicesController->createProformaInvoice($subscriptionId); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->createProformaInvoice($subscriptionId); + echo 'ProformaInvoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -197,7 +306,7 @@ function listProformaInvoices(array $options): ListProformaInvoicesResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `startDate` | `?string` | Query, Optional | The beginning date range for the invoice's Due Date, in the YYYY-MM-DD format. | | `endDate` | `?string` | Query, Optional | The ending date range for the invoice's Due Date, in the YYYY-MM-DD format. | | `status` | [`?string(ProformaInvoiceStatus)`](../../doc/models/proforma-invoice-status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided | @@ -231,7 +340,15 @@ $collect = [ 'customFields' => false ]; -$result = $proformaInvoicesController->listProformaInvoices($collect); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->listProformaInvoices($collect); + echo 'ListProformaInvoicesResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -267,7 +384,17 @@ function voidProformaInvoice(string $proformaInvoiceUid, ?VoidInvoiceRequest $bo ```php $proformaInvoiceUid = 'proforma_invoice_uid4'; -$result = $proformaInvoicesController->voidProformaInvoice($proformaInvoiceUid); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->voidProformaInvoice($proformaInvoiceUid); + echo 'ProformaInvoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -296,7 +423,7 @@ function previewProformaInvoice(int $subscriptionId): ProformaInvoice | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -307,7 +434,17 @@ function previewProformaInvoice(int $subscriptionId): ProformaInvoice ```php $subscriptionId = 222; -$result = $proformaInvoicesController->previewProformaInvoice($subscriptionId); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->previewProformaInvoice($subscriptionId); + echo 'ProformaInvoice:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -358,7 +495,19 @@ $body = CreateSubscriptionRequestBuilder::init( ->build() )->build(); -$result = $proformaInvoicesController->createSignupProformaInvoice($body); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->createSignupProformaInvoice($body); + echo 'ProformaInvoice:'; + var_dump($result); +} catch (ProformaBadRequestErrorResponseException $exp) { + echo 'Caught ProformaBadRequestErrorResponseException:', $exp; +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -413,10 +562,22 @@ $body = CreateSubscriptionRequestBuilder::init( ->build() )->build(); -$result = $proformaInvoicesController->previewSignupProformaInvoice( - null, - $body -); +$proformaInvoicesController = $client->getProformaInvoicesController(); + +try { + $result = $proformaInvoicesController->previewSignupProformaInvoice( + null, + $body + ); + echo 'SignupProformaPreviewResponse:'; + var_dump($result); +} catch (ProformaBadRequestErrorResponseException $exp) { + echo 'Caught ProformaBadRequestErrorResponseException:', $exp; +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/reason-codes.md b/doc/controllers/reason-codes.md index 616e9d0..7c5da3f 100644 --- a/doc/controllers/reason-codes.md +++ b/doc/controllers/reason-codes.md @@ -61,7 +61,17 @@ $body = CreateReasonCodeRequestBuilder::init( ->build() )->build(); -$result = $reasonCodesController->createReasonCode($body); +$reasonCodesController = $client->getReasonCodesController(); + +try { + $result = $reasonCodesController->createReasonCode($body); + echo 'ReasonCodeResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -98,7 +108,17 @@ $collect = [ 'perPage' => 50 ]; -$result = $reasonCodesController->listReasonCodes($collect); +$reasonCodesController = $client->getReasonCodesController(); + +try { + $result = $reasonCodesController->listReasonCodes($collect); + echo 'ReasonCodeResponse[]:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -171,7 +191,15 @@ function readReasonCode(int $reasonCodeId): ReasonCodeResponse ```php $reasonCodeId = 32; -$result = $reasonCodesController->readReasonCode($reasonCodeId); +$reasonCodesController = $client->getReasonCodesController(); + +try { + $result = $reasonCodesController->readReasonCode($reasonCodeId); + echo 'ReasonCodeResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -205,7 +233,17 @@ function updateReasonCode(int $reasonCodeId, ?UpdateReasonCodeRequest $body = nu ```php $reasonCodeId = 32; -$result = $reasonCodesController->updateReasonCode($reasonCodeId); +$reasonCodesController = $client->getReasonCodesController(); + +try { + $result = $reasonCodesController->updateReasonCode($reasonCodeId); + echo 'ReasonCodeResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -239,7 +277,15 @@ function deleteReasonCode(int $reasonCodeId): OkResponse ```php $reasonCodeId = 32; -$result = $reasonCodesController->deleteReasonCode($reasonCodeId); +$reasonCodesController = $client->getReasonCodesController(); + +try { + $result = $reasonCodesController->deleteReasonCode($reasonCodeId); + echo 'OkResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/referral-codes.md b/doc/controllers/referral-codes.md index 504f918..7161f8e 100644 --- a/doc/controllers/referral-codes.md +++ b/doc/controllers/referral-codes.md @@ -40,7 +40,17 @@ function validateReferralCode(string $code): ReferralValidationResponse ```php $code = 'code8'; -$result = $referralCodesController->validateReferralCode($code); +$referralCodesController = $client->getReferralCodesController(); + +try { + $result = $referralCodesController->validateReferralCode($code); + echo 'ReferralValidationResponse:'; + var_dump($result); +} catch (SingleStringErrorResponseException $exp) { + echo 'Caught SingleStringErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/sales-commissions.md b/doc/controllers/sales-commissions.md index cb7f8ce..64698e1 100644 --- a/doc/controllers/sales-commissions.md +++ b/doc/controllers/sales-commissions.md @@ -55,7 +55,15 @@ $collect = [ 'perPage' => 100 ]; -$result = $salesCommissionsController->listSalesCommissionSettings($collect); +$salesCommissionsController = $client->getSalesCommissionsController(); + +try { + $result = $salesCommissionsController->listSalesCommissionSettings($collect); + echo 'SaleRepSettings[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -133,7 +141,15 @@ $collect = [ 'perPage' => 100 ]; -$result = $salesCommissionsController->listSalesReps($collect); +$salesCommissionsController = $client->getSalesCommissionsController(); + +try { + $result = $salesCommissionsController->listSalesReps($collect); + echo 'ListSaleRepItem[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -271,14 +287,22 @@ $page = 1; $perPage = 100; -$result = $salesCommissionsController->readSalesRep( - $sellerId, - $salesRepId, - $authorization, - null, - $page, - $perPage -); +$salesCommissionsController = $client->getSalesCommissionsController(); + +try { + $result = $salesCommissionsController->readSalesRep( + $sellerId, + $salesRepId, + $authorization, + null, + $page, + $perPage + ); + echo 'SaleRep:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/sites.md b/doc/controllers/sites.md index 63597e8..3285fc7 100644 --- a/doc/controllers/sites.md +++ b/doc/controllers/sites.md @@ -45,7 +45,15 @@ function readSite(): SiteResponse ## Example Usage ```php -$result = $sitesController->readSite(); +$sitesController = $client->getSitesController(); + +try { + $result = $sitesController->readSite(); + echo 'SiteResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -125,7 +133,13 @@ function clearSite(?string $cleanupScope = CleanupScope::ALL): void ```php $cleanupScope = CleanupScope::ALL; -$sitesController->clearSite($cleanupScope); +$sitesController = $client->getSitesController(); + +try { + $sitesController->clearSite($cleanupScope); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -156,7 +170,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $sitesController->listChargifyJsPublicKeys($collect); +$sitesController = $client->getSitesController(); + +try { + $result = $sitesController->listChargifyJsPublicKeys($collect); + echo 'ListPublicKeysResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index f765ad6..16d76de 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -41,7 +41,7 @@ function readSubscriptionComponent(int $subscriptionId, int $componentId): Subsc | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `componentId` | `int` | Template, Required | The Advanced Billing id of the component. Alternatively, the component's handle prefixed by `handle:` | ## Response Type @@ -55,10 +55,18 @@ $subscriptionId = 222; $componentId = 222; -$result = $subscriptionComponentsController->readSubscriptionComponent( - $subscriptionId, - $componentId -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->readSubscriptionComponent( + $subscriptionId, + $componentId + ); + echo 'SubscriptionComponentResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -103,7 +111,7 @@ function listSubscriptionComponents(array $options): array | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `dateField` | [`?string(SubscriptionListDateField)`](../../doc/models/subscription-list-date-field.md) | Query, Optional | The type of filter you'd like to apply to your search. Use in query `date_field=updated_at`. | | `direction` | [`?string(SortingDirection)`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | | `filter` | [`?ListSubscriptionComponentsFilter`](../../doc/models/list-subscription-components-filter.md) | Query, Optional | Filter to use for List Subscription Components operation | @@ -149,7 +157,15 @@ $collect = [ 'inUse' => true ]; -$result = $subscriptionComponentsController->listSubscriptionComponents($collect); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->listSubscriptionComponents($collect); + echo 'SubscriptionComponentResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -203,7 +219,7 @@ function bulkUpdateSubscriptionComponentsPricePoints( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?BulkComponentsPricePointAssignment`](../../doc/models/bulk-components-price-point-assignment.md) | Body, Optional | - | ## Response Type @@ -240,10 +256,20 @@ $body = BulkComponentsPricePointAssignmentBuilder::init() ) ->build(); -$result = $subscriptionComponentsController->bulkUpdateSubscriptionComponentsPricePoints( - $subscriptionId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->bulkUpdateSubscriptionComponentsPricePoints( + $subscriptionId, + $body + ); + echo 'BulkComponentsPricePointAssignment:'; + var_dump($result); +} catch (ComponentPricePointErrorException $exp) { + echo 'Caught ComponentPricePointErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -284,7 +310,7 @@ function bulkResetSubscriptionComponentsPricePoints(int $subscriptionId): Subscr | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -295,7 +321,15 @@ function bulkResetSubscriptionComponentsPricePoints(int $subscriptionId): Subscr ```php $subscriptionId = 222; -$result = $subscriptionComponentsController->bulkResetSubscriptionComponentsPricePoints($subscriptionId); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->bulkResetSubscriptionComponentsPricePoints($subscriptionId); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -401,41 +435,13 @@ $result = $subscriptionComponentsController->bulkResetSubscriptionComponentsPric # Allocate Component -This endpoint creates a new allocation, setting the current allocated quantity for the Component and recording a memo. - -**Notice**: Allocations can only be updated for Quantity, On/Off, and Prepaid Components. - -## Allocations Documentation - -Full documentation on how to record Allocations in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview). It is focused on how allocations operate within the Advanced Billing UI.It goes into greater detail on how the user interface will react when recording allocations. - -This documentation also goes into greater detail on how proration is taken into consideration when applying component allocations. - -## Proration Schemes +Creates an allocation, sets the current allocated quantity for the component, and records a memo. Allocations can only be updated for Quantity, On/Off, and Prepaid Components. -Changing the allocated quantity of a component mid-period can result in either a Charge or Credit being applied to the subscription. When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. +When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. -**Notice:** These proration and accural fields will be ignored for Prepaid Components since this component type always generate charges immediately without proration. +> **Note:** These proration and accural fields are ignored for Prepaid Components since this component type always generate charges immediately without proration. -For background information on prorated components and upgrade/downgrade schemes, see [Setting Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration). -See the tables below for valid values. - -| upgrade_charge | Definition                                                        | -|----------------|-------------------------------------------------------------------| -| `full`         | A charge is added for the full price of the component.            | -| `prorated`     | A charge is added for the prorated price of the component change. | -| `none`         | No charge is added.                                               | - -| downgrade_credit | Definition                                        | -|------------------|---------------------------------------------------| -| `full`           | A full price credit is added for the amount owed. | -| `prorated`       | A prorated credit is added for the amount owed.   | -| `none`           | No charge is added.                               | - -| accrue_charge | Definition                                                                                               | -|---------------|------------------------------------------------------------------------------------------------------------| -| `true`        | Attempt to charge the customer at next renewal. | -| `false`       | Attempt to charge the customer right away. If it fails, the charge will be accrued until the next renewal. | +For information on prorated components and upgrade/downgrade schemes, see [Setting Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration) ### Order of Resolution for upgrade_charge and downgrade_credit @@ -449,7 +455,9 @@ See the tables below for valid values. 1. Allocation API call top level (outside of the `allocations` array) 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) -**NOTE: Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong.** +> **Note:** Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong. + +For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) product Documentation. ```php function allocateComponent( @@ -463,7 +471,7 @@ function allocateComponent( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `componentId` | `int` | Template, Required | The Advanced Billing id of the component | | `body` | [`?CreateAllocationRequest`](../../doc/models/create-allocation-request.md) | Body, Optional | - | @@ -480,17 +488,76 @@ $componentId = 222; $body = CreateAllocationRequestBuilder::init( CreateAllocationBuilder::init( - 5 + 10 ) - ->memo('Recoding component purchase of Acme Support') + ->decimalQuantity('10.0') + ->previousQuantity(5) + ->decimalPreviousQuantity('5.0') + ->memo('Increase seats to 10') + ->prorationDowngradeScheme('prorate') + ->prorationUpgradeScheme('full-price-attempt-capture') + ->downgradeCredit(DowngradeCreditCreditType::PRORATED) + ->upgradeCharge(UpgradeChargeCreditType::FULL) + ->accrueCharge(false) + ->pricePointId( + 789 + ) + ->billingSchedule( + BillingScheduleBuilder::init() + ->initialBillingAt(DateTimeHelper::fromSimpleDate('2025-02-28')) + ->build() + ) + ->customPrice( + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 1, + '49.00' + ) + ->endingQuantity( + 25 + ) + ->build(), + PriceBuilder::init( + 26, + '39.00' + ) + ->endingQuantity( + null + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(1) + ->intervalUnit(IntervalUnit::MONTH) + ->listPricePointId(4321) + ->useDefaultListPrice(false) + ->renewPrepaidAllocation(false) + ->rolloverPrepaidRemainder(false) + ->expirationInterval(150) + ->expirationIntervalUnit(ExpirationIntervalUnit::NEVER) + ->build() + ) ->build() )->build(); -$result = $subscriptionComponentsController->allocateComponent( - $subscriptionId, - $componentId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->allocateComponent( + $subscriptionId, + $componentId, + $body + ); + echo 'AllocationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -536,21 +603,6 @@ This endpoint returns the 50 most recent Allocations, ordered by most recent fir When a subscription's on/off component has been toggled to on (`1`) or off (`0`), usage will be logged in this response. -## Querying data via Advanced Billing gem - -You can also query the current quantity via the [official Advanced Billing Gem.](http://github.com/chargify/chargify_api_ares) - -```# First way -component = Chargify::Subscription::Component.find(1, :params => {:subscription_id => 7}) -puts component.allocated_quantity -# => 23 - -# Second way -component = Chargify::Subscription.find(7).component(1) -puts component.allocated_quantity -# => 23 -``` - ```php function listAllocations(int $subscriptionId, int $componentId, ?int $page = 1): array ``` @@ -559,7 +611,7 @@ function listAllocations(int $subscriptionId, int $componentId, ?int $page = 1): | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `componentId` | `int` | Template, Required | The Advanced Billing id of the component | | `page` | `?int` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

**Constraints**: `>= 1` | @@ -576,11 +628,21 @@ $componentId = 222; $page = 1; -$result = $subscriptionComponentsController->listAllocations( - $subscriptionId, - $componentId, - $page -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->listAllocations( + $subscriptionId, + $componentId, + $page + ); + echo 'AllocationResponse[]:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -638,11 +700,25 @@ $result = $subscriptionComponentsController->listAllocations( # Allocate Components -Creates multiple allocations, setting the current allocated quantity for each of the components and recording a memo. The charges and/or credits that are created will be rolled up into a single total which is used to determine whether this is an upgrade or a downgrade. Be aware of the Order of Resolutions explained below in determining the proration scheme. +Creates multiple allocations, sets the current allocated quantity for each of the components, and recording a memo. A `component_id` is required for each allocation. + +The charges and/or credits that are created will be rolled up into a single total which is used to determine whether this is an upgrade or a downgrade. + +### Order of Resolution for upgrade_charge and downgrade_credit + +1. Per allocation in API call (within a single allocation of the `allocations` array) +2. [Component-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) +3. Allocation API call top level (outside of the `allocations` array) +4. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) -A `component_id` is required for each allocation. +### Order of Resolution for accrue charge -This endpoint only responds to JSON. It is not available for XML. +1. Allocation API call top level (outside of the `allocations` array) +2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations-Proration#proration-schemes) + +> **Note:** Proration uses the current price of the component as well as the current tax rates. Changes to either may cause the prorated charge/credit to be wrong. + +For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview) product Documentation. ```php function allocateComponents(int $subscriptionId, ?AllocateComponents $body = null): array @@ -652,7 +728,7 @@ function allocateComponents(int $subscriptionId, ?AllocateComponents $body = nul | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?AllocateComponents`](../../doc/models/allocate-components.md) | Body, Optional | - | ## Response Type @@ -685,10 +761,20 @@ $body = AllocateComponentsBuilder::init() ) ->build(); -$result = $subscriptionComponentsController->allocateComponents( - $subscriptionId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->allocateComponents( + $subscriptionId, + $body + ); + echo 'AllocationResponse[]:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -763,7 +849,7 @@ function previewAllocations( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?PreviewAllocationsRequest`](../../doc/models/preview-allocations-request.md) | Body, Optional | - | ## Response Type @@ -793,10 +879,20 @@ $body = PreviewAllocationsRequestBuilder::init( ->effectiveProrationDate(DateTimeHelper::fromSimpleDate('2023-11-01')) ->build(); -$result = $subscriptionComponentsController->previewAllocations( - $subscriptionId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->previewAllocations( + $subscriptionId, + $body + ); + echo 'AllocationPreviewResponse:'; + var_dump($result); +} catch (ComponentAllocationErrorException $exp) { + echo 'Caught ComponentAllocationErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -936,7 +1032,7 @@ function updatePrepaidUsageAllocationExpirationDate( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `componentId` | `int` | Template, Required | The Advanced Billing id of the component | | `allocationId` | `int` | Template, Required | The Advanced Billing id of the allocation | | `body` | [`?UpdateAllocationExpirationDate`](../../doc/models/update-allocation-expiration-date.md) | Body, Optional | - | @@ -962,12 +1058,20 @@ $body = UpdateAllocationExpirationDateBuilder::init() ) ->build(); -$subscriptionComponentsController->updatePrepaidUsageAllocationExpirationDate( - $subscriptionId, - $componentId, - $allocationId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $subscriptionComponentsController->updatePrepaidUsageAllocationExpirationDate( + $subscriptionId, + $componentId, + $allocationId, + $body + ); +} catch (SubscriptionComponentAllocationErrorException $exp) { + echo 'Caught SubscriptionComponentAllocationErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -1003,7 +1107,7 @@ function deletePrepaidUsageAllocation( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `componentId` | `int` | Template, Required | The Advanced Billing id of the component | | `allocationId` | `int` | Template, Required | The Advanced Billing id of the allocation | | `body` | [`?CreditSchemeRequest`](../../doc/models/credit-scheme-request.md) | Body, Optional | - | @@ -1025,12 +1129,20 @@ $body = CreditSchemeRequestBuilder::init( CreditScheme::NONE )->build(); -$subscriptionComponentsController->deletePrepaidUsageAllocation( - $subscriptionId, - $componentId, - $allocationId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $subscriptionComponentsController->deletePrepaidUsageAllocation( + $subscriptionId, + $componentId, + $allocationId, + $body + ); +} catch (SubscriptionComponentAllocationErrorException $exp) { + echo 'Caught SubscriptionComponentAllocationErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -1126,11 +1238,21 @@ $body = CreateUsageRequestBuilder::init( ->build() )->build(); -$result = $subscriptionComponentsController->createUsage( - $subscriptionIdOrReference, - $componentId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->createUsage( + $subscriptionIdOrReference, + $componentId, + $body + ); + echo 'UsageResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1206,7 +1328,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $subscriptionComponentsController->listUsages($collect); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->listUsages($collect); + echo 'UsageResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1306,11 +1436,17 @@ $body = ActivateEventBasedComponentBuilder::init() ) ->build(); -$subscriptionComponentsController->activateEventBasedComponent( - $subscriptionId, - $componentId, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $subscriptionComponentsController->activateEventBasedComponent( + $subscriptionId, + $componentId, + $body + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -1340,10 +1476,16 @@ $subscriptionId = 222; $componentId = 222; -$subscriptionComponentsController->deactivateEventBasedComponent( - $subscriptionId, - $componentId -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $subscriptionComponentsController->deactivateEventBasedComponent( + $subscriptionId, + $componentId + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -1399,11 +1541,17 @@ $body = EBBEventBuilder::init() ) ->build(); -$subscriptionComponentsController->recordEvent( - $apiHandle, - null, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $subscriptionComponentsController->recordEvent( + $apiHandle, + null, + $body + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -1447,11 +1595,17 @@ $body = [ ->build() ]; -$subscriptionComponentsController->bulkRecordEvents( - $apiHandle, - null, - $body -); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $subscriptionComponentsController->bulkRecordEvents( + $apiHandle, + null, + $body + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -1516,6 +1670,14 @@ $collect = [ 'mInclude' => ListSubscriptionComponentsInclude::SUBSCRIPTION ]; -$result = $subscriptionComponentsController->listSubscriptionComponentsForSite($collect); +$subscriptionComponentsController = $client->getSubscriptionComponentsController(); + +try { + $result = $subscriptionComponentsController->listSubscriptionComponentsForSite($collect); + echo 'ListSubscriptionComponentsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` diff --git a/doc/controllers/subscription-group-invoice-account.md b/doc/controllers/subscription-group-invoice-account.md index dd41617..4204f08 100644 --- a/doc/controllers/subscription-group-invoice-account.md +++ b/doc/controllers/subscription-group-invoice-account.md @@ -43,7 +43,17 @@ function createSubscriptionGroupPrepayment( ```php $uid = 'uid0'; -$result = $subscriptionGroupInvoiceAccountController->createSubscriptionGroupPrepayment($uid); +$subscriptionGroupInvoiceAccountController = $client->getSubscriptionGroupInvoiceAccountController(); + +try { + $result = $subscriptionGroupInvoiceAccountController->createSubscriptionGroupPrepayment($uid); + echo 'SubscriptionGroupPrepaymentResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -100,7 +110,15 @@ $collect = [ ->build() ]; -$result = $subscriptionGroupInvoiceAccountController->listPrepaymentsForSubscriptionGroup($collect); +$subscriptionGroupInvoiceAccountController = $client->getSubscriptionGroupInvoiceAccountController(); + +try { + $result = $subscriptionGroupInvoiceAccountController->listPrepaymentsForSubscriptionGroup($collect); + echo 'ListSubscriptionGroupPrepaymentResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -167,10 +185,20 @@ $body = IssueServiceCreditRequestBuilder::init( ->build() )->build(); -$result = $subscriptionGroupInvoiceAccountController->issueSubscriptionGroupServiceCredit( - $uid, - $body -); +$subscriptionGroupInvoiceAccountController = $client->getSubscriptionGroupInvoiceAccountController(); + +try { + $result = $subscriptionGroupInvoiceAccountController->issueSubscriptionGroupServiceCredit( + $uid, + $body + ); + echo 'ServiceCreditResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -229,10 +257,20 @@ $body = DeductServiceCreditRequestBuilder::init( ->build() )->build(); -$result = $subscriptionGroupInvoiceAccountController->deductSubscriptionGroupServiceCredit( - $uid, - $body -); +$subscriptionGroupInvoiceAccountController = $client->getSubscriptionGroupInvoiceAccountController(); + +try { + $result = $subscriptionGroupInvoiceAccountController->deductSubscriptionGroupServiceCredit( + $uid, + $body + ); + echo 'ServiceCredit:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/subscription-group-status.md b/doc/controllers/subscription-group-status.md index 6e310c1..13ce287 100644 --- a/doc/controllers/subscription-group-status.md +++ b/doc/controllers/subscription-group-status.md @@ -46,10 +46,18 @@ $body = CancelGroupedSubscriptionsRequestBuilder::init() ->chargeUnbilledUsage(true) ->build(); -$subscriptionGroupStatusController->cancelSubscriptionsInGroup( - $uid, - $body -); +$subscriptionGroupStatusController = $client->getSubscriptionGroupStatusController(); + +try { + $subscriptionGroupStatusController->cancelSubscriptionsInGroup( + $uid, + $body + ); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -84,7 +92,15 @@ function initiateDelayedCancellationForGroup(string $uid): void ```php $uid = 'uid0'; -$subscriptionGroupStatusController->initiateDelayedCancellationForGroup($uid); +$subscriptionGroupStatusController = $client->getSubscriptionGroupStatusController(); + +try { + $subscriptionGroupStatusController->initiateDelayedCancellationForGroup($uid); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -117,7 +133,15 @@ function cancelDelayedCancellationForGroup(string $uid): void ```php $uid = 'uid0'; -$subscriptionGroupStatusController->cancelDelayedCancellationForGroup($uid); +$subscriptionGroupStatusController = $client->getSubscriptionGroupStatusController(); + +try { + $subscriptionGroupStatusController->cancelDelayedCancellationForGroup($uid); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -176,10 +200,20 @@ $body = ReactivateSubscriptionGroupRequestBuilder::init() ->resume(true) ->build(); -$result = $subscriptionGroupStatusController->reactivateSubscriptionGroup( - $uid, - $body -); +$subscriptionGroupStatusController = $client->getSubscriptionGroupStatusController(); + +try { + $result = $subscriptionGroupStatusController->reactivateSubscriptionGroup( + $uid, + $body + ); + echo 'ReactivateSubscriptionGroupResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md index 3f7f392..5da4351 100644 --- a/doc/controllers/subscription-groups.md +++ b/doc/controllers/subscription-groups.md @@ -74,7 +74,17 @@ $body = SubscriptionGroupSignupRequestBuilder::init( ->build() )->build(); -$result = $subscriptionGroupsController->signupWithSubscriptionGroup($body); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->signupWithSubscriptionGroup($body); + echo 'SubscriptionGroupSignupResponse:'; + var_dump($result); +} catch (SubscriptionGroupSignupErrorResponseException $exp) { + echo 'Caught SubscriptionGroupSignupErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -119,7 +129,17 @@ $body = CreateSubscriptionGroupRequestBuilder::init( ->build() )->build(); -$result = $subscriptionGroupsController->createSubscriptionGroup($body); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->createSubscriptionGroup($body); + echo 'SubscriptionGroupResponse:'; + var_dump($result); +} catch (SubscriptionGroupCreateErrorResponseException $exp) { + echo 'Caught SubscriptionGroupCreateErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -127,6 +147,7 @@ $result = $subscriptionGroupsController->createSubscriptionGroup($body); ```json { "subscription_group": { + "uid": "grp_952mvqcnk53wq", "customer_id": 1, "payment_profile": { "id": 1, @@ -186,7 +207,15 @@ $collect = [ ] ]; -$result = $subscriptionGroupsController->listSubscriptionGroups($collect); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->listSubscriptionGroups($collect); + echo 'ListSubscriptionGroupsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -260,10 +289,18 @@ $include = [ SubscriptionGroupInclude::CURRENT_BILLING_AMOUNT_IN_CENTS ]; -$result = $subscriptionGroupsController->readSubscriptionGroup( - $uid, - $include -); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->readSubscriptionGroup( + $uid, + $include + ); + echo 'FullSubscriptionGroupResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -349,10 +386,20 @@ $body = UpdateSubscriptionGroupRequestBuilder::init( ->build() )->build(); -$result = $subscriptionGroupsController->updateSubscriptionGroupMembers( - $uid, - $body -); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->updateSubscriptionGroupMembers( + $uid, + $body + ); + echo 'SubscriptionGroupResponse:'; + var_dump($result); +} catch (SubscriptionGroupUpdateErrorResponseException $exp) { + echo 'Caught SubscriptionGroupUpdateErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -385,8 +432,8 @@ $result = $subscriptionGroupsController->updateSubscriptionGroupMembers( # Delete Subscription Group -Use this endpoint to delete subscription group. -Only groups without members can be deleted +Deletes a subscription group. +Only groups without members can be deleted. ```php function deleteSubscriptionGroup(string $uid): DeleteSubscriptionGroupResponse @@ -407,7 +454,15 @@ function deleteSubscriptionGroup(string $uid): DeleteSubscriptionGroupResponse ```php $uid = 'uid0'; -$result = $subscriptionGroupsController->deleteSubscriptionGroup($uid); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->deleteSubscriptionGroup($uid); + echo 'DeleteSubscriptionGroupResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -451,7 +506,15 @@ function findSubscriptionGroup(string $subscriptionId): FullSubscriptionGroupRes ```php $subscriptionId = 'subscription_id0'; -$result = $subscriptionGroupsController->findSubscriptionGroup($subscriptionId); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->findSubscriptionGroup($subscriptionId); + echo 'FullSubscriptionGroupResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -530,7 +593,7 @@ function addSubscriptionToGroup( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?AddSubscriptionToAGroup`](../../doc/models/add-subscription-to-a-group.md) | Body, Optional | - | ## Response Type @@ -562,10 +625,18 @@ $body = AddSubscriptionToAGroupBuilder::init() ) ->build(); -$result = $subscriptionGroupsController->addSubscriptionToGroup( - $subscriptionId, - $body -); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $result = $subscriptionGroupsController->addSubscriptionToGroup( + $subscriptionId, + $body + ); + echo 'SubscriptionGroupResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -603,7 +674,7 @@ function removeSubscriptionFromGroup(int $subscriptionId): void | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -614,7 +685,15 @@ function removeSubscriptionFromGroup(int $subscriptionId): void ```php $subscriptionId = 222; -$subscriptionGroupsController->removeSubscriptionFromGroup($subscriptionId); +$subscriptionGroupsController = $client->getSubscriptionGroupsController(); + +try { + $subscriptionGroupsController->removeSubscriptionFromGroup($subscriptionId); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/subscription-invoice-account.md b/doc/controllers/subscription-invoice-account.md index 9fc5ffd..e818b42 100644 --- a/doc/controllers/subscription-invoice-account.md +++ b/doc/controllers/subscription-invoice-account.md @@ -31,7 +31,7 @@ function readAccountBalances(int $subscriptionId): AccountBalances | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -42,7 +42,15 @@ function readAccountBalances(int $subscriptionId): AccountBalances ```php $subscriptionId = 222; -$result = $subscriptionInvoiceAccountController->readAccountBalances($subscriptionId); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $result = $subscriptionInvoiceAccountController->readAccountBalances($subscriptionId); + echo 'AccountBalances:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -64,7 +72,7 @@ function createPrepayment(int $subscriptionId, ?CreatePrepaymentRequest $body = | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?CreatePrepaymentRequest`](../../doc/models/create-prepayment-request.md) | Body, Optional | - | ## Response Type @@ -85,10 +93,18 @@ $body = CreatePrepaymentRequestBuilder::init( )->build() )->build(); -$result = $subscriptionInvoiceAccountController->createPrepayment( - $subscriptionId, - $body -); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $result = $subscriptionInvoiceAccountController->createPrepayment( + $subscriptionId, + $body + ); + echo 'CreatePrepaymentResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -126,7 +142,7 @@ function listPrepayments(array $options): PrepaymentsResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `page` | `?int` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

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

**Default**: `20`

**Constraints**: `<= 200` | | `filter` | [`?ListPrepaymentsFilter`](../../doc/models/list-prepayments-filter.md) | Query, Optional | Filter to use for List Prepayments operations | @@ -149,7 +165,15 @@ $collect = [ ->build() ]; -$result = $subscriptionInvoiceAccountController->listPrepayments($collect); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $result = $subscriptionInvoiceAccountController->listPrepayments($collect); + echo 'PrepaymentsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -192,7 +216,7 @@ function issueServiceCredit(int $subscriptionId, ?IssueServiceCreditRequest $bod | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?IssueServiceCreditRequest`](../../doc/models/issue-service-credit-request.md) | Body, Optional | - | ## Response Type @@ -210,10 +234,18 @@ $body = IssueServiceCreditRequestBuilder::init( )->build() )->build(); -$result = $subscriptionInvoiceAccountController->issueServiceCredit( - $subscriptionId, - $body -); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $result = $subscriptionInvoiceAccountController->issueServiceCredit( + $subscriptionId, + $body + ); + echo 'ServiceCredit:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -247,7 +279,7 @@ function deductServiceCredit(int $subscriptionId, ?DeductServiceCreditRequest $b | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?DeductServiceCreditRequest`](../../doc/models/deduct-service-credit-request.md) | Body, Optional | - | ## Response Type @@ -267,10 +299,16 @@ $body = DeductServiceCreditRequestBuilder::init( ->build() )->build(); -$subscriptionInvoiceAccountController->deductServiceCredit( - $subscriptionId, - $body -); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $subscriptionInvoiceAccountController->deductServiceCredit( + $subscriptionId, + $body + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -297,7 +335,7 @@ function listServiceCredits( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `page` | `?int` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

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

**Default**: `20`

**Constraints**: `<= 200` | | `direction` | [`?string(SortingDirection)`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | @@ -315,11 +353,21 @@ $page = 1; $perPage = 50; -$result = $subscriptionInvoiceAccountController->listServiceCredits( - $subscriptionId, - $page, - $perPage -); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $result = $subscriptionInvoiceAccountController->listServiceCredits( + $subscriptionId, + $page, + $perPage + ); + echo 'ListServiceCreditsResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -377,7 +425,7 @@ function refundPrepayment( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `prepaymentId` | `int` | Template, Required | id of prepayment | | `body` | [`?RefundPrepaymentRequest`](../../doc/models/refund-prepayment-request.md) | Body, Optional | - | @@ -392,10 +440,20 @@ $subscriptionId = 222; $prepaymentId = 228; -$result = $subscriptionInvoiceAccountController->refundPrepayment( - $subscriptionId, - $prepaymentId -); +$subscriptionInvoiceAccountController = $client->getSubscriptionInvoiceAccountController(); + +try { + $result = $subscriptionInvoiceAccountController->refundPrepayment( + $subscriptionId, + $prepaymentId + ); + echo 'PrepaymentResponse:'; + var_dump($result); +} catch (RefundPrepaymentBaseErrorsResponseException $exp) { + echo 'Caught RefundPrepaymentBaseErrorsResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md index bd2ba6d..c92fc6c 100644 --- a/doc/controllers/subscription-notes.md +++ b/doc/controllers/subscription-notes.md @@ -40,7 +40,7 @@ function createSubscriptionNote( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?UpdateSubscriptionNoteRequest`](../../doc/models/update-subscription-note-request.md) | Body, Optional | Updatable fields for Subscription Note | ## Response Type @@ -59,10 +59,20 @@ $body = UpdateSubscriptionNoteRequestBuilder::init( )->build() )->build(); -$result = $subscriptionNotesController->createSubscriptionNote( - $subscriptionId, - $body -); +$subscriptionNotesController = $client->getSubscriptionNotesController(); + +try { + $result = $subscriptionNotesController->createSubscriptionNote( + $subscriptionId, + $body + ); + echo 'SubscriptionNoteResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -84,7 +94,7 @@ function listSubscriptionNotes(array $options): array | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `page` | `?int` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
Use in query `page=1`.

**Default**: `1`

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

**Default**: `20`

**Constraints**: `<= 200` | @@ -101,7 +111,17 @@ $collect = [ 'perPage' => 50 ]; -$result = $subscriptionNotesController->listSubscriptionNotes($collect); +$subscriptionNotesController = $client->getSubscriptionNotesController(); + +try { + $result = $subscriptionNotesController->listSubscriptionNotes($collect); + echo 'SubscriptionNoteResponse[]:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -150,7 +170,7 @@ function readSubscriptionNote(int $subscriptionId, int $noteId): SubscriptionNot | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `noteId` | `int` | Template, Required | The Advanced Billing id of the note | ## Response Type @@ -164,10 +184,18 @@ $subscriptionId = 222; $noteId = 66; -$result = $subscriptionNotesController->readSubscriptionNote( - $subscriptionId, - $noteId -); +$subscriptionNotesController = $client->getSubscriptionNotesController(); + +try { + $result = $subscriptionNotesController->readSubscriptionNote( + $subscriptionId, + $noteId + ); + echo 'SubscriptionNoteResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -202,7 +230,7 @@ function updateSubscriptionNote( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `noteId` | `int` | Template, Required | The Advanced Billing id of the note | | `body` | [`?UpdateSubscriptionNoteRequest`](../../doc/models/update-subscription-note-request.md) | Body, Optional | Updatable fields for Subscription Note | @@ -224,11 +252,21 @@ $body = UpdateSubscriptionNoteRequestBuilder::init( )->build() )->build(); -$result = $subscriptionNotesController->updateSubscriptionNote( - $subscriptionId, - $noteId, - $body -); +$subscriptionNotesController = $client->getSubscriptionNotesController(); + +try { + $result = $subscriptionNotesController->updateSubscriptionNote( + $subscriptionId, + $noteId, + $body + ); + echo 'SubscriptionNoteResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -240,7 +278,7 @@ $result = $subscriptionNotesController->updateSubscriptionNote( # Delete Subscription Note -Use the following method to delete a note for a Subscription. +Deletes a note for a Subscription. ```php function deleteSubscriptionNote(int $subscriptionId, int $noteId): void @@ -250,7 +288,7 @@ function deleteSubscriptionNote(int $subscriptionId, int $noteId): void | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `noteId` | `int` | Template, Required | The Advanced Billing id of the note | ## Response Type @@ -264,9 +302,15 @@ $subscriptionId = 222; $noteId = 66; -$subscriptionNotesController->deleteSubscriptionNote( - $subscriptionId, - $noteId -); +$subscriptionNotesController = $client->getSubscriptionNotesController(); + +try { + $subscriptionNotesController->deleteSubscriptionNote( + $subscriptionId, + $noteId + ); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md index 6368b5a..e88c7d3 100644 --- a/doc/controllers/subscription-products.md +++ b/doc/controllers/subscription-products.md @@ -84,7 +84,7 @@ function migrateSubscriptionProduct( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?SubscriptionProductMigrationRequest`](../../doc/models/subscription-product-migration-request.md) | Body, Optional | - | ## Response Type @@ -106,10 +106,20 @@ $body = SubscriptionProductMigrationRequestBuilder::init( ->build() )->build(); -$result = $subscriptionProductsController->migrateSubscriptionProduct( - $subscriptionId, - $body -); +$subscriptionProductsController = $client->getSubscriptionProductsController(); + +try { + $result = $subscriptionProductsController->migrateSubscriptionProduct( + $subscriptionId, + $body + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -262,7 +272,7 @@ function previewSubscriptionProductMigration( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?SubscriptionMigrationPreviewRequest`](../../doc/models/subscription-migration-preview-request.md) | Body, Optional | - | ## Response Type @@ -283,10 +293,20 @@ $body = SubscriptionMigrationPreviewRequestBuilder::init( ->build() )->build(); -$result = $subscriptionProductsController->previewSubscriptionProductMigration( - $subscriptionId, - $body -); +$subscriptionProductsController = $client->getSubscriptionProductsController(); + +try { + $result = $subscriptionProductsController->previewSubscriptionProductMigration( + $subscriptionId, + $body + ); + echo 'SubscriptionMigrationPreviewResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/subscription-renewals.md b/doc/controllers/subscription-renewals.md new file mode 100644 index 0000000..124c32f --- /dev/null +++ b/doc/controllers/subscription-renewals.md @@ -0,0 +1,1019 @@ +# Subscription Renewals + +```php +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); +``` + +## Class Name + +`SubscriptionRenewalsController` + +## Methods + +* [Create Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#create-scheduled-renewal-configuration) +* [List Scheduled Renewal Configurations](../../doc/controllers/subscription-renewals.md#list-scheduled-renewal-configurations) +* [Read Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#read-scheduled-renewal-configuration) +* [Update Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#update-scheduled-renewal-configuration) +* [Schedule Scheduled Renewal Lock In](../../doc/controllers/subscription-renewals.md#schedule-scheduled-renewal-lock-in) +* [Lock in Scheduled Renewal Immediately](../../doc/controllers/subscription-renewals.md#lock-in-scheduled-renewal-immediately) +* [Unpublish Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#unpublish-scheduled-renewal-configuration) +* [Cancel Scheduled Renewal Configuration](../../doc/controllers/subscription-renewals.md#cancel-scheduled-renewal-configuration) +* [Create Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#create-scheduled-renewal-configuration-item) +* [Update Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#update-scheduled-renewal-configuration-item) +* [Delete Scheduled Renewal Configuration Item](../../doc/controllers/subscription-renewals.md#delete-scheduled-renewal-configuration-item) + + +# Create Scheduled Renewal Configuration + +Creates a scheduled renewal configuration for a subscription. The scheduled renewal is based on the subscription’s current product and component setup. + +```php +function createScheduledRenewalConfiguration( + int $subscriptionId, + ?ScheduledRenewalConfigurationRequest $body = null +): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `body` | [`?ScheduledRenewalConfigurationRequest`](../../doc/models/scheduled-renewal-configuration-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$body = ScheduledRenewalConfigurationRequestBuilder::init( + ScheduledRenewalConfigurationRequestBodyBuilder::init() + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2024-12-01T00:00:00Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2025-12-01T00:00:00Z')) + ->lockInAt(DateTimeHelper::fromRfc3339DateTime('2024-11-15T00:00:00Z')) + ->contractId(222) + ->build() +)->build(); + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->createScheduledRenewalConfiguration( + $subscriptionId, + $body + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio_id-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# List Scheduled Renewal Configurations + +Lists scheduled renewal configurations for the subscription and permits an optional status query filter. + +```php +function listScheduledRenewalConfigurations( + int $subscriptionId, + ?string $status = null +): ScheduledRenewalConfigurationsResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `status` | [`?string(Status)`](../../doc/models/status.md) | Query, Optional | (Optional) Status filter for scheduled renewal configurations. | + +## Response Type + +[`ScheduledRenewalConfigurationsResponse`](../../doc/models/scheduled-renewal-configurations-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->listScheduledRenewalConfigurations($subscriptionId); + echo 'ScheduledRenewalConfigurationsResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configurations": [ + { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } + ] +} +``` + + +# Read Scheduled Renewal Configuration + +Retrieves the configuration settings for the scheduled renewal. + +```php +function readScheduledRenewalConfiguration(int $subscriptionId, int $id): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `id` | `int` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$id = 112; + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->readScheduledRenewalConfiguration( + $subscriptionId, + $id + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2024-12-01T00:00:00Z", + "ends_at": "2025-12-01T00:00:00Z", + "lock_in_at": "2024-11-15T00:00:00Z", + "created_at": "2024-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2024-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + + +# Update Scheduled Renewal Configuration + +Updates an existing configuration. + +```php +function updateScheduledRenewalConfiguration( + int $subscriptionId, + int $id, + ?ScheduledRenewalConfigurationRequest $body = null +): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `id` | `int` | Template, Required | The renewal id. | +| `body` | [`?ScheduledRenewalConfigurationRequest`](../../doc/models/scheduled-renewal-configuration-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$id = 112; + +$body = ScheduledRenewalConfigurationRequestBuilder::init( + ScheduledRenewalConfigurationRequestBodyBuilder::init() + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2025-12-01T00:00:00Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2026-12-01T00:00:00Z')) + ->lockInAt(DateTimeHelper::fromRfc3339DateTime('2025-11-15T00:00:00Z')) + ->build() +)->build(); + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->updateScheduledRenewalConfiguration( + $subscriptionId, + $id, + $body + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Schedule Scheduled Renewal Lock In + +Schedules a future lock-in date for the renewal. + +```php +function scheduleScheduledRenewalLockIn( + int $subscriptionId, + int $id, + ?ScheduledRenewalLockInRequest $body = null +): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `id` | `int` | Template, Required | The renewal id. | +| `body` | [`?ScheduledRenewalLockInRequest`](../../doc/models/scheduled-renewal-lock-in-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$id = 112; + +$body = ScheduledRenewalLockInRequestBuilder::init( + DateTimeHelper::fromSimpleDateRequired('2025-11-15') +)->build(); + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->scheduleScheduledRenewalLockIn( + $subscriptionId, + $id, + $body + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 123, + "site_id": 456, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 789, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 123, + "item_id": 4, + "item_type": "Product", + "item_subclass": "Product", + "price_point_id": 7, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 107, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Lock in Scheduled Renewal Immediately + +Locks in the renewal immediately. + +```php +function lockInScheduledRenewalImmediately(int $subscriptionId, int $id): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `id` | `int` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$id = 112; + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->lockInScheduledRenewalImmediately( + $subscriptionId, + $id + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "scheduled", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222, + "maxio_id": "maxio-id", + "number": null, + "register": { + "id": 12, + "maxio_id": "maxio-id", + "name": "Register", + "currency_code": "USD" + } + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Unpublish Scheduled Renewal Configuration + +Returns a scheduled renewal configuration to an editable state. + +```php +function unpublishScheduledRenewalConfiguration( + int $subscriptionId, + int $id +): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `id` | `int` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$id = 112; + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->unpublishScheduledRenewalConfiguration( + $subscriptionId, + $id + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "draft", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222 + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Cancel Scheduled Renewal Configuration + +Cancels a scheduled renewal configuration. + +```php +function cancelScheduledRenewalConfiguration( + int $subscriptionId, + int $id +): ScheduledRenewalConfigurationResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `id` | `int` | Template, Required | The renewal id. | + +## Response Type + +[`ScheduledRenewalConfigurationResponse`](../../doc/models/scheduled-renewal-configuration-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$id = 112; + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->cancelScheduledRenewalConfiguration( + $subscriptionId, + $id + ); + echo 'ScheduledRenewalConfigurationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration": { + "id": 987, + "site_id": 321, + "subscription_id": 12345, + "starts_at": "2025-12-01T00:00:00Z", + "ends_at": "2026-12-01T00:00:00Z", + "lock_in_at": "2025-11-15T00:00:00Z", + "created_at": "2025-09-01T12:00:00Z", + "status": "canceled", + "scheduled_renewal_configuration_items": [ + { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } + ], + "contract": { + "id": 222 + } + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Create Scheduled Renewal Configuration Item + +Adds product and component line items to the scheduled renewal. + +```php +function createScheduledRenewalConfigurationItem( + int $subscriptionId, + int $scheduledRenewalsConfigurationId, + ?ScheduledRenewalConfigurationItemRequest $body = null +): ScheduledRenewalConfigurationItemResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `scheduledRenewalsConfigurationId` | `int` | Template, Required | The scheduled renewal configuration id. | +| `body` | [`?ScheduledRenewalConfigurationItemRequest`](../../doc/models/scheduled-renewal-configuration-item-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationItemResponse`](../../doc/models/scheduled-renewal-configuration-item-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$scheduledRenewalsConfigurationId = 250; + +$body = ScheduledRenewalConfigurationItemRequestBuilder::init( + ScheduledRenewalItemRequestBodyComponentBuilder::init( + 57 + ) + ->quantity(1) + ->customPrice( + ScheduledRenewalComponentCustomPriceBuilder::init( + PricingScheme::STAIRSTEP, + [ + PriceBuilder::init( + 1, + 5 + ) + ->endingQuantity( + null + ) + ->build() + ] + )->build() + )->build() +)->build(); + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->createScheduledRenewalConfigurationItem( + $subscriptionId, + $scheduledRenewalsConfigurationId, + $body + ); + echo 'ScheduledRenewalConfigurationItemResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Product", + "item_subclass": "SubscriptionProduct", + "price_point_id": 73, + "price_point_type": "ProductPricePoint", + "quantity": 1, + "decimal_quantity": "1.0", + "created_at": "2025-09-01T12:00:00Z" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Update Scheduled Renewal Configuration Item + +Updates an existing configuration item’s pricing and quantity. + +```php +function updateScheduledRenewalConfigurationItem( + int $subscriptionId, + int $scheduledRenewalsConfigurationId, + int $id, + ?ScheduledRenewalUpdateRequest $body = null +): ScheduledRenewalConfigurationItemResponse +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `scheduledRenewalsConfigurationId` | `int` | Template, Required | The scheduled renewal configuration id. | +| `id` | `int` | Template, Required | The scheduled renewal configuration item id. | +| `body` | [`?ScheduledRenewalUpdateRequest`](../../doc/models/scheduled-renewal-update-request.md) | Body, Optional | - | + +## Response Type + +[`ScheduledRenewalConfigurationItemResponse`](../../doc/models/scheduled-renewal-configuration-item-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$scheduledRenewalsConfigurationId = 250; + +$id = 112; + +$body = ScheduledRenewalUpdateRequestBuilder::init( + ScheduledRenewalItemRequestBodyComponentBuilder::init( + 57 + ) + ->quantity(2) + ->customPrice( + ScheduledRenewalComponentCustomPriceBuilder::init( + PricingScheme::STAIRSTEP, + [ + PriceBuilder::init( + 1, + 5 + ) + ->endingQuantity( + null + ) + ->build() + ] + )->build() + )->build() +)->build(); + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $result = $subscriptionRenewalsController->updateScheduledRenewalConfigurationItem( + $subscriptionId, + $scheduledRenewalsConfigurationId, + $id, + $body + ); + echo 'ScheduledRenewalConfigurationItemResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Example Response *(as JSON)* + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 555, + "subscription_id": 12345, + "subscription_renewal_configuration_id": 987, + "item_id": 42, + "item_type": "Component", + "item_subclass": "SubscriptionComponent", + "price_point_id": 73, + "price_point_type": "ComponentPricePoint", + "quantity": 3, + "decimal_quantity": "3.0", + "created_at": "2025-09-01T12:00:00Z" + } +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + +# Delete Scheduled Renewal Configuration Item + +Removes an item from the pending renewal configuration. + +```php +function deleteScheduledRenewalConfigurationItem( + int $subscriptionId, + int $scheduledRenewalsConfigurationId, + int $id +): void +``` + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `scheduledRenewalsConfigurationId` | `int` | Template, Required | The scheduled renewal configuration id. | +| `id` | `int` | Template, Required | The scheduled renewal configuration item id. | + +## Response Type + +`void` + +## Example Usage + +```php +$subscriptionId = 222; + +$scheduledRenewalsConfigurationId = 250; + +$id = 112; + +$subscriptionRenewalsController = $client->getSubscriptionRenewalsController(); + +try { + $subscriptionRenewalsController->deleteScheduledRenewalConfigurationItem( + $subscriptionId, + $scheduledRenewalsConfigurationId, + $id + ); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 627d065..68e004e 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -42,7 +42,7 @@ function retrySubscription(int $subscriptionId): SubscriptionResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -53,7 +53,17 @@ function retrySubscription(int $subscriptionId): SubscriptionResponse ```php $subscriptionId = 222; -$result = $subscriptionStatusController->retrySubscription($subscriptionId); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->retrySubscription($subscriptionId); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -201,7 +211,8 @@ $result = $subscriptionStatusController->retrySubscription($subscriptionId); # Cancel Subscription -The DELETE action causes the cancellation of the Subscription. This means, the method sets the Subscription state to "canceled". +Cancels the Subscription. The Delete method sets the Subscription state to `canceled`. +To cancel the subscription immediately, omit any schedule parameters from the request. To use the schedule options, the Schedule Subscription Cancellation feature must be enabled on your site. ```php function cancelSubscription(int $subscriptionId, ?CancellationRequest $body = null): SubscriptionResponse @@ -211,7 +222,7 @@ function cancelSubscription(int $subscriptionId, ?CancellationRequest $body = nu | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?CancellationRequest`](../../doc/models/cancellation-request.md) | Body, Optional | - | ## Response Type @@ -223,7 +234,15 @@ function cancelSubscription(int $subscriptionId, ?CancellationRequest $body = nu ```php $subscriptionId = 222; -$result = $subscriptionStatusController->cancelSubscription($subscriptionId); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->cancelSubscription($subscriptionId); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -385,8 +404,8 @@ function resumeSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | -| `calendarBillingResumptionCharge` | [`?string(ResumptionCharge)`](../../doc/models/resumption-charge.md) | Query, Optional | (For calendar billing subscriptions only) The way that the resumed subscription's charge should be handled

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

**Default**: `ResumptionCharge::PRORATED` | ## Response Type @@ -397,7 +416,17 @@ function resumeSubscription( ```php $subscriptionId = 222; -$result = $subscriptionStatusController->resumeSubscription($subscriptionId); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->resumeSubscription($subscriptionId); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -532,7 +561,7 @@ function pauseSubscription(int $subscriptionId, ?PauseRequest $body = null): Sub | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | ## Response Type @@ -552,10 +581,20 @@ $body = PauseRequestBuilder::init() ) ->build(); -$result = $subscriptionStatusController->pauseSubscription( - $subscriptionId, - $body -); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->pauseSubscription( + $subscriptionId, + $body + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -695,7 +734,7 @@ function updateAutomaticSubscriptionResumption( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | ## Response Type @@ -715,10 +754,20 @@ $body = PauseRequestBuilder::init() ) ->build(); -$result = $subscriptionStatusController->updateAutomaticSubscriptionResumption( - $subscriptionId, - $body -); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->updateAutomaticSubscriptionResumption( + $subscriptionId, + $body + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -850,7 +899,7 @@ $result = $subscriptionStatusController->updateAutomaticSubscriptionResumption( # Reactivate Subscription -Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). +Reactivate a previously canceled subscription. For details on how the reactivation works, and how to reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). **Note: The term "resume" is used also during another process in Advanced Billing. This occurs when an on-hold subscription is "resumed". This returns the subscription to an active state.** @@ -871,6 +920,8 @@ If a reactivation with `resume: true` were attempted _before_ what would have be If a reactivation with `resume: true` were attempted _after_ what would have been the next billing date of July 1st, then Advanced Billing would not resume the subscription, and instead it would be reactivated with a new billing period. +If a reactivation with `resume: false`, or where 'resume" is omited were attempted, then Advanced Billing would reactivate the subscription with a new billing period regardless of whether or not resuming the previous billing period were possible. + | Canceled | Reactivation | Resumable? | |---|---|---| | Jun 15 | June 28 | Yes | @@ -1020,7 +1071,7 @@ function reactivateSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?ReactivateSubscriptionRequest`](../../doc/models/reactivate-subscription-request.md) | Body, Optional | - | ## Response Type @@ -1047,10 +1098,20 @@ $body = ReactivateSubscriptionRequestBuilder::init() ) ->build(); -$result = $subscriptionStatusController->reactivateSubscription( - $subscriptionId, - $body -); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->reactivateSubscription( + $subscriptionId, + $body + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1172,11 +1233,7 @@ $result = $subscriptionStatusController->reactivateSubscription( # Initiate Delayed Cancellation -Advanced Billing offers the ability to cancel a subscription at the end of the current billing period. This period is set by its current product. - -Requesting to cancel the subscription at the end of the period sets the `cancel_at_end_of_period` flag to true. - -Note that you cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription is past due. +Cancels a subscription at the end of the current billing period based on the subscription's current product. You cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription is past due. ```php function initiateDelayedCancellation( @@ -1189,7 +1246,7 @@ function initiateDelayedCancellation( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?CancellationRequest`](../../doc/models/cancellation-request.md) | Body, Optional | - | ## Response Type @@ -1201,7 +1258,17 @@ function initiateDelayedCancellation( ```php $subscriptionId = 222; -$result = $subscriptionStatusController->initiateDelayedCancellation($subscriptionId); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->initiateDelayedCancellation($subscriptionId); + echo 'DelayedCancellationResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -1226,7 +1293,7 @@ function cancelDelayedCancellation(int $subscriptionId): DelayedCancellationResp | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -1237,7 +1304,15 @@ function cancelDelayedCancellation(int $subscriptionId): DelayedCancellationResp ```php $subscriptionId = 222; -$result = $subscriptionStatusController->cancelDelayedCancellation($subscriptionId); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->cancelDelayedCancellation($subscriptionId); + echo 'DelayedCancellationResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1267,7 +1342,7 @@ function cancelDunning(int $subscriptionId): SubscriptionResponse | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | ## Response Type @@ -1278,7 +1353,17 @@ function cancelDunning(int $subscriptionId): SubscriptionResponse ```php $subscriptionId = 222; -$result = $subscriptionStatusController->cancelDunning($subscriptionId); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->cancelDunning($subscriptionId); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -1311,7 +1396,7 @@ Optionally, **you may provide your own custom quantities** for any component to ## Subscription Side Effects -You can request a `POST` to obtain this data from the endpoint without any side effects. Plain and simple, this will preview data, not log any changes against a subscription. +You can request a `POST` to obtain this data from the endpoint without any side effects. This method allows you to preview data, but does not log any changes against a subscription. ```php function previewRenewal(int $subscriptionId, ?RenewalPreviewRequest $body = null): RenewalPreviewResponse @@ -1321,7 +1406,7 @@ function previewRenewal(int $subscriptionId, ?RenewalPreviewRequest $body = null | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?RenewalPreviewRequest`](../../doc/models/renewal-preview-request.md) | Body, Optional | - | ## Response Type @@ -1364,10 +1449,20 @@ $body = RenewalPreviewRequestBuilder::init() ) ->build(); -$result = $subscriptionStatusController->previewRenewal( - $subscriptionId, - $body -); +$subscriptionStatusController = $client->getSubscriptionStatusController(); + +try { + $result = $subscriptionStatusController->previewRenewal( + $subscriptionId, + $body + ); + echo 'RenewalPreviewResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index 194a407..8cbcdd7 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -82,7 +82,17 @@ $body = CreateSubscriptionRequestBuilder::init( ->build() )->build(); -$result = $subscriptionsController->createSubscription($body); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->createSubscription($body); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -233,7 +243,7 @@ $result = $subscriptionsController->createSubscription($body); # List Subscriptions -This method will return an array of subscriptions from a Site. Pay close attention to query string filters and pagination in order to control responses from the server. +returns an array of subscriptions from a Site. Pay close attention to query string filters and pagination in order to control responses from the server. ## Search for a subscription @@ -288,7 +298,15 @@ $collect = [ ] ]; -$result = $subscriptionsController->listSubscriptions($collect); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->listSubscriptions($collect); + echo 'SubscriptionResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` @@ -352,7 +370,7 @@ function updateSubscription(int $subscriptionId, ?UpdateSubscriptionRequest $bod | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?UpdateSubscriptionRequest`](../../doc/models/update-subscription-request.md) | Body, Optional | - | ## Response Type @@ -371,10 +389,20 @@ $body = UpdateSubscriptionRequestBuilder::init( ->build() )->build(); -$result = $subscriptionsController->updateSubscription( - $subscriptionId, - $body -); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->updateSubscription( + $subscriptionId, + $body + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -496,7 +524,7 @@ $result = $subscriptionsController->updateSubscription( # Read Subscription -Use this endpoint to find subscription details. +Retrieves subscription details. ## Self-Service Page token @@ -510,7 +538,7 @@ function readSubscription(int $subscriptionId, ?array $mInclude = null): Subscri | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `mInclude` | [`?(string(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 @@ -527,10 +555,18 @@ $include = [ SubscriptionInclude::SELF_SERVICE_PAGE_TOKEN ]; -$result = $subscriptionsController->readSubscription( - $subscriptionId, - $include -); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->readSubscription( + $subscriptionId, + $include + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -703,7 +739,7 @@ function overrideSubscription(int $subscriptionId, ?OverrideSubscriptionRequest | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?OverrideSubscriptionRequest`](../../doc/models/override-subscription-request.md) | Body, Optional | Only these fields are available to be set. | ## Response Type @@ -724,10 +760,18 @@ $body = OverrideSubscriptionRequestBuilder::init( ->build() )->build(); -$subscriptionsController->overrideSubscription( - $subscriptionId, - $body -); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $subscriptionsController->overrideSubscription( + $subscriptionId, + $body + ); +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -758,7 +802,15 @@ function findSubscription(?string $reference = null): SubscriptionResponse ## Example Usage ```php -$result = $subscriptionsController->findSubscription(); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->findSubscription(); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -788,7 +840,7 @@ function purgeSubscription(int $subscriptionId, int $ack, ?array $cascade = null | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `ack` | `int` | Query, Required | id of the customer. | | `cascade` | [`?(string(SubscriptionPurgeType)[])`](../../doc/models/subscription-purge-type.md) | Query, Optional | Options are "customer" or "payment_profile".
Use in query: `cascade[]=customer&cascade[]=payment_profile`. | @@ -808,11 +860,21 @@ $cascade = [ SubscriptionPurgeType::PAYMENT_PROFILE ]; -$result = $subscriptionsController->purgeSubscription( - $subscriptionId, - $ack, - $cascade -); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->purgeSubscription( + $subscriptionId, + $ack, + $cascade + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (SubscriptionResponseErrorException $exp) { + echo 'Caught SubscriptionResponseErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors @@ -837,7 +899,7 @@ function updatePrepaidSubscriptionConfiguration( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?UpsertPrepaidConfigurationRequest`](../../doc/models/upsert-prepaid-configuration-request.md) | Body, Optional | - | ## Response Type @@ -858,10 +920,18 @@ $body = UpsertPrepaidConfigurationRequestBuilder::init( ->build() )->build(); -$result = $subscriptionsController->updatePrepaidSubscriptionConfiguration( - $subscriptionId, - $body -); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->updatePrepaidSubscriptionConfiguration( + $subscriptionId, + $body + ); + echo 'PrepaidConfigurationResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -936,7 +1006,15 @@ $body = CreateSubscriptionRequestBuilder::init( ->build() )->build(); -$result = $subscriptionsController->previewSubscription($body); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->previewSubscription($body); + echo 'SubscriptionPreviewResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1082,7 +1160,7 @@ function applyCouponsToSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `code` | `?string` | Query, Optional | A code for the coupon that would be applied to a subscription | | `body` | [`?AddCouponsRequest`](../../doc/models/add-coupons-request.md) | Body, Optional | - | @@ -1104,11 +1182,21 @@ $body = AddCouponsRequestBuilder::init() ) ->build(); -$result = $subscriptionsController->applyCouponsToSubscription( - $subscriptionId, - null, - $body -); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->applyCouponsToSubscription( + $subscriptionId, + null, + $body + ); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (SubscriptionAddCouponErrorException $exp) { + echo 'Caught SubscriptionAddCouponErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -1282,7 +1370,7 @@ function removeCouponFromSubscription(int $subscriptionId, ?string $couponCode = | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `couponCode` | `?string` | Query, Optional | The coupon code | ## Response Type @@ -1294,7 +1382,17 @@ function removeCouponFromSubscription(int $subscriptionId, ?string $couponCode = ```php $subscriptionId = 222; -$result = $subscriptionsController->removeCouponFromSubscription($subscriptionId); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->removeCouponFromSubscription($subscriptionId); + echo 'string:'; + var_dump($result); +} catch (SubscriptionRemoveCouponErrorsException $exp) { + echo 'Caught SubscriptionRemoveCouponErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response @@ -1367,7 +1465,7 @@ function activateSubscription( | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | | `body` | [`?ActivateSubscriptionRequest`](../../doc/models/activate-subscription-request.md) | Body, Optional | - | ## Response Type @@ -1379,7 +1477,17 @@ function activateSubscription( ```php $subscriptionId = 222; -$result = $subscriptionsController->activateSubscription($subscriptionId); +$subscriptionsController = $client->getSubscriptionsController(); + +try { + $result = $subscriptionsController->activateSubscription($subscriptionId); + echo 'SubscriptionResponse:'; + var_dump($result); +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md index 31a758e..06e3543 100644 --- a/doc/controllers/webhooks.md +++ b/doc/controllers/webhooks.md @@ -50,7 +50,15 @@ $collect = [ 'perPage' => 50 ]; -$result = $webhooksController->listWebhooks($collect); +$webhooksController = $client->getWebhooksController(); + +try { + $result = $webhooksController->listWebhooks($collect); + echo 'WebhookResponse[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -118,7 +126,15 @@ $body = EnableWebhooksRequestBuilder::init( true )->build(); -$result = $webhooksController->enableWebhooks($body); +$webhooksController = $client->getWebhooksController(); + +try { + $result = $webhooksController->enableWebhooks($body); + echo 'EnableWebhooksResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -158,7 +174,15 @@ $body = ReplayWebhooksRequestBuilder::init( ] )->build(); -$result = $webhooksController->replayWebhooks($body); +$webhooksController = $client->getWebhooksController(); + +try { + $result = $webhooksController->replayWebhooks($body); + echo 'ReplayWebhooksResponse:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -202,7 +226,17 @@ $body = CreateOrUpdateEndpointRequestBuilder::init( )->build() )->build(); -$result = $webhooksController->createEndpoint($body); +$webhooksController = $client->getWebhooksController(); + +try { + $result = $webhooksController->createEndpoint($body); + echo 'EndpointResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -244,7 +278,15 @@ function listEndpoints(): array ## Example Usage ```php -$result = $webhooksController->listEndpoints(); +$webhooksController = $client->getWebhooksController(); + +try { + $result = $webhooksController->listEndpoints(); + echo 'Endpoint[]:'; + var_dump($result); +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Example Response *(as JSON)* @@ -315,10 +357,20 @@ $body = CreateOrUpdateEndpointRequestBuilder::init( )->build() )->build(); -$result = $webhooksController->updateEndpoint( - $endpointId, - $body -); +$webhooksController = $client->getWebhooksController(); + +try { + $result = $webhooksController->updateEndpoint( + $endpointId, + $body + ); + echo 'EndpointResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} ``` ## Errors diff --git a/doc/models/activate-event-based-component.md b/doc/models/activate-event-based-component.md index 420af75..14456b0 100644 --- a/doc/models/activate-event-based-component.md +++ b/doc/models/activate-event-based-component.md @@ -26,6 +26,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -37,8 +38,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/allocate-components.md b/doc/models/allocate-components.md index 193ecf6..8f56151 100644 --- a/doc/models/allocate-components.md +++ b/doc/models/allocate-components.md @@ -13,8 +13,8 @@ | `prorationDowngradeScheme` | `?string` | Optional | - | getProrationDowngradeScheme(): ?string | setProrationDowngradeScheme(?string prorationDowngradeScheme): void | | `allocations` | [`?(CreateAllocation[])`](../../doc/models/create-allocation.md) | Optional | - | getAllocations(): ?array | setAllocations(?array allocations): void | | `accrueCharge` | `?bool` | Optional | - | getAccrueCharge(): ?bool | setAccrueCharge(?bool accrueCharge): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `paymentCollectionMethod` | [`?string(CollectionMethod)`](../../doc/models/collection-method.md) | Optional | (Optional) If not passed, the allocation(s) will use the payment collection method on the subscription | getPaymentCollectionMethod(): ?string | setPaymentCollectionMethod(?string paymentCollectionMethod): void | | `initiateDunning` | `?bool` | Optional | If true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. | getInitiateDunning(): ?bool | setInitiateDunning(?bool initiateDunning): void | @@ -27,19 +27,19 @@ "allocations": [ { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" }, { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" } ], "accrue_charge": false, diff --git a/doc/models/allocation-preview-item.md b/doc/models/allocation-preview-item.md index 4e13172..f4a80de 100644 --- a/doc/models/allocation-preview-item.md +++ b/doc/models/allocation-preview-item.md @@ -18,8 +18,8 @@ | `prorationUpgradeScheme` | `?string` | Optional | - | getProrationUpgradeScheme(): ?string | setProrationUpgradeScheme(?string prorationUpgradeScheme): void | | `prorationDowngradeScheme` | `?string` | Optional | - | getProrationDowngradeScheme(): ?string | setProrationDowngradeScheme(?string prorationDowngradeScheme): void | | `accrueCharge` | `?bool` | Optional | - | getAccrueCharge(): ?bool | setAccrueCharge(?bool accrueCharge): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `pricePointId` | `?int` | Optional | - | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | | `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(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. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | diff --git a/doc/models/allocation-settings.md b/doc/models/allocation-settings.md index c7db732..af3b2cc 100644 --- a/doc/models/allocation-settings.md +++ b/doc/models/allocation-settings.md @@ -9,8 +9,8 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `accrueCharge` | `?string` | Optional | Either "true" or "false". | getAccrueCharge(): ?string | setAccrueCharge(?string accrueCharge): void | ## Example (as JSON) diff --git a/doc/models/allocation.md b/doc/models/allocation.md index 940cd12..94091fd 100644 --- a/doc/models/allocation.md +++ b/doc/models/allocation.md @@ -28,8 +28,8 @@ | `previousPricePointId` | `?int` | Optional | - | getPreviousPricePointId(): ?int | setPreviousPricePointId(?int previousPricePointId): void | | `accrueCharge` | `?bool` | Optional | If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. | getAccrueCharge(): ?bool | setAccrueCharge(?bool accrueCharge): void | | `initiateDunning` | `?bool` | Optional | If true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. | getInitiateDunning(): ?bool | setInitiateDunning(?bool initiateDunning): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `payment` | [`?PaymentForAllocation`](../../doc/models/payment-for-allocation.md) | Optional | - | getPayment(): ?PaymentForAllocation | setPayment(?PaymentForAllocation payment): void | | `expiresAt` | `?DateTime` | Optional | - | getExpiresAt(): ?\DateTime | setExpiresAt(?\DateTime expiresAt): void | | `usedQuantity` | `?int` | Optional | - | getUsedQuantity(): ?int | setUsedQuantity(?int usedQuantity): void | diff --git a/doc/models/available-actions.md b/doc/models/available-actions.md new file mode 100644 index 0000000..3439f02 --- /dev/null +++ b/doc/models/available-actions.md @@ -0,0 +1,24 @@ + +# Available Actions + +## Structure + +`AvailableActions` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `sendEmail` | [`?SendEmail`](../../doc/models/send-email.md) | Optional | - | getSendEmail(): ?SendEmail | setSendEmail(?SendEmail sendEmail): void | + +## Example (as JSON) + +```json +{ + "send_email": { + "can_execute": false, + "url": "url0" + } +} +``` + diff --git a/doc/models/cancellation-options.md b/doc/models/cancellation-options.md index db57380..265d5c5 100644 --- a/doc/models/cancellation-options.md +++ b/doc/models/cancellation-options.md @@ -9,15 +9,21 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `cancellationMessage` | `?string` | Optional | For your internal use. An indication as to why the subscription is being canceled. | getCancellationMessage(): ?string | setCancellationMessage(?string cancellationMessage): void | -| `reasonCode` | `?string` | Optional | The reason code associated with the cancellation. See the list of reason codes associated with your site. | getReasonCode(): ?string | setReasonCode(?string reasonCode): void | +| `cancellationMessage` | `?string` | Optional | An indication as to why the subscription is being canceled. For your internal use. | getCancellationMessage(): ?string | setCancellationMessage(?string cancellationMessage): void | +| `reasonCode` | `?string` | Optional | The reason code associated with the cancellation. Use the [List Reason Codes](../../doc/controllers/reason-codes.md#list-reason-codes) endpoint to retrieve the reason codes associated with your site. | getReasonCode(): ?string | setReasonCode(?string reasonCode): void | +| `cancelAtEndOfPeriod` | `?bool` | Optional | When true, the subscription is cancelled at the current period end instead of immediately. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | getCancelAtEndOfPeriod(): ?bool | setCancelAtEndOfPeriod(?bool cancelAtEndOfPeriod): void | +| `scheduledCancellationAt` | `?DateTime` | Optional | Schedules the cancellation on the provided date. This is option is not applicable for prepaid subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | getScheduledCancellationAt(): ?\DateTime | setScheduledCancellationAt(?\DateTime scheduledCancellationAt): void | +| `refundPrepaymentAccountBalance` | `?bool` | Optional | Applies to prepaid subscriptions. When true, which is the default, the remaining prepaid balance is refunded as part of cancellation processing. When false, prepaid balance is not refunded as part of cancellation processing. To use this option, the Schedule Subscription Cancellation feature must be enabled on your site. | getRefundPrepaymentAccountBalance(): ?bool | setRefundPrepaymentAccountBalance(?bool refundPrepaymentAccountBalance): void | ## Example (as JSON) ```json { "cancellation_message": "cancellation_message0", - "reason_code": "reason_code6" + "reason_code": "reason_code6", + "cancel_at_end_of_period": false, + "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", + "refund_prepayment_account_balance": false } ``` diff --git a/doc/models/cancellation-request.md b/doc/models/cancellation-request.md index 5b7b5ab..2ef4831 100644 --- a/doc/models/cancellation-request.md +++ b/doc/models/cancellation-request.md @@ -17,7 +17,10 @@ { "subscription": { "cancellation_message": "cancellation_message2", - "reason_code": "reason_code8" + "reason_code": "reason_code8", + "cancel_at_end_of_period": false, + "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", + "refund_prepayment_account_balance": false } } ``` diff --git a/doc/models/clone-component-price-point-request.md b/doc/models/clone-component-price-point-request.md new file mode 100644 index 0000000..d418462 --- /dev/null +++ b/doc/models/clone-component-price-point-request.md @@ -0,0 +1,24 @@ + +# Clone Component Price Point Request + +## Structure + +`CloneComponentPricePointRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `pricePoint` | [`CloneComponentPricePoint`](../../doc/models/clone-component-price-point.md) | Required | - | getPricePoint(): CloneComponentPricePoint | setPricePoint(CloneComponentPricePoint pricePoint): void | + +## Example (as JSON) + +```json +{ + "price_point": { + "name": "name0", + "handle": "handle6" + } +} +``` + diff --git a/doc/models/clone-component-price-point.md b/doc/models/clone-component-price-point.md new file mode 100644 index 0000000..25b3fd3 --- /dev/null +++ b/doc/models/clone-component-price-point.md @@ -0,0 +1,23 @@ + +# Clone Component Price Point + +## Structure + +`CloneComponentPricePoint` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `name` | `string` | Required | - | getName(): string | setName(string name): void | +| `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | + +## Example (as JSON) + +```json +{ + "name": "name2", + "handle": "handle8" +} +``` + diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index 4fe11cc..1c152b6 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -15,7 +15,9 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | `pricingScheme` | [`?string(PricingScheme)`](../../doc/models/pricing-scheme.md) | Optional | Omit for On/Off components | getPricingScheme(): ?string | setPricingScheme(?string pricingScheme): void | | `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(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. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | -| `prices` | [`Price[]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1 | getPrices(): array | setPrices(array prices): void | +| `listPricePointId` | `?int` | Optional | Optional id of the price point to use for list price calculations when
overriding the customer price. | getListPricePointId(): ?int | setListPricePointId(?int listPricePointId): void | +| `useDefaultListPrice` | `?bool` | Optional | When true, list price calculations will continue to use the default price point even when a `custom_price` is supplied. | getUseDefaultListPrice(): ?bool | setUseDefaultListPrice(?bool useDefaultListPrice): void | +| `prices` | [`Price[]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1. | getPrices(): array | setPrices(array prices): void | | `renewPrepaidAllocation` | `?bool` | Optional | Applicable only to prepaid usage components. Controls whether the allocated quantity renews each period. | getRenewPrepaidAllocation(): ?bool | setRenewPrepaidAllocation(?bool renewPrepaidAllocation): void | | `rolloverPrepaidRemainder` | `?bool` | Optional | Applicable only to prepaid usage components. Controls whether remaining units roll over to the next period. | getRolloverPrepaidRemainder(): ?bool | setRolloverPrepaidRemainder(?bool rolloverPrepaidRemainder): void | | `expirationInterval` | `?int` | Optional | Applicable only when rollover is enabled. Number of `expiration_interval_unit`s after which rollover amounts expire. | getExpirationInterval(): ?int | setExpirationInterval(?int expirationInterval): void | @@ -36,7 +38,7 @@ Create or update custom pricing unique to the subscription. Used in place of `pr "pricing_scheme": "stairstep", "interval": 162, "interval_unit": "day", - "renew_prepaid_allocation": false + "list_price_point_id": 146 } ``` diff --git a/doc/models/component-price-point-currency-overage-response.md b/doc/models/component-price-point-currency-overage-response.md new file mode 100644 index 0000000..836b046 --- /dev/null +++ b/doc/models/component-price-point-currency-overage-response.md @@ -0,0 +1,27 @@ + +# Component Price Point Currency Overage Response + +## Structure + +`ComponentPricePointCurrencyOverageResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `pricePoint` | [`CurrencyOveragePrices`](../../doc/models/currency-overage-prices.md) | Required | Extends a component price point with currency overage prices. | getPricePoint(): CurrencyOveragePrices | setPricePoint(CurrencyOveragePrices pricePoint): void | + +## Example (as JSON) + +```json +{ + "price_point": { + "id": 248, + "type": "default", + "default": false, + "name": "name0", + "pricing_scheme": "per_unit" + } +} +``` + diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md index 89d37e3..425a420 100644 --- a/doc/models/component-price-point.md +++ b/doc/models/component-price-point.md @@ -25,7 +25,7 @@ | `taxIncluded` | `?bool` | Optional | - | getTaxIncluded(): ?bool | setTaxIncluded(?bool taxIncluded): void | | `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(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. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | -| `currencyPrices` | [`?(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. | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): void | +| `currencyPrices` | [`?(ComponentCurrencyPrice[])`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): void | | `overagePrices` | [`?(ComponentPrice[])`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | getOveragePrices(): ?array | setOveragePrices(?array overagePrices): void | | `overagePricingScheme` | [`?string(PricingScheme)`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. | getOveragePricingScheme(): ?string | setOveragePricingScheme(?string overagePricingScheme): void | | `renewPrepaidAllocation` | `?bool` | 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. | getRenewPrepaidAllocation(): ?bool | setRenewPrepaidAllocation(?bool renewPrepaidAllocation): void | diff --git a/doc/models/component.md b/doc/models/component.md index cb0aee0..42e6d7f 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -31,8 +31,8 @@ | `taxable` | `?bool` | Optional | Boolean flag describing whether a component is taxable or not. | getTaxable(): ?bool | setTaxable(?bool taxable): void | | `taxCode` | `?string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | | `recurring` | `?bool` | Optional | - | getRecurring(): ?bool | setRecurring(?bool recurring): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `createdAt` | `?DateTime` | Optional | Timestamp indicating when this component was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | Timestamp indicating when this component was updated | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | | `archivedAt` | `?DateTime` | Optional | Timestamp indicating when this component was archived | getArchivedAt(): ?\DateTime | setArchivedAt(?\DateTime archivedAt): void | diff --git a/doc/models/containers/clone-component-price-point-component-id.md b/doc/models/containers/clone-component-price-point-component-id.md new file mode 100644 index 0000000..b700592 --- /dev/null +++ b/doc/models/containers/clone-component-price-point-component-id.md @@ -0,0 +1,14 @@ + +# Clone Component Price Point Component Id + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + diff --git a/doc/models/containers/clone-component-price-point-price-point-id.md b/doc/models/containers/clone-component-price-point-price-point-id.md new file mode 100644 index 0000000..471c8cf --- /dev/null +++ b/doc/models/containers/clone-component-price-point-price-point-id.md @@ -0,0 +1,14 @@ + +# Clone Component Price Point Price Point Id + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + diff --git a/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md b/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md new file mode 100644 index 0000000..54a9651 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-configuration-item-request-renewal-configuration-item.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Configuration Item Request Renewal Configuration Item + +## Data Type + +`ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct` + +## Cases + +| Type | +| --- | +| [`ScheduledRenewalItemRequestBodyComponent`](../../../doc/models/scheduled-renewal-item-request-body-component.md) | +| [`ScheduledRenewalItemRequestBodyProduct`](../../../doc/models/scheduled-renewal-item-request-body-product.md) | + diff --git a/doc/models/containers/scheduled-renewal-product-price-point-interval.md b/doc/models/containers/scheduled-renewal-product-price-point-interval.md new file mode 100644 index 0000000..5177186 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-product-price-point-interval.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Product Price Point Interval + +## Data Type + +`string|int` + +## Cases + +| Type | +| --- | +| `string` | +| `int` | + diff --git a/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md b/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md new file mode 100644 index 0000000..f61e206 --- /dev/null +++ b/doc/models/containers/scheduled-renewal-product-price-point-price-in-cents.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Product Price Point Price in Cents + +## Data Type + +`string|int` + +## Cases + +| Type | +| --- | +| `string` | +| `int` | + diff --git a/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md b/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md new file mode 100644 index 0000000..29238be --- /dev/null +++ b/doc/models/containers/scheduled-renewal-update-request-renewal-configuration-item.md @@ -0,0 +1,14 @@ + +# Scheduled Renewal Update Request Renewal Configuration Item + +## Data Type + +`ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct` + +## Cases + +| Type | +| --- | +| [`ScheduledRenewalItemRequestBodyComponent`](../../../doc/models/scheduled-renewal-item-request-body-component.md) | +| [`ScheduledRenewalItemRequestBodyProduct`](../../../doc/models/scheduled-renewal-item-request-body-product.md) | + diff --git a/doc/models/contract.md b/doc/models/contract.md new file mode 100644 index 0000000..1eac20a --- /dev/null +++ b/doc/models/contract.md @@ -0,0 +1,34 @@ + +# Contract + +Contract linked to the scheduled renewal configuration. + +## Structure + +`Contract` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?int` | Optional | - | getId(): ?int | setId(?int id): void | +| `maxioId` | `?string` | Optional | - | getMaxioId(): ?string | setMaxioId(?string maxioId): void | +| `number` | `?string` | Optional | - | getNumber(): ?string | setNumber(?string number): void | +| `register` | [`?Register`](../../doc/models/register.md) | Optional | - | getRegister(): ?Register | setRegister(?Register register): void | + +## Example (as JSON) + +```json +{ + "id": 136, + "maxio_id": "maxio_id8", + "number": "number6", + "register": { + "id": 54, + "maxio_id": "maxio_id4", + "name": "name2", + "currency_code": "currency_code2" + } +} +``` + diff --git a/doc/models/create-allocation-request.md b/doc/models/create-allocation-request.md index f2cd529..f34299e 100644 --- a/doc/models/create-allocation-request.md +++ b/doc/models/create-allocation-request.md @@ -17,11 +17,11 @@ { "allocation": { "quantity": 228.94, + "decimal_quantity": "decimal_quantity6", + "previous_quantity": 254.04, + "decimal_previous_quantity": "decimal_previous_quantity8", "component_id": 8, - "memo": "memo2", - "proration_downgrade_scheme": "proration_downgrade_scheme4", - "proration_upgrade_scheme": "proration_upgrade_scheme6", - "accrue_charge": false + "memo": "memo2" } } ``` diff --git a/doc/models/create-allocation.md b/doc/models/create-allocation.md index 3e3d694..703abc4 100644 --- a/doc/models/create-allocation.md +++ b/doc/models/create-allocation.md @@ -10,27 +10,31 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `quantity` | `float` | Required | The allocated quantity to which to set the line-items allocated quantity. By default, this is an integer. If decimal allocations are enabled for the component, it will be a decimal number. For On/Off components, use 1for on and 0 for off. | getQuantity(): float | setQuantity(float quantity): void | -| `componentId` | `?int` | Optional | (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made | getComponentId(): ?int | setComponentId(?int componentId): void | -| `memo` | `?string` | Optional | A memo to record along with the allocation | getMemo(): ?string | setMemo(?string memo): void | +| `decimalQuantity` | `?string` | Optional | Decimal representation of the allocated quantity. Only valid when decimal
allocations are enabled for the component. | getDecimalQuantity(): ?string | setDecimalQuantity(?string decimalQuantity): void | +| `previousQuantity` | `?float` | Optional | The quantity that was in effect before this allocation. Responses always
include this value; it may be supplied on preview requests to ensure the
expected change is evaluated. | getPreviousQuantity(): ?float | setPreviousQuantity(?float previousQuantity): void | +| `decimalPreviousQuantity` | `?string` | Optional | Decimal representation of `previous_quantity`. Only valid when decimal
allocations are enabled for the component. | getDecimalPreviousQuantity(): ?string | setDecimalPreviousQuantity(?string decimalPreviousQuantity): void | +| `componentId` | `?int` | Optional | (required for the multiple allocations endpoint) The id associated with the component for which the allocation is being made. | getComponentId(): ?int | setComponentId(?int componentId): void | +| `memo` | `?string` | Optional | A memo to record along with the allocation. | getMemo(): ?string | setMemo(?string memo): void | | `prorationDowngradeScheme` | `?string` | Optional | The scheme used if the proration is a downgrade. Defaults to the site setting if one is not provided. | getProrationDowngradeScheme(): ?string | setProrationDowngradeScheme(?string prorationDowngradeScheme): void | | `prorationUpgradeScheme` | `?string` | Optional | The scheme used if the proration is an upgrade. Defaults to the site setting if one is not provided. | getProrationUpgradeScheme(): ?string | setProrationUpgradeScheme(?string prorationUpgradeScheme): void | -| `accrueCharge` | `?bool` | Optional | If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately. Defaults to the site setting if one is not provided. | getAccrueCharge(): ?bool | setAccrueCharge(?bool accrueCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(DowngradeCreditCreditType)`](../../doc/models/downgrade-credit-credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are:

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

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

`none` - No charge is added. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(UpgradeChargeCreditType)`](../../doc/models/upgrade-charge-credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are:

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

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

`none` - No charge is added. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `accrueCharge` | `?bool` | Optional | "If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal or if capture should be attempted immediately.

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

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

Defaults to the site setting if unspecified in the request. | getAccrueCharge(): ?bool | setAccrueCharge(?bool accrueCharge): void | | `initiateDunning` | `?bool` | Optional | If set to true, if the immediate component payment fails, initiate dunning for the subscription.
Otherwise, leave the charges on the subscription to pay for at renewal. Defaults to false. | getInitiateDunning(): ?bool | setInitiateDunning(?bool initiateDunning): void | | `pricePointId` | string\|int\|null | Optional | This is a container for one-of cases. | getPricePointId(): | setPricePointId( pricePointId): void | | `billingSchedule` | [`?BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. This only works for site with Multifrequency enabled. | getBillingSchedule(): ?BillingSchedule | setBillingSchedule(?BillingSchedule billingSchedule): void | +| `customPrice` | [`?ComponentCustomPrice`](../../doc/models/component-custom-price.md) | Optional | Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. | getCustomPrice(): ?ComponentCustomPrice | setCustomPrice(?ComponentCustomPrice customPrice): void | ## Example (as JSON) ```json { "quantity": 8.06, + "decimal_quantity": "decimal_quantity4", + "previous_quantity": 218.92, + "decimal_previous_quantity": "decimal_previous_quantity0", "component_id": 192, - "memo": "memo4", - "proration_downgrade_scheme": "proration_downgrade_scheme2", - "proration_upgrade_scheme": "proration_upgrade_scheme4", - "accrue_charge": false + "memo": "memo4" } ``` diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md index a20e26b..6d536d9 100644 --- a/doc/models/create-subscription.md +++ b/doc/models/create-subscription.md @@ -13,7 +13,7 @@ | `productId` | `?int` | Optional | The Product ID of the product for which you are creating a subscription. The product ID is not currently published, so we recommend using the API Handle instead. | getProductId(): ?int | setProductId(?int productId): void | | `productPricePointHandle` | `?string` | Optional | The user-friendly API handle of a product's particular price point. | getProductPricePointHandle(): ?string | setProductPricePointHandle(?string productPricePointHandle): void | | `productPricePointId` | `?int` | Optional | The ID of the particular price point on the product. | getProductPricePointId(): ?int | setProductPricePointId(?int productPricePointId): void | -| `customPrice` | [`?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 | getCustomPrice(): ?SubscriptionCustomPrice | setCustomPrice(?SubscriptionCustomPrice customPrice): void | +| `customPrice` | [`?SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | getCustomPrice(): ?SubscriptionCustomPrice | setCustomPrice(?SubscriptionCustomPrice customPrice): void | | `couponCode` | `?string` | Optional | (deprecated) The coupon code of the single coupon currently applied to the subscription. See coupon_codes instead as subscriptions can now have more than one coupon. | getCouponCode(): ?string | setCouponCode(?string couponCode): void | | `couponCodes` | `?(string[])` | Optional | An array for all the coupons attached to the subscription. | getCouponCodes(): ?array | setCouponCodes(?array couponCodes): void | | `paymentCollectionMethod` | [`?string(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`. | getPaymentCollectionMethod(): ?string | setPaymentCollectionMethod(?string paymentCollectionMethod): void | diff --git a/doc/models/create-usage-request.md b/doc/models/create-usage-request.md index 2edab1c..7a81b66 100644 --- a/doc/models/create-usage-request.md +++ b/doc/models/create-usage-request.md @@ -27,6 +27,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -38,8 +39,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } } diff --git a/doc/models/create-usage.md b/doc/models/create-usage.md index 0b9d8cd..4356e39 100644 --- a/doc/models/create-usage.md +++ b/doc/models/create-usage.md @@ -30,6 +30,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -41,8 +42,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/credit-type.md b/doc/models/credit-type.md index b92ca7b..f7d2a09 100644 --- a/doc/models/credit-type.md +++ b/doc/models/credit-type.md @@ -2,7 +2,6 @@ # Credit Type The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. -Available values: `full`, `prorated`, `none`. ## Enumeration diff --git a/doc/models/currency-overage-prices.md b/doc/models/currency-overage-prices.md new file mode 100644 index 0000000..5795687 --- /dev/null +++ b/doc/models/currency-overage-prices.md @@ -0,0 +1,50 @@ + +# Currency Overage Prices + +Extends a component price point with currency overage prices. + +## Structure + +`CurrencyOveragePrices` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?int` | Optional | - | getId(): ?int | setId(?int id): void | +| `type` | [`?string(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. | getType(): ?string | setType(?string type): void | +| `default` | `?bool` | Optional | Note: Refer to type attribute instead | getDefault(): ?bool | setDefault(?bool default): void | +| `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | +| `pricingScheme` | [`?string(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. | getPricingScheme(): ?string | setPricingScheme(?string pricingScheme): void | +| `componentId` | `?int` | Optional | - | getComponentId(): ?int | setComponentId(?int componentId): void | +| `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | +| `archivedAt` | `?DateTime` | Optional | - | getArchivedAt(): ?\DateTime | setArchivedAt(?\DateTime archivedAt): void | +| `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | +| `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | +| `prices` | [`?(ComponentPrice[])`](../../doc/models/component-price.md) | Optional | - | getPrices(): ?array | setPrices(?array prices): void | +| `useSiteExchangeRate` | `?bool` | 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. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | +| `subscriptionId` | `?int` | 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. | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | +| `taxIncluded` | `?bool` | Optional | - | getTaxIncluded(): ?bool | setTaxIncluded(?bool taxIncluded): void | +| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `intervalUnit` | [`?string(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. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | +| `currencyPrices` | [`?(ComponentCurrencyPrice[])`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. The clone endpoint always returns currency prices if they are present. | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): void | +| `overagePrices` | [`?(ComponentPrice[])`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. | getOveragePrices(): ?array | setOveragePrices(?array overagePrices): void | +| `overagePricingScheme` | [`?string(PricingScheme)`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. | getOveragePricingScheme(): ?string | setOveragePricingScheme(?string overagePricingScheme): void | +| `renewPrepaidAllocation` | `?bool` | 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. | getRenewPrepaidAllocation(): ?bool | setRenewPrepaidAllocation(?bool renewPrepaidAllocation): void | +| `rolloverPrepaidRemainder` | `?bool` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not remaining units should be rolled over to the next period. | getRolloverPrepaidRemainder(): ?bool | setRolloverPrepaidRemainder(?bool rolloverPrepaidRemainder): void | +| `expirationInterval` | `?int` | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of `expiration_interval_unit`s after which rollover amounts should expire. | getExpirationInterval(): ?int | setExpirationInterval(?int expirationInterval): void | +| `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string representing the expiration interval unit for this component, either month or day. | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | +| `currencyOveragePrices` | [`?(ComponentCurrencyPrice[])`](../../doc/models/component-currency-price.md) | Optional | Applicable only to prepaid usage components. An array of currency pricing data for overage prices. | getCurrencyOveragePrices(): ?array | setCurrencyOveragePrices(?array currencyOveragePrices): void | + +## Example (as JSON) + +```json +{ + "id": 50, + "type": "catalog", + "default": false, + "name": "name8", + "pricing_scheme": "stairstep" +} +``` + diff --git a/doc/models/deliver-proforma-invoice-request.md b/doc/models/deliver-proforma-invoice-request.md new file mode 100644 index 0000000..a45f853 --- /dev/null +++ b/doc/models/deliver-proforma-invoice-request.md @@ -0,0 +1,33 @@ + +# Deliver Proforma Invoice Request + +## Structure + +`DeliverProformaInvoiceRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `recipientEmails` | `?(string[])` | Optional | - | getRecipientEmails(): ?array | setRecipientEmails(?array recipientEmails): void | +| `ccRecipientEmails` | `?(string[])` | Optional | - | getCcRecipientEmails(): ?array | setCcRecipientEmails(?array ccRecipientEmails): void | +| `bccRecipientEmails` | `?(string[])` | Optional | - | getBccRecipientEmails(): ?array | setBccRecipientEmails(?array bccRecipientEmails): void | + +## Example (as JSON) + +```json +{ + "recipient_emails": [ + "recipient_emails9" + ], + "cc_recipient_emails": [ + "cc_recipient_emails8" + ], + "bcc_recipient_emails": [ + "bcc_recipient_emails2", + "bcc_recipient_emails3", + "bcc_recipient_emails4" + ] +} +``` + diff --git a/doc/models/downgrade-credit-credit-type.md b/doc/models/downgrade-credit-credit-type.md new file mode 100644 index 0000000..50858a3 --- /dev/null +++ b/doc/models/downgrade-credit-credit-type.md @@ -0,0 +1,23 @@ + +# Downgrade Credit Credit Type + +The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + +`full` - A full price credit is added for the amount owed. + +`prorated` - A prorated credit is added for the amount owed. + +`none` - No charge is added. + +## Enumeration + +`DowngradeCreditCreditType` + +## Fields + +| Name | +| --- | +| `FULL` | +| `PRORATED` | +| `NONE` | + diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index 02d46b7..f52047e 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -13,8 +13,8 @@ | `description` | `?string` | Optional | A description for the component that will be displayed to the user on the hosted signup page. | getDescription(): ?string | setDescription(?string description): void | | `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\-_:.]*$` | getHandle(): ?string | setHandle(?string handle): void | | `taxable` | `?bool` | Optional | Boolean flag describing whether a component is taxable or not. | getTaxable(): ?bool | setTaxable(?bool taxable): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `pricePoints` | [`?(ComponentPricePointItem[])`](../../doc/models/component-price-point-item.md) | Optional | - | getPricePoints(): ?array | setPricePoints(?array pricePoints): void | | `unitPrice` | string\|float | Required | This is a container for one-of cases. | getUnitPrice(): | setUnitPrice( unitPrice): void | | `taxCode` | `?string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md index b6ffd5d..feb4d8f 100644 --- a/doc/models/prepaid-usage-component.md +++ b/doc/models/prepaid-usage-component.md @@ -16,8 +16,8 @@ | `taxable` | `?bool` | Optional | Boolean flag describing whether a component is taxable or not. | getTaxable(): ?bool | setTaxable(?bool taxable): void | | `pricingScheme` | [`string(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. | getPricingScheme(): string | setPricingScheme(string pricingScheme): void | | `prices` | [`?(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. | getPrices(): ?array | setPrices(?array prices): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `pricePoints` | [`?(CreatePrepaidUsageComponentPricePoint[])`](../../doc/models/create-prepaid-usage-component-price-point.md) | Optional | - | getPricePoints(): ?array | setPricePoints(?array pricePoints): void | | `unitPrice` | string\|float\|null | Optional | This is a container for one-of cases. | getUnitPrice(): | setUnitPrice( unitPrice): void | | `taxCode` | `?string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | diff --git a/doc/models/preview-allocations-request.md b/doc/models/preview-allocations-request.md index b4d3292..283296a 100644 --- a/doc/models/preview-allocations-request.md +++ b/doc/models/preview-allocations-request.md @@ -11,8 +11,8 @@ | --- | --- | --- | --- | --- | --- | | `allocations` | [`CreateAllocation[]`](../../doc/models/create-allocation.md) | Required | - | getAllocations(): array | setAllocations(array allocations): void | | `effectiveProrationDate` | `?DateTime` | Optional | To calculate proration amounts for a future time. Only within a current subscription period. Only ISO8601 format is supported. | getEffectiveProrationDate(): ?\DateTime | setEffectiveProrationDate(?\DateTime effectiveProrationDate): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | ## Example (as JSON) @@ -21,11 +21,11 @@ "allocations": [ { "quantity": 26.48, + "decimal_quantity": "decimal_quantity8", + "previous_quantity": 55.5, + "decimal_previous_quantity": "decimal_previous_quantity2", "component_id": 242, - "memo": "memo6", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "accrue_charge": false + "memo": "memo6" } ], "effective_proration_date": "2023-12-01", diff --git a/doc/models/product-family.md b/doc/models/product-family.md index e5f571a..6b42baf 100644 --- a/doc/models/product-family.md +++ b/doc/models/product-family.md @@ -16,6 +16,7 @@ | `description` | `?string` | Optional | - | getDescription(): ?string | setDescription(?string description): void | | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | +| `archivedAt` | `?DateTime` | Optional | Timestamp indicating when this product family was archived. `null` if the product family is not archived. | getArchivedAt(): ?\DateTime | setArchivedAt(?\DateTime archivedAt): void | ## Example (as JSON) diff --git a/doc/models/proforma-invoice.md b/doc/models/proforma-invoice.md index 9b587bd..5ee1cb7 100644 --- a/doc/models/proforma-invoice.md +++ b/doc/models/proforma-invoice.md @@ -45,6 +45,7 @@ | `payments` | [`?(ProformaInvoicePayment[])`](../../doc/models/proforma-invoice-payment.md) | Optional | - | getPayments(): ?array | setPayments(?array payments): void | | `customFields` | [`?(InvoiceCustomField[])`](../../doc/models/invoice-custom-field.md) | Optional | - | getCustomFields(): ?array | setCustomFields(?array customFields): void | | `publicUrl` | `?string` | Optional | - | getPublicUrl(): ?string | setPublicUrl(?string publicUrl): void | +| `availableActions` | [`?AvailableActions`](../../doc/models/available-actions.md) | Optional | - | getAvailableActions(): ?AvailableActions | setAvailableActions(?AvailableActions availableActions): void | ## Example (as JSON) diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md index 0a8d339..9976538 100644 --- a/doc/models/quantity-based-component.md +++ b/doc/models/quantity-based-component.md @@ -16,8 +16,8 @@ | `taxable` | `?bool` | Optional | Boolean flag describing whether a component is taxable or not. | getTaxable(): ?bool | setTaxable(?bool taxable): void | | `pricingScheme` | [`string(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. | getPricingScheme(): string | setPricingScheme(string pricingScheme): void | | `prices` | [`?(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. | getPrices(): ?array | setPrices(?array prices): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `pricePoints` | [`?(ComponentPricePointItem[])`](../../doc/models/component-price-point-item.md) | Optional | - | getPricePoints(): ?array | setPricePoints(?array pricePoints): void | | `unitPrice` | string\|float\|null | Optional | This is a container for one-of cases. | getUnitPrice(): | setUnitPrice( unitPrice): void | | `taxCode` | `?string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | diff --git a/doc/models/reactivate-subscription-request.md b/doc/models/reactivate-subscription-request.md index b35de56..aff5d2b 100644 --- a/doc/models/reactivate-subscription-request.md +++ b/doc/models/reactivate-subscription-request.md @@ -13,7 +13,7 @@ | `includeTrial` | `?bool` | Optional | If `true` is sent, the reactivated Subscription will include a trial if one is available. If `false` is sent, the trial period will be ignored. | getIncludeTrial(): ?bool | setIncludeTrial(?bool includeTrial): void | | `preserveBalance` | `?bool` | Optional | If `true` is passed, the existing subscription balance will NOT be cleared/reset before adding the additional reactivation charges. | getPreserveBalance(): ?bool | setPreserveBalance(?bool preserveBalance): void | | `couponCode` | `?string` | Optional | The coupon code to be applied during reactivation. | getCouponCode(): ?string | setCouponCode(?string couponCode): void | -| `useCreditsAndPrepayments` | `?bool` | Optional | If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. | getUseCreditsAndPrepayments(): ?bool | setUseCreditsAndPrepayments(?bool useCreditsAndPrepayments): void | +| `useCreditsAndPrepayments` | `?bool` | Optional | If true is sent, Advanced Billing will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored. | getUseCreditsAndPrepayments(): ?bool | setUseCreditsAndPrepayments(?bool useCreditsAndPrepayments): void | | `resume` | bool\|[ResumeOptions](../../doc/models/resume-options.md)\|null | Optional | This is a container for one-of cases. | getResume(): | setResume( resume): void | ## Example (as JSON) diff --git a/doc/models/register.md b/doc/models/register.md new file mode 100644 index 0000000..7187939 --- /dev/null +++ b/doc/models/register.md @@ -0,0 +1,27 @@ + +# Register + +## Structure + +`Register` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?int` | Optional | - | getId(): ?int | setId(?int id): void | +| `maxioId` | `?string` | Optional | - | getMaxioId(): ?string | setMaxioId(?string maxioId): void | +| `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | +| `currencyCode` | `?string` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | getCurrencyCode(): ?string | setCurrencyCode(?string currencyCode): void | + +## Example (as JSON) + +```json +{ + "id": 90, + "maxio_id": "maxio_id0", + "name": "name6", + "currency_code": "currency_code2" +} +``` + diff --git a/doc/models/scheduled-renewal-component-custom-price.md b/doc/models/scheduled-renewal-component-custom-price.md new file mode 100644 index 0000000..f5b8e1c --- /dev/null +++ b/doc/models/scheduled-renewal-component-custom-price.md @@ -0,0 +1,33 @@ + +# Scheduled Renewal Component Custom Price + +Custom pricing for a component within a scheduled renewal. + +## Structure + +`ScheduledRenewalComponentCustomPrice` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `taxIncluded` | `?bool` | Optional | Whether or not the price point includes tax | getTaxIncluded(): ?bool | setTaxIncluded(?bool taxIncluded): void | +| `pricingScheme` | [`string(PricingScheme)`](../../doc/models/pricing-scheme.md) | Required | Omit for On/Off components | getPricingScheme(): string | setPricingScheme(string pricingScheme): void | +| `prices` | [`Price[]`](../../doc/models/price.md) | Required | On/off components only need one price bracket starting at 1. | getPrices(): array | setPrices(array prices): void | + +## Example (as JSON) + +```json +{ + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ], + "tax_included": false +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item-request.md b/doc/models/scheduled-renewal-configuration-item-request.md new file mode 100644 index 0000000..8f25d91 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item-request.md @@ -0,0 +1,42 @@ + +# Scheduled Renewal Configuration Item Request + +## Structure + +`ScheduledRenewalConfigurationItemRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `renewalConfigurationItem` | [ScheduledRenewalItemRequestBodyComponent](../../doc/models/scheduled-renewal-item-request-body-component.md)\|[ScheduledRenewalItemRequestBodyProduct](../../doc/models/scheduled-renewal-item-request-body-product.md) | Required | This is a container for one-of cases. | getRenewalConfigurationItem(): | setRenewalConfigurationItem( renewalConfigurationItem): void | + +## Example (as JSON) + +```json +{ + "renewal_configuration_item": { + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item-response.md b/doc/models/scheduled-renewal-configuration-item-response.md new file mode 100644 index 0000000..cd8afba --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item-response.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Item Response + +## Structure + +`ScheduledRenewalConfigurationItemResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `scheduledRenewalConfigurationItem` | [`?ScheduledRenewalConfigurationItem`](../../doc/models/scheduled-renewal-configuration-item.md) | Optional | - | getScheduledRenewalConfigurationItem(): ?ScheduledRenewalConfigurationItem | setScheduledRenewalConfigurationItem(?ScheduledRenewalConfigurationItem scheduledRenewalConfigurationItem): void | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configuration_item": { + "id": 98, + "subscription_id": 208, + "subscription_renewal_configuration_id": 108, + "item_id": 246, + "item_type": "item_type2" + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-item.md b/doc/models/scheduled-renewal-configuration-item.md new file mode 100644 index 0000000..70e7b4d --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-item.md @@ -0,0 +1,35 @@ + +# Scheduled Renewal Configuration Item + +## Structure + +`ScheduledRenewalConfigurationItem` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?int` | Optional | - | getId(): ?int | setId(?int id): void | +| `subscriptionId` | `?int` | Optional | - | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | +| `subscriptionRenewalConfigurationId` | `?int` | Optional | - | getSubscriptionRenewalConfigurationId(): ?int | setSubscriptionRenewalConfigurationId(?int subscriptionRenewalConfigurationId): void | +| `itemId` | `?int` | Optional | - | getItemId(): ?int | setItemId(?int itemId): void | +| `itemType` | `?string` | Optional | - | getItemType(): ?string | setItemType(?string itemType): void | +| `itemSubclass` | `?string` | Optional | - | getItemSubclass(): ?string | setItemSubclass(?string itemSubclass): void | +| `pricePointId` | `?int` | Optional | - | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | +| `pricePointType` | `?string` | Optional | - | getPricePointType(): ?string | setPricePointType(?string pricePointType): void | +| `quantity` | `?int` | Optional | - | getQuantity(): ?int | setQuantity(?int quantity): void | +| `decimalQuantity` | `?string` | Optional | - | getDecimalQuantity(): ?string | setDecimalQuantity(?string decimalQuantity): void | +| `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | + +## Example (as JSON) + +```json +{ + "id": 146, + "subscription_id": 0, + "subscription_renewal_configuration_id": 156, + "item_id": 38, + "item_type": "item_type4" +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-request-body.md b/doc/models/scheduled-renewal-configuration-request-body.md new file mode 100644 index 0000000..cb5f71a --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-request-body.md @@ -0,0 +1,29 @@ + +# Scheduled Renewal Configuration Request Body + +## Structure + +`ScheduledRenewalConfigurationRequestBody` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `startsAt` | `?DateTime` | Optional | (Optional) Start of the renewal term. | getStartsAt(): ?\DateTime | setStartsAt(?\DateTime startsAt): void | +| `endsAt` | `?DateTime` | Optional | (Optional) End of the renewal term. | getEndsAt(): ?\DateTime | setEndsAt(?\DateTime endsAt): void | +| `lockInAt` | `?DateTime` | Optional | (Optional) Lock-in date for the renewal. | getLockInAt(): ?\DateTime | setLockInAt(?\DateTime lockInAt): void | +| `contractId` | `?int` | Optional | (Optional) Existing contract to associate with the scheduled renewal. Contracts must be enabled for your site. | getContractId(): ?int | setContractId(?int contractId): void | +| `createNewContract` | `?bool` | Optional | (Optional) Set to true to create a new contract when contracts are enabled. Contracts must be enabled for your site. | getCreateNewContract(): ?bool | setCreateNewContract(?bool createNewContract): void | + +## Example (as JSON) + +```json +{ + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z", + "lock_in_at": "2016-03-13T12:52:32.123Z", + "contract_id": 110, + "create_new_contract": false +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-request.md b/doc/models/scheduled-renewal-configuration-request.md new file mode 100644 index 0000000..d83af8c --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-request.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Request + +## Structure + +`ScheduledRenewalConfigurationRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `renewalConfiguration` | [`ScheduledRenewalConfigurationRequestBody`](../../doc/models/scheduled-renewal-configuration-request-body.md) | Required | - | getRenewalConfiguration(): ScheduledRenewalConfigurationRequestBody | setRenewalConfiguration(ScheduledRenewalConfigurationRequestBody renewalConfiguration): void | + +## Example (as JSON) + +```json +{ + "renewal_configuration": { + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z", + "lock_in_at": "2016-03-13T12:52:32.123Z", + "contract_id": 244, + "create_new_contract": false + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration-response.md b/doc/models/scheduled-renewal-configuration-response.md new file mode 100644 index 0000000..dbf0355 --- /dev/null +++ b/doc/models/scheduled-renewal-configuration-response.md @@ -0,0 +1,27 @@ + +# Scheduled Renewal Configuration Response + +## Structure + +`ScheduledRenewalConfigurationResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `scheduledRenewalConfiguration` | [`?ScheduledRenewalConfiguration`](../../doc/models/scheduled-renewal-configuration.md) | Optional | - | getScheduledRenewalConfiguration(): ?ScheduledRenewalConfiguration | setScheduledRenewalConfiguration(?ScheduledRenewalConfiguration scheduledRenewalConfiguration): void | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configuration": { + "id": 134, + "site_id": 60, + "subscription_id": 244, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + } +} +``` + diff --git a/doc/models/scheduled-renewal-configuration.md b/doc/models/scheduled-renewal-configuration.md new file mode 100644 index 0000000..5304b2d --- /dev/null +++ b/doc/models/scheduled-renewal-configuration.md @@ -0,0 +1,34 @@ + +# Scheduled Renewal Configuration + +## Structure + +`ScheduledRenewalConfiguration` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?int` | Optional | ID of the renewal. | getId(): ?int | setId(?int id): void | +| `siteId` | `?int` | Optional | ID of the site to which the renewal belongs. | getSiteId(): ?int | setSiteId(?int siteId): void | +| `subscriptionId` | `?int` | Optional | The id of the subscription. | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | +| `startsAt` | `?DateTime` | Optional | - | getStartsAt(): ?\DateTime | setStartsAt(?\DateTime startsAt): void | +| `endsAt` | `?DateTime` | Optional | - | getEndsAt(): ?\DateTime | setEndsAt(?\DateTime endsAt): void | +| `lockInAt` | `?DateTime` | Optional | - | getLockInAt(): ?\DateTime | setLockInAt(?\DateTime lockInAt): void | +| `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | +| `status` | `?string` | Optional | - | getStatus(): ?string | setStatus(?string status): void | +| `scheduledRenewalConfigurationItems` | [`?(ScheduledRenewalConfigurationItem[])`](../../doc/models/scheduled-renewal-configuration-item.md) | Optional | - | getScheduledRenewalConfigurationItems(): ?array | setScheduledRenewalConfigurationItems(?array scheduledRenewalConfigurationItems): void | +| `contract` | [`?Contract`](../../doc/models/contract.md) | Optional | Contract linked to the scheduled renewal configuration. | getContract(): ?Contract | setContract(?Contract contract): void | + +## Example (as JSON) + +```json +{ + "id": 152, + "site_id": 78, + "subscription_id": 6, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" +} +``` + diff --git a/doc/models/scheduled-renewal-configurations-response.md b/doc/models/scheduled-renewal-configurations-response.md new file mode 100644 index 0000000..b358633 --- /dev/null +++ b/doc/models/scheduled-renewal-configurations-response.md @@ -0,0 +1,43 @@ + +# Scheduled Renewal Configurations Response + +## Structure + +`ScheduledRenewalConfigurationsResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `scheduledRenewalConfigurations` | [`?(ScheduledRenewalConfiguration[])`](../../doc/models/scheduled-renewal-configuration.md) | Optional | - | getScheduledRenewalConfigurations(): ?array | setScheduledRenewalConfigurations(?array scheduledRenewalConfigurations): void | + +## Example (as JSON) + +```json +{ + "scheduled_renewal_configurations": [ + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + }, + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + }, + { + "id": 122, + "site_id": 48, + "subscription_id": 232, + "starts_at": "2016-03-13T12:52:32.123Z", + "ends_at": "2016-03-13T12:52:32.123Z" + } + ] +} +``` + diff --git a/doc/models/scheduled-renewal-item-request-body-component.md b/doc/models/scheduled-renewal-item-request-body-component.md new file mode 100644 index 0000000..d4252b7 --- /dev/null +++ b/doc/models/scheduled-renewal-item-request-body-component.md @@ -0,0 +1,44 @@ + +# Scheduled Renewal Item Request Body Component + +## Structure + +`ScheduledRenewalItemRequestBodyComponent` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `itemType` | `string` | Required, Constant | Item type to add. Either Product or Component.

**Value**: `'Component'` | getItemType(): string | setItemType(string itemType): void | +| `itemId` | `int` | Required | Product or component identifier. | getItemId(): int | setItemId(int itemId): void | +| `pricePointId` | `?int` | Optional | Price point identifier. | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | +| `quantity` | `?int` | Optional | Optional quantity for the item. | getQuantity(): ?int | setQuantity(?int quantity): void | +| `customPrice` | [`?ScheduledRenewalComponentCustomPrice`](../../doc/models/scheduled-renewal-component-custom-price.md) | Optional | Custom pricing for a component within a scheduled renewal. | getCustomPrice(): ?ScheduledRenewalComponentCustomPrice | setCustomPrice(?ScheduledRenewalComponentCustomPrice customPrice): void | + +## Example (as JSON) + +```json +{ + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } +} +``` + diff --git a/doc/models/scheduled-renewal-item-request-body-product.md b/doc/models/scheduled-renewal-item-request-body-product.md new file mode 100644 index 0000000..e265e9b --- /dev/null +++ b/doc/models/scheduled-renewal-item-request-body-product.md @@ -0,0 +1,38 @@ + +# Scheduled Renewal Item Request Body Product + +## Structure + +`ScheduledRenewalItemRequestBodyProduct` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `itemType` | `string` | Required, Constant | Item type to add. Either Product or Component.

**Value**: `'Product'` | getItemType(): string | setItemType(string itemType): void | +| `itemId` | `int` | Required | Product or component identifier. | getItemId(): int | setItemId(int itemId): void | +| `pricePointId` | `?int` | Optional | Price point identifier. | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | +| `quantity` | `?int` | Optional | Optional quantity for the item. | getQuantity(): ?int | setQuantity(?int quantity): void | +| `customPrice` | [`?ScheduledRenewalProductPricePoint`](../../doc/models/scheduled-renewal-product-price-point.md) | Optional | Custom pricing for a product within a scheduled renewal. | getCustomPrice(): ?ScheduledRenewalProductPricePoint | setCustomPrice(?ScheduledRenewalProductPricePoint customPrice): void | + +## Example (as JSON) + +```json +{ + "item_type": "Product", + "item_id": 32, + "price_point_id": 18, + "quantity": 96, + "custom_price": { + "name": "name4", + "handle": "handle0", + "price_in_cents": "String3", + "interval": "String3", + "interval_unit": "day", + "tax_included": false, + "initial_charge_in_cents": 30, + "expiration_interval": 52 + } +} +``` + diff --git a/doc/models/scheduled-renewal-lock-in-request.md b/doc/models/scheduled-renewal-lock-in-request.md new file mode 100644 index 0000000..d36c1cb --- /dev/null +++ b/doc/models/scheduled-renewal-lock-in-request.md @@ -0,0 +1,21 @@ + +# Scheduled Renewal Lock in Request + +## Structure + +`ScheduledRenewalLockInRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `lockInAt` | `DateTime` | Required | Date to lock in the renewal. | getLockInAt(): \DateTime | setLockInAt(\DateTime lockInAt): void | + +## Example (as JSON) + +```json +{ + "lock_in_at": "2016-03-13" +} +``` + diff --git a/doc/models/scheduled-renewal-product-price-point.md b/doc/models/scheduled-renewal-product-price-point.md new file mode 100644 index 0000000..9d1e07a --- /dev/null +++ b/doc/models/scheduled-renewal-product-price-point.md @@ -0,0 +1,38 @@ + +# Scheduled Renewal Product Price Point + +Custom pricing for a product within a scheduled renewal. + +## Structure + +`ScheduledRenewalProductPricePoint` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `name` | `?string` | Optional | (Optional) | getName(): ?string | setName(?string name): void | +| `handle` | `?string` | Optional | (Optional) | getHandle(): ?string | setHandle(?string handle): void | +| `priceInCents` | string\|int | Required | This is a container for one-of cases. | getPriceInCents(): | setPriceInCents( priceInCents): void | +| `interval` | string\|int | Required | This is a container for one-of cases. | getInterval(): | setInterval( interval): void | +| `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Required | Required if using `custom_price` attribute. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | +| `taxIncluded` | `?bool` | Optional | (Optional) | getTaxIncluded(): ?bool | setTaxIncluded(?bool taxIncluded): void | +| `initialChargeInCents` | `?int` | Optional | The product price point initial charge, in integer cents. | getInitialChargeInCents(): ?int | setInitialChargeInCents(?int initialChargeInCents): void | +| `expirationInterval` | `?int` | Optional | The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product price point would expire after 30 days. | getExpirationInterval(): ?int | setExpirationInterval(?int expirationInterval): void | +| `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this product price point, either month, day or never | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | + +## Example (as JSON) + +```json +{ + "name": "name4", + "handle": "handle0", + "price_in_cents": "String3", + "interval": "String9", + "interval_unit": "day", + "tax_included": false, + "initial_charge_in_cents": 86, + "expiration_interval": 108 +} +``` + diff --git a/doc/models/scheduled-renewal-update-request.md b/doc/models/scheduled-renewal-update-request.md new file mode 100644 index 0000000..9283d73 --- /dev/null +++ b/doc/models/scheduled-renewal-update-request.md @@ -0,0 +1,42 @@ + +# Scheduled Renewal Update Request + +## Structure + +`ScheduledRenewalUpdateRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `renewalConfigurationItem` | [ScheduledRenewalItemRequestBodyComponent](../../doc/models/scheduled-renewal-item-request-body-component.md)\|[ScheduledRenewalItemRequestBodyProduct](../../doc/models/scheduled-renewal-item-request-body-product.md) | Required | This is a container for one-of cases. | getRenewalConfigurationItem(): | setRenewalConfigurationItem( renewalConfigurationItem): void | + +## Example (as JSON) + +```json +{ + "renewal_configuration_item": { + "item_type": "Component", + "item_id": 108, + "price_point_id": 122, + "quantity": 212, + "custom_price": { + "tax_included": false, + "pricing_scheme": "stairstep", + "prices": [ + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + }, + { + "starting_quantity": 242, + "ending_quantity": 40, + "unit_price": 23.26 + } + ] + } + } +} +``` + diff --git a/doc/models/send-email.md b/doc/models/send-email.md new file mode 100644 index 0000000..c6e7e82 --- /dev/null +++ b/doc/models/send-email.md @@ -0,0 +1,23 @@ + +# Send Email + +## Structure + +`SendEmail` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `canExecute` | `bool` | Required | - | getCanExecute(): bool | setCanExecute(bool canExecute): void | +| `url` | `string` | Required | - | getUrl(): string | setUrl(string url): void | + +## Example (as JSON) + +```json +{ + "can_execute": false, + "url": "url2" +} +``` + diff --git a/doc/models/send-invoice-request.md b/doc/models/send-invoice-request.md index 53cdbe1..c9d23c3 100644 --- a/doc/models/send-invoice-request.md +++ b/doc/models/send-invoice-request.md @@ -12,6 +12,7 @@ | `recipientEmails` | `?(string[])` | Optional | **Constraints**: *Maximum Items*: `5` | getRecipientEmails(): ?array | setRecipientEmails(?array recipientEmails): void | | `ccRecipientEmails` | `?(string[])` | Optional | **Constraints**: *Maximum Items*: `5` | getCcRecipientEmails(): ?array | setCcRecipientEmails(?array ccRecipientEmails): void | | `bccRecipientEmails` | `?(string[])` | Optional | **Constraints**: *Maximum Items*: `5` | getBccRecipientEmails(): ?array | setBccRecipientEmails(?array bccRecipientEmails): void | +| `attachmentUrls` | `?(string[])` | Optional | Array of URLs to files to attach to the invoice email. Max 10 files, 10MB each.

**Constraints**: *Maximum Items*: `10` | getAttachmentUrls(): ?array | setAttachmentUrls(?array attachmentUrls): void | ## Example (as JSON) @@ -27,6 +28,10 @@ ], "bcc_recipient_emails": [ "bcc_recipient_emails6" + ], + "attachment_urls": [ + "attachment_urls0", + "attachment_urls1" ] } ``` diff --git a/doc/models/status.md b/doc/models/status.md new file mode 100644 index 0000000..3531d2c --- /dev/null +++ b/doc/models/status.md @@ -0,0 +1,18 @@ + +# Status + +## Enumeration + +`Status` + +## Fields + +| Name | +| --- | +| `DRAFT` | +| `SCHEDULED` | +| `PENDING` | +| `CANCELED` | +| `ACTIVE` | +| `FULFILLED` | + diff --git a/doc/models/subscription-component.md b/doc/models/subscription-component.md index 423b299..d3f750e 100644 --- a/doc/models/subscription-component.md +++ b/doc/models/subscription-component.md @@ -22,8 +22,8 @@ | `componentHandle` | `?string` | Optional | - | getComponentHandle(): ?string | setComponentHandle(?string componentHandle): void | | `subscriptionId` | `?int` | Optional | - | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `recurring` | `?bool` | Optional | - | getRecurring(): ?bool | setRecurring(?bool recurring): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | -| `downgradeCredit` | [`?string(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`. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `downgradeCredit` | [`?string(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. | getDowngradeCredit(): ?string | setDowngradeCredit(?string downgradeCredit): void | | `archivedAt` | `?DateTime` | Optional | - | getArchivedAt(): ?\DateTime | setArchivedAt(?\DateTime archivedAt): void | | `pricePointId` | `?int` | Optional | - | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | | `pricePointHandle` | `?string` | Optional | - | getPricePointHandle(): ?string | setPricePointHandle(?string pricePointHandle): void | diff --git a/doc/models/subscription-custom-price.md b/doc/models/subscription-custom-price.md index e973214..1ee3944 100644 --- a/doc/models/subscription-custom-price.md +++ b/doc/models/subscription-custom-price.md @@ -1,7 +1,7 @@ # Subscription Custom Price -(Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription +(Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. ## Structure diff --git a/doc/models/subscription-group-component-custom-price.md b/doc/models/subscription-group-component-custom-price.md index 7ac9d64..1310ab1 100644 --- a/doc/models/subscription-group-component-custom-price.md +++ b/doc/models/subscription-group-component-custom-price.md @@ -33,14 +33,14 @@ Used in place of `price_point_id` to define a custom price point unique to the s "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } ] } diff --git a/doc/models/subscription-group-response.md b/doc/models/subscription-group-response.md index 2b8cb3d..cb3f814 100644 --- a/doc/models/subscription-group-response.md +++ b/doc/models/subscription-group-response.md @@ -16,6 +16,7 @@ ```json { "subscription_group": { + "uid": "uid8", "customer_id": 220, "payment_profile": { "id": 44, @@ -27,8 +28,7 @@ "subscription_ids": [ 74, 75 - ], - "created_at": "2016-03-13T12:52:32.123Z" + ] } } ``` diff --git a/doc/models/subscription-group-signup-component.md b/doc/models/subscription-group-signup-component.md index 8d10b31..072c64c 100644 --- a/doc/models/subscription-group-signup-component.md +++ b/doc/models/subscription-group-signup-component.md @@ -43,42 +43,42 @@ "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] }, { "tax_included": false, "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] }, { "tax_included": false, "pricing_scheme": "stairstep", "interval": 230, "interval_unit": "day", + "list_price_point_id": 10, "prices": [ { "starting_quantity": 242, "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } ] } diff --git a/doc/models/subscription-group-signup-item.md b/doc/models/subscription-group-signup-item.md index 406ac78..99c5057 100644 --- a/doc/models/subscription-group-signup-item.md +++ b/doc/models/subscription-group-signup-item.md @@ -19,7 +19,7 @@ | `currency` | `?string` | Optional | (Optional) If Multi-Currency is enabled and the currency is configured in Chargify, pass it at signup to create a subscription on a non-default currency. Note that you cannot update the currency of an existing subscription. | getCurrency(): ?string | setCurrency(?string currency): void | | `couponCodes` | `?(string[])` | Optional | An array for all the coupons attached to the subscription. | getCouponCodes(): ?array | setCouponCodes(?array couponCodes): void | | `components` | [`?(SubscriptionGroupSignupComponent[])`](../../doc/models/subscription-group-signup-component.md) | Optional | - | getComponents(): ?array | setComponents(?array components): void | -| `customPrice` | [`?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 | getCustomPrice(): ?SubscriptionCustomPrice | setCustomPrice(?SubscriptionCustomPrice customPrice): void | +| `customPrice` | [`?SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | getCustomPrice(): ?SubscriptionCustomPrice | setCustomPrice(?SubscriptionCustomPrice customPrice): void | | `calendarBilling` | [`?CalendarBilling`](../../doc/models/calendar-billing.md) | Optional | (Optional). Cannot be used when also specifying next_billing_at | getCalendarBilling(): ?CalendarBilling | setCalendarBilling(?CalendarBilling calendarBilling): void | | `metafields` | `?array` | 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. | getMetafields(): ?array | setMetafields(?array metafields): void | diff --git a/doc/models/subscription-group.md b/doc/models/subscription-group.md index 519f4a5..f53fa1e 100644 --- a/doc/models/subscription-group.md +++ b/doc/models/subscription-group.md @@ -9,6 +9,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | +| `uid` | `?string` | Optional | - | getUid(): ?string | setUid(?string uid): void | | `customerId` | `?int` | Optional | - | getCustomerId(): ?int | setCustomerId(?int customerId): void | | `paymentProfile` | [`?SubscriptionGroupPaymentProfile`](../../doc/models/subscription-group-payment-profile.md) | Optional | - | getPaymentProfile(): ?SubscriptionGroupPaymentProfile | setPaymentProfile(?SubscriptionGroupPaymentProfile paymentProfile): void | | `paymentCollectionMethod` | [`?string(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`. | getPaymentCollectionMethod(): ?string | setPaymentCollectionMethod(?string paymentCollectionMethod): void | @@ -19,6 +20,7 @@ ```json { + "uid": "uid4", "customer_id": 36, "payment_profile": { "id": 44, @@ -31,8 +33,7 @@ 146, 147, 148 - ], - "created_at": "2016-03-13T12:52:32.123Z" + ] } ``` diff --git a/doc/models/subscription-sort.md b/doc/models/subscription-sort.md index 8ccb033..b07e8ee 100644 --- a/doc/models/subscription-sort.md +++ b/doc/models/subscription-sort.md @@ -15,4 +15,8 @@ | `NEXT_ASSESSMENT` | | `UPDATED_AT` | | `CREATED_AT` | +| `TOTAL_PAYMENTS` | +| `ID` | +| `OPEN_BALANCE` | +| `EXPIRES_AT` | diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 3d4dd7b..6c938fb 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -46,7 +46,7 @@ | `nextProductHandle` | `?string` | Optional | If a delayed product change is scheduled, the handle of the product that the subscription will be changed to at the next renewal. | getNextProductHandle(): ?string | setNextProductHandle(?string nextProductHandle): void | | `couponUseCount` | `?int` | Optional | (deprecated) How many times the subscription's single coupon has been used. This field has no replacement for multiple coupons. | getCouponUseCount(): ?int | setCouponUseCount(?int couponUseCount): void | | `couponUsesAllowed` | `?int` | Optional | (deprecated) How many times the subscription's single coupon may be used. This field has no replacement for multiple coupons. | getCouponUsesAllowed(): ?int | setCouponUsesAllowed(?int couponUsesAllowed): void | -| `reasonCode` | `?string` | Optional | If the subscription is canceled, this is their churn code. | getReasonCode(): ?string | setReasonCode(?string reasonCode): void | +| `reasonCode` | `?string` | Optional | The churn reason code associated to a cancelled subscription. | getReasonCode(): ?string | setReasonCode(?string reasonCode): void | | `automaticallyResumeAt` | `?DateTime` | Optional | The date the subscription is scheduled to automatically resume from the on_hold state. | getAutomaticallyResumeAt(): ?\DateTime | setAutomaticallyResumeAt(?\DateTime automaticallyResumeAt): void | | `couponCodes` | `?(string[])` | Optional | An array for all the coupons attached to the subscription. | getCouponCodes(): ?array | setCouponCodes(?array couponCodes): void | | `offerId` | `?int` | Optional | The ID of the offer associated with the subscription. | getOfferId(): ?int | setOfferId(?int offerId): void | @@ -57,7 +57,7 @@ | `nextProductPricePointId` | `?int` | Optional | If a delayed product change is scheduled, the ID of the product price point that the subscription will be changed to at the next renewal. | getNextProductPricePointId(): ?int | setNextProductPricePointId(?int nextProductPricePointId): void | | `netTerms` | `?int` | Optional | On Relationship Invoicing, the number of days before a renewal invoice is due. | getNetTerms(): ?int | setNetTerms(?int netTerms): void | | `storedCredentialTransactionId` | `?int` | Optional | For European sites subject to PSD2 and using 3D Secure, this can be used to reference a previous transaction for the customer. This will ensure the card will be charged successfully at renewal. | getStoredCredentialTransactionId(): ?int | setStoredCredentialTransactionId(?int storedCredentialTransactionId): void | -| `reference` | `?string` | Optional | The reference value (provided by your app) for the subscription itelf. | getReference(): ?string | setReference(?string reference): void | +| `reference` | `?string` | Optional | The reference value (provided by your app) for the subscription istelf. | getReference(): ?string | setReference(?string reference): void | | `onHoldAt` | `?DateTime` | Optional | The timestamp of the most recent on hold action. | getOnHoldAt(): ?\DateTime | setOnHoldAt(?\DateTime onHoldAt): void | | `prepaidDunning` | `?bool` | Optional | Boolean representing whether the subscription is prepaid and currently in dunning. Only returned for Relationship Invoicing sites with the feature enabled | getPrepaidDunning(): ?bool | setPrepaidDunning(?bool prepaidDunning): void | | `coupons` | [`?(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. | getCoupons(): ?array | setCoupons(?array coupons): void | diff --git a/doc/models/update-component.md b/doc/models/update-component.md index 428d2c5..0953d5b 100644 --- a/doc/models/update-component.md +++ b/doc/models/update-component.md @@ -17,7 +17,7 @@ | `taxCode` | `?string` | Optional | A string representing the tax code related to the component type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | | `itemCategory` | [`?string(ItemCategory)`](../../doc/models/item-category.md) | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | getItemCategory(): ?string | setItemCategory(?string itemCategory): void | | `displayOnHostedPage` | `?bool` | Optional | - | getDisplayOnHostedPage(): ?bool | setDisplayOnHostedPage(?bool displayOnHostedPage): void | -| `upgradeCharge` | [`?string(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`. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | +| `upgradeCharge` | [`?string(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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | ## Example (as JSON) diff --git a/doc/models/update-subscription-component.md b/doc/models/update-subscription-component.md index 492635c..6936969 100644 --- a/doc/models/update-subscription-component.md +++ b/doc/models/update-subscription-component.md @@ -22,6 +22,7 @@ "pricing_scheme": "stairstep", "interval": 66, "interval_unit": "day", + "list_price_point_id": 174, "prices": [ { "starting_quantity": 242, @@ -33,8 +34,7 @@ "ending_quantity": 40, "unit_price": 23.26 } - ], - "renew_prepaid_allocation": false + ] } } ``` diff --git a/doc/models/update-subscription.md b/doc/models/update-subscription.md index bf65412..0243c73 100644 --- a/doc/models/update-subscription.md +++ b/doc/models/update-subscription.md @@ -25,7 +25,7 @@ | `netTerms` | string\|int\|null | Optional | This is a container for one-of cases. | getNetTerms(): | setNetTerms( netTerms): void | | `storedCredentialTransactionId` | `?int` | Optional | - | getStoredCredentialTransactionId(): ?int | setStoredCredentialTransactionId(?int storedCredentialTransactionId): void | | `reference` | `?string` | Optional | - | getReference(): ?string | setReference(?string reference): void | -| `customPrice` | [`?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 | getCustomPrice(): ?SubscriptionCustomPrice | setCustomPrice(?SubscriptionCustomPrice customPrice): void | +| `customPrice` | [`?SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result in an API error. | getCustomPrice(): ?SubscriptionCustomPrice | setCustomPrice(?SubscriptionCustomPrice customPrice): void | | `components` | [`?(UpdateSubscriptionComponent[])`](../../doc/models/update-subscription-component.md) | Optional | (Optional) An array of component ids and custom prices to be added to the subscription. | getComponents(): ?array | setComponents(?array components): void | | `dunningCommunicationDelayEnabled` | `?bool` | 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. | getDunningCommunicationDelayEnabled(): ?bool | setDunningCommunicationDelayEnabled(?bool dunningCommunicationDelayEnabled): void | | `dunningCommunicationDelayTimeZone` | `?string` | Optional | Time zone for the Dunning Communication Delay feature. | getDunningCommunicationDelayTimeZone(): ?string | setDunningCommunicationDelayTimeZone(?string dunningCommunicationDelayTimeZone): void | diff --git a/doc/models/upgrade-charge-credit-type.md b/doc/models/upgrade-charge-credit-type.md new file mode 100644 index 0000000..3bc95ab --- /dev/null +++ b/doc/models/upgrade-charge-credit-type.md @@ -0,0 +1,23 @@ + +# Upgrade Charge Credit Type + +The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided. Values are: + +`full` - A charge is added for the full price of the component. + +`prorated` - A charge is added for the prorated price of the component change. + +`none` - No charge is added. + +## Enumeration + +`UpgradeChargeCreditType` + +## Fields + +| Name | +| --- | +| `FULL` | +| `PRORATED` | +| `NONE` | + diff --git a/src/AdvancedBillingClient.php b/src/AdvancedBillingClient.php index e158a1a..80e55b7 100644 --- a/src/AdvancedBillingClient.php +++ b/src/AdvancedBillingClient.php @@ -41,6 +41,7 @@ use AdvancedBillingLib\Controllers\SubscriptionInvoiceAccountController; use AdvancedBillingLib\Controllers\SubscriptionNotesController; use AdvancedBillingLib\Controllers\SubscriptionProductsController; +use AdvancedBillingLib\Controllers\SubscriptionRenewalsController; use AdvancedBillingLib\Controllers\SubscriptionsController; use AdvancedBillingLib\Controllers\SubscriptionStatusController; use AdvancedBillingLib\Controllers\WebhooksController; @@ -115,6 +116,8 @@ class AdvancedBillingClient implements ConfigurationInterface private $subscriptionProducts; + private $subscriptionRenewals; + private $subscriptionStatus; private $webhooks; @@ -144,7 +147,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('AB SDK PHP:8.0.0 on OS {os-info}') + ->userAgent('AB SDK PHP:9.0.0 on OS {os-info}') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::PRODUCTION) @@ -629,6 +632,17 @@ public function getSubscriptionProductsController(): SubscriptionProductsControl return $this->subscriptionProducts; } + /** + * Returns Subscription Renewals Controller + */ + public function getSubscriptionRenewalsController(): SubscriptionRenewalsController + { + if ($this->subscriptionRenewals == null) { + $this->subscriptionRenewals = new SubscriptionRenewalsController($this->client); + } + return $this->subscriptionRenewals; + } + /** * Returns Subscription Status Controller */ diff --git a/src/Controllers/AdvanceInvoiceController.php b/src/Controllers/AdvanceInvoiceController.php index cfc4c8d..061fc83 100644 --- a/src/Controllers/AdvanceInvoiceController.php +++ b/src/Controllers/AdvanceInvoiceController.php @@ -37,7 +37,7 @@ class AdvanceInvoiceController extends BaseController * advance invoice before using this endpoint to generate it. * * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param IssueAdvanceInvoiceRequest|null $body * * @return Invoice Response from the API call @@ -75,7 +75,7 @@ public function issueAdvanceInvoice(int $subscriptionId, ?IssueAdvanceInvoiceReq * Once an advance invoice has been generated for a subscription's upcoming renewal, it can be viewed * through this endpoint. There can only be one advance invoice per subscription per billing cycle. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return Invoice Response from the API call * @@ -101,7 +101,7 @@ public function readAdvanceInvoice(int $subscriptionId): Invoice * cause any prepayments and credits that were applied to the invoice to be returned to the * subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice). * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param VoidInvoiceRequest|null $body * * @return Invoice Response from the API call diff --git a/src/Controllers/ComponentPricePointsController.php b/src/Controllers/ComponentPricePointsController.php index 6c4cd5a..ca489cc 100644 --- a/src/Controllers/ComponentPricePointsController.php +++ b/src/Controllers/ComponentPricePointsController.php @@ -13,7 +13,9 @@ use AdvancedBillingLib\Exceptions\ApiException; use AdvancedBillingLib\Exceptions\ErrorArrayMapResponseException; use AdvancedBillingLib\Exceptions\ErrorListResponseException; +use AdvancedBillingLib\Models\CloneComponentPricePointRequest; use AdvancedBillingLib\Models\ComponentCurrencyPricesResponse; +use AdvancedBillingLib\Models\ComponentPricePointCurrencyOverageResponse; use AdvancedBillingLib\Models\ComponentPricePointResponse; use AdvancedBillingLib\Models\ComponentPricePointsResponse; use AdvancedBillingLib\Models\ComponentResponse; @@ -183,6 +185,60 @@ public function bulkCreateComponentPricePoints( return $this->execute($_reqBuilder, $_resHandler); } + /** + * Clones a component price point. Custom price points (tied to a specific subscription) cannot be + * cloned. The following attributes are copied from the source price point: + * - Pricing scheme + * - All price tiers (with starting/ending quantities and unit prices) + * - Tax included setting + * - Currency prices (if definitive pricing is set) + * - Overage pricing (for prepaid usage components) + * - Interval settings (if multi-frequency is enabled) + * - Event-based billing segments (if applicable) + * + * @param int|string $componentId The id or handle of the component. When using the handle, it + * must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle: + * example-product-handle` for a string handle. + * @param int|string $pricePointId The id or handle of the price point. When using the handle, + * it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle: + * example-price_point-handle` for a string handle. + * @param CloneComponentPricePointRequest|null $body + * + * @return ComponentPricePointCurrencyOverageResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function cloneComponentPricePoint( + $componentId, + $pricePointId, + ?CloneComponentPricePointRequest $body = null + ): ComponentPricePointCurrencyOverageResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::POST, + '/components/{component_id}/price_points/{price_point_id}/clone.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('component_id', $componentId)->required()->strictType('oneOf(int,string)'), + TemplateParam::init('price_point_id', $pricePointId)->required()->strictType('oneOf(int,string)'), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn('404', ErrorType::initWithErrorTemplate('Not Found:\'{$response.body}\'')) + ->throwErrorOn( + '422', + ErrorType::initWithErrorTemplate( + 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', + ErrorListResponseException::class + ) + ) + ->type(ComponentPricePointCurrencyOverageResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * When updating a price point, prices can be updated as well by creating new prices or editing / * removing existing ones. @@ -248,7 +304,7 @@ public function updateComponentPricePoint( * example-price_point-handle` for a string handle. * @param bool|null $currencyPrices Include an array of currency price data * - * @return ComponentPricePointResponse Response from the API call + * @return ComponentPricePointCurrencyOverageResponse Response from the API call * * @throws ApiException Thrown if API call fails */ @@ -256,7 +312,7 @@ public function readComponentPricePoint( $componentId, $pricePointId, ?bool $currencyPrices = null - ): ComponentPricePointResponse { + ): ComponentPricePointCurrencyOverageResponse { $_reqBuilder = $this->requestBuilder( RequestMethod::GET, '/components/{component_id}/price_points/{price_point_id}.json' @@ -268,7 +324,7 @@ public function readComponentPricePoint( QueryParam::init('currency_prices', $currencyPrices)->commaSeparated() ); - $_resHandler = $this->responseHandler()->type(ComponentPricePointResponse::class); + $_resHandler = $this->responseHandler()->type(ComponentPricePointCurrencyOverageResponse::class); return $this->execute($_reqBuilder, $_resHandler); } diff --git a/src/Controllers/InvoicesController.php b/src/Controllers/InvoicesController.php index a960bc9..da605bc 100644 --- a/src/Controllers/InvoicesController.php +++ b/src/Controllers/InvoicesController.php @@ -393,7 +393,7 @@ public function readCreditNote(string $uid): CreditNote * * Only ungrouped or primary subscriptions may be paid using the "bulk" payment request. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param RecordPaymentRequest|null $body * * @return RecordPaymentResponse Response from the API call @@ -756,7 +756,7 @@ public function listConsolidatedInvoiceSegments(array $options): ConsolidatedInv * * By default, invoices will be created with open status. Possible alternative is `draft`. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param CreateInvoiceRequest|null $body * * @return InvoiceResponse Response from the API call @@ -792,6 +792,10 @@ public function createInvoice(int $subscriptionId, ?CreateInvoiceRequest $body = * supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy * (bcc) recipients. * + * **File Attachments**: You can attach files to invoice emails using `attachment_urls[]` parameter by + * providing URLs to the files you want to attach. When using attachments, the request must use + * `multipart/form-data` content type. Max 10 files, 10MB per file. + * * If no recipient email addresses are specified in the request, then the subscription's default email * configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will * be delivered to the subscription's customer email address. @@ -915,9 +919,9 @@ public function updateCustomerInformation(string $uid): Invoice } /** - * This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue - * an invoice that was created when allocating new quantity on a component and using "accrue charges" - * option. + * This endpoint allows you to issue an invoice that is in "pending" or "draft" status. For example, + * you can issue an invoice that was created when allocating new quantity on a component and using + * "accrue charges" option. * * You cannot issue a pending child invoice that was created for a member subscription in a group. * diff --git a/src/Controllers/PaymentProfilesController.php b/src/Controllers/PaymentProfilesController.php index 9393374..5d2e95f 100644 --- a/src/Controllers/PaymentProfilesController.php +++ b/src/Controllers/PaymentProfilesController.php @@ -381,7 +381,7 @@ public function deleteUnusedPaymentProfile(int $paymentProfileId): void } /** - * This will delete a payment profile belonging to the customer on the subscription. + * Deletes a payment profile belonging to the customer on the subscription. * * + If the customer has multiple subscriptions, the payment profile will be removed from all of them. * @@ -391,7 +391,7 @@ public function deleteUnusedPaymentProfile(int $paymentProfileId): void * the Admin UI and use the “Add New Credit Card” or “Make Active Payment Method” link, (depending on * whether there are other cards present). * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $paymentProfileId The Chargify id of the payment profile * * @return void Response from the API call @@ -454,7 +454,7 @@ public function verifyBankAccount( } /** - * This will delete a Payment Profile belonging to a Subscription Group. + * Deletes a Payment Profile belonging to a Subscription Group. * * **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it * will be removed from all of them. @@ -488,7 +488,7 @@ public function deleteSubscriptionGroupPaymentProfile(string $uid, int $paymentP * You must elect to change the existing payment profile to a new payment profile ID in order to * receive a satisfactory response from this endpoint. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $paymentProfileId The Chargify id of the payment profile * * @return PaymentProfileResponse Response from the API call @@ -619,7 +619,7 @@ public function readOneTimeToken(string $chargifyToken): GetOneTimeTokenRequest * These error responses are designed to prevent excessive or invalid requests, and to provide clear * and helpful information to users who encounter errors during the request process. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return void Response from the API call * diff --git a/src/Controllers/ProformaInvoicesController.php b/src/Controllers/ProformaInvoicesController.php index cbeadb4..133fe35 100644 --- a/src/Controllers/ProformaInvoicesController.php +++ b/src/Controllers/ProformaInvoicesController.php @@ -16,6 +16,7 @@ use AdvancedBillingLib\Exceptions\ProformaBadRequestErrorResponseException; use AdvancedBillingLib\Models\CreateSignupProformaPreviewInclude; use AdvancedBillingLib\Models\CreateSubscriptionRequest; +use AdvancedBillingLib\Models\DeliverProformaInvoiceRequest; use AdvancedBillingLib\Models\Direction; use AdvancedBillingLib\Models\ListProformaInvoicesResponse; use AdvancedBillingLib\Models\ProformaInvoice; @@ -134,6 +135,49 @@ public function readProformaInvoice(string $proformaInvoiceUid): ProformaInvoice return $this->execute($_reqBuilder, $_resHandler); } + /** + * Allows for proforma invoices to be programmatically delivered via email. Supports email + * delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients. + * + * If `recipient_emails` is omitted, the system will fall back to the primary recipient derived from + * the invoice or + * subscription. At least one recipient must be present, either via the request body or via this + * default behavior, so an + * empty body may still succeed when defaults are available. + * + * @param string $proformaInvoiceUid The uid of the proforma invoice + * @param DeliverProformaInvoiceRequest|null $body + * + * @return ProformaInvoice Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deliverProformaInvoice( + string $proformaInvoiceUid, + ?DeliverProformaInvoiceRequest $body = null + ): ProformaInvoice { + $_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/proforma_invoices/{proforma_invoice_uid}.json') + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('proforma_invoice_uid', $proformaInvoiceUid)->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn('404', ErrorType::initWithErrorTemplate('Not Found:\'{$response.body}\'')) + ->throwErrorOn( + '422', + ErrorType::initWithErrorTemplate( + 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', + ErrorListResponseException::class + ) + ) + ->type(ProformaInvoice::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + /** * 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. @@ -146,7 +190,7 @@ public function readProformaInvoice(string $proformaInvoiceUid): ProformaInvoice * Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, * the subscription must not be in a group, must not be prepaid, and must be in a live state. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return ProformaInvoice Response from the API call * @@ -282,7 +326,7 @@ public function voidProformaInvoice(string $proformaInvoiceUid, ?VoidInvoiceRequ * Alternatively, if you have some proforma invoices already, you may make a preview call to determine * whether any billing information for the subscription's upcoming renewal has changed. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return ProformaInvoice Response from the API call * diff --git a/src/Controllers/SubscriptionComponentsController.php b/src/Controllers/SubscriptionComponentsController.php index f7af95e..0af07b0 100644 --- a/src/Controllers/SubscriptionComponentsController.php +++ b/src/Controllers/SubscriptionComponentsController.php @@ -49,7 +49,7 @@ class SubscriptionComponentsController extends BaseController /** * This request will list information regarding a specific component owned by a subscription. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $componentId The Advanced Billing id of the component. Alternatively, the * component's handle prefixed by `handle:` * @@ -142,7 +142,7 @@ public function listSubscriptionComponents(array $options): array * 3. `"_default"` string, which will reset the price point to the component's current default price * point. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param BulkComponentsPricePointAssignment|null $body * * @return BulkComponentsPricePointAssignment Response from the API call @@ -183,7 +183,7 @@ public function bulkUpdateSubscriptionComponentsPricePoints( * **Note**: this will update the price point for all of the subscription's components, even ones that * have not been allocated yet. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return SubscriptionResponse Response from the API call * @@ -202,55 +202,18 @@ public function bulkResetSubscriptionComponentsPricePoints(int $subscriptionId): } /** - * This endpoint creates a new allocation, setting the current allocated quantity for the Component and - * recording a memo. + * Creates an allocation, sets the current allocated quantity for the component, and records a memo. + * Allocations can only be updated for Quantity, On/Off, and Prepaid Components. * - * **Notice**: Allocations can only be updated for Quantity, On/Off, and Prepaid Components. + * When creating an allocation via the API, you can pass the `upgrade_charge`, `downgrade_credit`, and + * `accrue_charge` to be applied. * - * ## Allocations Documentation - * - * Full documentation on how to record Allocations in the Advanced Billing UI can be located - * [here](https://maxio.zendesk.com/hc/en-us/articles/24251883961485-Component-Allocations-Overview). - * It is focused on how allocations operate within the Advanced Billing UI.It goes into greater detail - * on how the user interface will react when recording allocations. - * - * This documentation also goes into greater detail on how proration is taken into consideration when - * applying component allocations. - * - * ## Proration Schemes - * - * Changing the allocated quantity of a component mid-period can result in either a Charge or Credit - * being applied to the subscription. When creating an allocation via the API, you can pass the - * `upgrade_charge`, `downgrade_credit`, and `accrue_charge` to be applied. - * - * **Notice:** These proration and accural fields will be ignored for Prepaid Components since this + * > **Note:** These proration and accural fields are ignored for Prepaid Components since this * component type always generate charges immediately without proration. * - * For background information on prorated components and upgrade/downgrade schemes, see [Setting - * Component Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- - * Allocations-Proration). - * See the tables below for valid values. - * - * | upgrade_charge | Definition                                                        | - * |----------------|-------------------------------------------------------------------| - * | `full`         | A charge is added for the full price of the component.            | - * | `prorated`     | A charge is added for the prorated price of the component change. | - * | `none`         | No charge is added.                                               | - * - * | downgrade_credit | Definition                                        | - * |------------------|---------------------------------------------------| - * | `full`           | A full price credit is added for the amount owed. | - * | `prorated`       | A prorated credit is added for the amount owed.   | - * | `none`           | No charge is added.                               | - * - * | accrue_charge | Definition - *                       | - * |---------------|------------------------------------------------------------------------------------ - * ------------------------| - * | `true`        | Attempt to charge the customer at next renewal. - * | - * | `false`       | Attempt to charge the customer right away. If it fails, the charge will be accrued - * until the next renewal. | + * For information on prorated components and upgrade/downgrade schemes, see [Setting Component + * Allocations.](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component-Allocations- + * Proration) * * ### Order of Resolution for upgrade_charge and downgrade_credit * @@ -267,10 +230,13 @@ public function bulkResetSubscriptionComponentsPricePoints(int $subscriptionId): * 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- * Allocations-Proration#proration-schemes) * - * **NOTE: Proration uses the current price of the component as well as the current tax rates. Changes - * to either may cause the prorated charge/credit to be wrong.** + * > **Note:** Proration uses the current price of the component as well as the current tax rates. + * Changes to either may cause the prorated charge/credit to be wrong. + * + * For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en- + * us/articles/24251883961485-Component-Allocations-Overview) product Documentation. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $componentId The Advanced Billing id of the component * @param CreateAllocationRequest|null $body * @@ -316,23 +282,7 @@ public function allocateComponent( * When a subscription's on/off component has been toggled to on (`1`) or off (`0`), usage will be * logged in this response. * - * ## Querying data via Advanced Billing gem - * - * You can also query the current quantity via the [official Advanced Billing Gem.](http://github. - * com/chargify/chargify_api_ares) - * - * ```# First way - * component = Chargify::Subscription::Component.find(1, :params => {:subscription_id => 7}) - * puts component.allocated_quantity - * # => 23 - * - * # Second way - * component = Chargify::Subscription.find(7).component(1) - * puts component.allocated_quantity - * # => 23 - * ``` - * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $componentId The Advanced Billing id of the component * @param int|null $page 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. @@ -373,16 +323,34 @@ public function listAllocations(int $subscriptionId, int $componentId, ?int $pag } /** - * Creates multiple allocations, setting the current allocated quantity for each of the components and - * recording a memo. The charges and/or credits that are created will be rolled up into a single total - * which is used to determine whether this is an upgrade or a downgrade. Be aware of the Order of - * Resolutions explained below in determining the proration scheme. + * Creates multiple allocations, sets the current allocated quantity for each of the components, and + * recording a memo. A `component_id` is required for each allocation. + * + * The charges and/or credits that are created will be rolled up into a single total which is used to + * determine whether this is an upgrade or a downgrade. + * + * ### Order of Resolution for upgrade_charge and downgrade_credit + * + * 1. Per allocation in API call (within a single allocation of the `allocations` array) + * 2. [Component-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251883961485- + * Component-Allocations-Overview) + * 3. Allocation API call top level (outside of the `allocations` array) + * 4. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- + * Allocations-Proration#proration-schemes) + * + * ### Order of Resolution for accrue charge + * + * 1. Allocation API call top level (outside of the `allocations` array) + * 2. [Site-level default value](https://maxio.zendesk.com/hc/en-us/articles/24251906165133-Component- + * Allocations-Proration#proration-schemes) * - * A `component_id` is required for each allocation. + * > **Note:** Proration uses the current price of the component as well as the current tax rates. + * Changes to either may cause the prorated charge/credit to be wrong. * - * This endpoint only responds to JSON. It is not available for XML. + * For more informaiton see the [Component Allocations](https://maxio.zendesk.com/hc/en- + * us/articles/24251883961485-Component-Allocations-Overview) product Documentation. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param AllocateComponents|null $body * * @return AllocationResponse[] Response from the API call @@ -430,7 +398,7 @@ public function allocateComponents(int $subscriptionId, ?AllocateComponents $bod * * See example below for Fine-Grained Component Control response. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param PreviewAllocationsRequest|null $body * * @return AllocationPreviewResponse Response from the API call @@ -483,7 +451,7 @@ public function previewAllocations( * - An expiration date can be changed towards the past (essentially expiring it) up to the * subscription's current period beginning date. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $componentId The Advanced Billing id of the component * @param int $allocationId The Advanced Billing id of the allocation * @param UpdateAllocationExpirationDate|null $body @@ -542,7 +510,7 @@ public function updatePrepaidUsageAllocationExpirationDate( * 3. `refund`: The allocation will be destroyed and the balances will be updated and a refund will be * issued along with a Credit Note. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $componentId The Advanced Billing id of the component * @param int $allocationId The Advanced Billing id of the allocation * @param CreditSchemeRequest|null $body diff --git a/src/Controllers/SubscriptionGroupsController.php b/src/Controllers/SubscriptionGroupsController.php index 2fd4330..8fe9642 100644 --- a/src/Controllers/SubscriptionGroupsController.php +++ b/src/Controllers/SubscriptionGroupsController.php @@ -213,8 +213,8 @@ public function updateSubscriptionGroupMembers( } /** - * Use this endpoint to delete subscription group. - * Only groups without members can be deleted + * Deletes a subscription group. + * Only groups without members can be deleted. * * @param string $uid The uid of the subscription group * @@ -289,7 +289,7 @@ public function findSubscriptionGroup(string $subscriptionId): FullSubscriptionG * docs/d571659cf0f24-create-subscription#subscription-in-a-subscription-group) * * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param AddSubscriptionToAGroup|null $body * * @return SubscriptionGroupResponse Response from the API call @@ -319,7 +319,7 @@ public function addSubscriptionToGroup( * //maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer- * hierarchies) features, it is possible to remove existing subscription from subscription group. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return void Response from the API call * diff --git a/src/Controllers/SubscriptionInvoiceAccountController.php b/src/Controllers/SubscriptionInvoiceAccountController.php index f6d288f..7de15bf 100644 --- a/src/Controllers/SubscriptionInvoiceAccountController.php +++ b/src/Controllers/SubscriptionInvoiceAccountController.php @@ -37,7 +37,7 @@ class SubscriptionInvoiceAccountController extends BaseController * Returns the `balance_in_cents` of the Subscription's Pending Discount, Service Credit, and * Prepayment accounts, as well as the sum of the Subscription's open, payable invoices. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return AccountBalances Response from the API call * @@ -68,7 +68,7 @@ public function readAccountBalances(int $subscriptionId): AccountBalances * Note that passing `amount_in_cents` is now allowed. * * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param CreatePrepaymentRequest|null $body * * @return CreatePrepaymentResponse Response from the API call @@ -136,7 +136,7 @@ public function listPrepayments(array $options): PrepaymentsResponse * Credit will be added to the subscription in the amount specified in the request body. The credit is * subsequently applied to the next generated invoice. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param IssueServiceCreditRequest|null $body * * @return ServiceCredit Response from the API call @@ -172,7 +172,7 @@ public function issueServiceCredit(int $subscriptionId, ?IssueServiceCreditReque * Credit will be removed from the subscription in the amount specified in the request body. The credit * amount being deducted must be equal to or less than the current credit balance. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param DeductServiceCreditRequest|null $body * * @return void Response from the API call @@ -206,7 +206,7 @@ public function deductServiceCredit(int $subscriptionId, ?DeductServiceCreditReq /** * This request will list a subscription's service credits. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int|null $page 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 @@ -266,7 +266,7 @@ public function listServiceCredits( * The amount may be passed either as a decimal, with `amount`, or an integer in cents, with * `amount_in_cents`. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $prepaymentId id of prepayment * @param RefundPrepaymentRequest|null $body * diff --git a/src/Controllers/SubscriptionNotesController.php b/src/Controllers/SubscriptionNotesController.php index bfc0a5e..6826f20 100644 --- a/src/Controllers/SubscriptionNotesController.php +++ b/src/Controllers/SubscriptionNotesController.php @@ -35,7 +35,7 @@ class SubscriptionNotesController extends BaseController * Full documentation on how to use Notes in the Advanced Billing UI can be located [here](https: * //maxio.zendesk.com/hc/en-us/articles/24251712214413-Subscription-Summary-Overview). * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param UpdateSubscriptionNoteRequest|null $body * * @return SubscriptionNoteResponse Response from the API call @@ -104,7 +104,7 @@ public function listSubscriptionNotes(array $options): array * Once you have obtained the ID of the note you wish to read, use this method to show a particular * note attached to a subscription. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $noteId The Advanced Billing id of the note * * @return SubscriptionNoteResponse Response from the API call @@ -131,7 +131,7 @@ public function readSubscriptionNote(int $subscriptionId, int $noteId): Subscrip /** * Use the following method to update a note for a Subscription. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $noteId The Advanced Billing id of the note * @param UpdateSubscriptionNoteRequest|null $body * @@ -170,9 +170,9 @@ public function updateSubscriptionNote( } /** - * Use the following method to delete a note for a Subscription. + * Deletes a note for a Subscription. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $noteId The Advanced Billing id of the note * * @return void Response from the API call diff --git a/src/Controllers/SubscriptionProductsController.php b/src/Controllers/SubscriptionProductsController.php index c4c8d33..49f5136 100644 --- a/src/Controllers/SubscriptionProductsController.php +++ b/src/Controllers/SubscriptionProductsController.php @@ -119,7 +119,7 @@ class SubscriptionProductsController extends BaseController * 8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was * successful or not. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param SubscriptionProductMigrationRequest|null $body * * @return SubscriptionResponse Response from the API call @@ -163,7 +163,7 @@ public function migrateSubscriptionProduct( * This will calculate the prorated adjustment, charge, payment and credit applied values assuming the * migration is done at that date in the future as opposed to right now. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param SubscriptionMigrationPreviewRequest|null $body * * @return SubscriptionMigrationPreviewResponse Response from the API call diff --git a/src/Controllers/SubscriptionRenewalsController.php b/src/Controllers/SubscriptionRenewalsController.php new file mode 100644 index 0000000..fc4005f --- /dev/null +++ b/src/Controllers/SubscriptionRenewalsController.php @@ -0,0 +1,425 @@ +requestBuilder( + RequestMethod::POST, + '/subscriptions/{subscription_id}/scheduled_renewals.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Lists scheduled renewal configurations for the subscription and permits an optional status query + * filter. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param string|null $status (Optional) Status filter for scheduled renewal configurations. + * + * @return ScheduledRenewalConfigurationsResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function listScheduledRenewalConfigurations( + int $subscriptionId, + ?string $status = null + ): ScheduledRenewalConfigurationsResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/scheduled_renewals.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + QueryParam::init('status', $status)->commaSeparated()->serializeBy([Status::class, 'checkValue']) + ); + + $_resHandler = $this->responseHandler()->type(ScheduledRenewalConfigurationsResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Retrieves the configuration settings for the scheduled renewal. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $id The renewal id. + * + * @return ScheduledRenewalConfigurationResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function readScheduledRenewalConfiguration( + int $subscriptionId, + int $id + ): ScheduledRenewalConfigurationResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::GET, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('id', $id)->required() + ); + + $_resHandler = $this->responseHandler()->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates an existing configuration. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $id The renewal id. + * @param ScheduledRenewalConfigurationRequest|null $body + * + * @return ScheduledRenewalConfigurationResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateScheduledRenewalConfiguration( + int $subscriptionId, + int $id, + ?ScheduledRenewalConfigurationRequest $body = null + ): ScheduledRenewalConfigurationResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('id', $id)->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Schedules a future lock-in date for the renewal. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $id The renewal id. + * @param ScheduledRenewalLockInRequest|null $body + * + * @return ScheduledRenewalConfigurationResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function scheduleScheduledRenewalLockIn( + int $subscriptionId, + int $id, + ?ScheduledRenewalLockInRequest $body = null + ): ScheduledRenewalConfigurationResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/schedule_lock_in.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('id', $id)->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Locks in the renewal immediately. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $id The renewal id. + * + * @return ScheduledRenewalConfigurationResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function lockInScheduledRenewalImmediately( + int $subscriptionId, + int $id + ): ScheduledRenewalConfigurationResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/immediate_lock_in.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('id', $id)->required() + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Returns a scheduled renewal configuration to an editable state. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $id The renewal id. + * + * @return ScheduledRenewalConfigurationResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function unpublishScheduledRenewalConfiguration( + int $subscriptionId, + int $id + ): ScheduledRenewalConfigurationResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/unpublish.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('id', $id)->required() + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Cancels a scheduled renewal configuration. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $id The renewal id. + * + * @return ScheduledRenewalConfigurationResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function cancelScheduledRenewalConfiguration( + int $subscriptionId, + int $id + ): ScheduledRenewalConfigurationResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{id}/cancel.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('id', $id)->required() + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Adds product and component line items to the scheduled renewal. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $scheduledRenewalsConfigurationId The scheduled renewal configuration id. + * @param ScheduledRenewalConfigurationItemRequest|null $body + * + * @return ScheduledRenewalConfigurationItemResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function createScheduledRenewalConfigurationItem( + int $subscriptionId, + int $scheduledRenewalsConfigurationId, + ?ScheduledRenewalConfigurationItemRequest $body = null + ): ScheduledRenewalConfigurationItemResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::POST, + '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configurat' . + 'ion_id}/configuration_items.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('scheduled_renewals_configuration_id', $scheduledRenewalsConfigurationId) + ->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationItemResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Updates an existing configuration item’s pricing and quantity. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $scheduledRenewalsConfigurationId The scheduled renewal configuration id. + * @param int $id The scheduled renewal configuration item id. + * @param ScheduledRenewalUpdateRequest|null $body + * + * @return ScheduledRenewalConfigurationItemResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateScheduledRenewalConfigurationItem( + int $subscriptionId, + int $scheduledRenewalsConfigurationId, + int $id, + ?ScheduledRenewalUpdateRequest $body = null + ): ScheduledRenewalConfigurationItemResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configurat' . + 'ion_id}/configuration_items/{id}.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('scheduled_renewals_configuration_id', $scheduledRenewalsConfigurationId) + ->required(), + TemplateParam::init('id', $id)->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ) + ->type(ScheduledRenewalConfigurationItemResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Removes an item from the pending renewal configuration. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param int $scheduledRenewalsConfigurationId The scheduled renewal configuration id. + * @param int $id The scheduled renewal configuration item id. + * + * @return void Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deleteScheduledRenewalConfigurationItem( + int $subscriptionId, + int $scheduledRenewalsConfigurationId, + int $id + ): void { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/scheduled_renewals/{scheduled_renewals_configurat' . + 'ion_id}/configuration_items/{id}.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('scheduled_renewals_configuration_id', $scheduledRenewalsConfigurationId) + ->required(), + TemplateParam::init('id', $id)->required() + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '422', + ErrorType::init('Unprocessable Entity (WebDAV)', ErrorListResponseException::class) + ); + + $this->execute($_reqBuilder, $_resHandler); + } +} diff --git a/src/Controllers/SubscriptionStatusController.php b/src/Controllers/SubscriptionStatusController.php index 9f250df..ce0d94f 100644 --- a/src/Controllers/SubscriptionStatusController.php +++ b/src/Controllers/SubscriptionStatusController.php @@ -41,7 +41,7 @@ class SubscriptionStatusController extends BaseController * * The response will be `422 "Unprocessable Entity`. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return SubscriptionResponse Response from the API call * @@ -67,10 +67,11 @@ public function retrySubscription(int $subscriptionId): SubscriptionResponse } /** - * The DELETE action causes the cancellation of the Subscription. This means, the method sets the - * Subscription state to "canceled". + * Cancels the Subscription. The Delete method sets the Subscription state to `canceled`. + * To cancel the subscription immediately, omit any schedule parameters from the request. To use the + * schedule options, the Schedule Subscription Cancellation feature must be enabled on your site. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param CancellationRequest|null $body * * @return SubscriptionResponse Response from the API call @@ -105,9 +106,9 @@ public function cancelSubscription(int $subscriptionId, ?CancellationRequest $bo * subscription will return to active and will renew on that date. Otherwise, it will behave like a * reactivation, setting the billing date to 'now' and charging the subscriber. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param string|null $calendarBillingResumptionCharge (For calendar billing subscriptions only) - * The way that the resumed subscription's charge should be handled + * The way that the resumed subscription's charge should be handled. * * @return SubscriptionResponse Response from the API call * @@ -146,7 +147,7 @@ public function resumeSubscription( * * You may not place a subscription on hold if the `next_billing_at` date is within 24 hours. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param PauseRequest|null $body * * @return SubscriptionResponse Response from the API call @@ -188,7 +189,7 @@ public function pauseSubscription(int $subscriptionId, ?PauseRequest $body = nul * Alternately, you can change the `automatically_resume_at` to `null` if you would like the * subscription to not have a resume date. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param PauseRequest|null $body * * @return SubscriptionResponse Response from the API call @@ -221,9 +222,9 @@ public function updateAutomaticSubscriptionResumption( } /** - * Advanced Billing offers the ability to reactivate a previously canceled subscription. For details on - * how the reactivation works, and how to reactivate subscriptions through the application, see - * [reactivation](https://maxio.zendesk.com/hc/en-us/articles/24252109503629-Reactivating-and-Resuming). + * Reactivate a previously canceled subscription. For details on how the reactivation works, and how to + * reactivate subscriptions through the application, see [reactivation](https://maxio.zendesk.com/hc/en- + * us/articles/24252109503629-Reactivating-and-Resuming). * * **Note: The term "resume" is used also during another process in Advanced Billing. This occurs when * an on-hold subscription is "resumed". This returns the subscription to an active state.** @@ -253,6 +254,10 @@ public function updateAutomaticSubscriptionResumption( * date of July 1st, then Advanced Billing would not resume the subscription, and instead it would be * reactivated with a new billing period. * + * If a reactivation with `resume: false`, or where 'resume" is omited were attempted, then Advanced + * Billing would reactivate the subscription with a new billing period regardless of whether or not + * resuming the previous billing period were possible. + * * | Canceled | Reactivation | Resumable? | * |---|---|---| * | Jun 15 | June 28 | Yes | @@ -391,7 +396,7 @@ public function updateAutomaticSubscriptionResumption( * + The next billing date should not have changed * + Any product-related charges should have been collected * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param ReactivateSubscriptionRequest|null $body * * @return SubscriptionResponse Response from the API call @@ -427,16 +432,11 @@ public function reactivateSubscription( } /** - * Advanced Billing offers the ability to cancel a subscription at the end of the current billing - * period. This period is set by its current product. - * - * Requesting to cancel the subscription at the end of the period sets the `cancel_at_end_of_period` - * flag to true. - * - * Note that you cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription + * Cancels a subscription at the end of the current billing period based on the subscription's current + * product. You cannot set `cancel_at_end_of_period` at subscription creation, or if the subscription * is past due. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param CancellationRequest|null $body * * @return DelayedCancellationResponse Response from the API call @@ -480,7 +480,7 @@ public function initiateDelayedCancellation( * This endpoint is idempotent. If the subscription was not set to cancel in the future, removing the * delayed cancellation has no effect and the call will be successful. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return DelayedCancellationResponse Response from the API call * @@ -504,7 +504,7 @@ public function cancelDelayedCancellation(int $subscriptionId): DelayedCancellat * If a subscription is currently in dunning, the subscription will be set to active and the active * Dunner will be resolved. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * * @return SubscriptionResponse Response from the API call * @@ -562,10 +562,10 @@ public function cancelDunning(int $subscriptionId): SubscriptionResponse * * ## Subscription Side Effects * - * You can request a `POST` to obtain this data from the endpoint without any side effects. Plain and - * simple, this will preview data, not log any changes against a subscription. + * You can request a `POST` to obtain this data from the endpoint without any side effects. This method + * allows you to preview data, but does not log any changes against a subscription. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param RenewalPreviewRequest|null $body * * @return RenewalPreviewResponse Response from the API call diff --git a/src/Controllers/SubscriptionsController.php b/src/Controllers/SubscriptionsController.php index 345c040..d13344a 100644 --- a/src/Controllers/SubscriptionsController.php +++ b/src/Controllers/SubscriptionsController.php @@ -100,8 +100,8 @@ public function createSubscription(?CreateSubscriptionRequest $body = null): Sub } /** - * This method will return an array of subscriptions from a Site. Pay close attention to query string - * filters and pagination in order to control responses from the server. + * returns an array of subscriptions from a Site. Pay close attention to query string filters and + * pagination in order to control responses from the server. * * ## Search for a subscription * @@ -257,7 +257,7 @@ public function listSubscriptions(array $options): array * `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 int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param UpdateSubscriptionRequest|null $body * * @return SubscriptionResponse Response from the API call @@ -290,14 +290,14 @@ public function updateSubscription( } /** - * Use this endpoint to find subscription details. + * Retrieves subscription details. * * ## Self-Service Page token * * Self-Service Page token for the subscription is not returned by default. If this information is * desired, the include[]=self_service_page_token parameter must be provided with the request. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param string[]|null $mInclude Allows including additional data in the response. Use in * query: `include[]=coupons&include[]=self_service_page_token`. * @@ -356,7 +356,7 @@ public function readSubscription(int $subscriptionId, ?array $mInclude = null): * If unpermitted parameters are sent, a 400 HTTP response is sent along with a string giving the * reason for the problem. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param OverrideSubscriptionRequest|null $body Only these fields are available to be set. * * @return void Response from the API call @@ -421,7 +421,7 @@ public function findSubscription(?string $reference = null): SubscriptionRespons * * The query params will be: `?ack={customer_id}&cascade[]=customer&cascade[]=payment_profile` * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param int $ack id of the customer. * @param string[]|null $cascade Options are "customer" or "payment_profile". Use in query: * `cascade[]=customer&cascade[]=payment_profile`. @@ -458,7 +458,7 @@ public function purgeSubscription(int $subscriptionId, int $ack, ?array $cascade /** * Use this endpoint to update a subscription's prepaid configuration. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param UpsertPrepaidConfigurationRequest|null $body * * @return PrepaidConfigurationResponse Response from the API call @@ -563,7 +563,7 @@ public function previewSubscription(?CreateSubscriptionRequest $body = null): Su * the request body parameters as described below. When passing in request body parameters, the list of * coupon codes will simply be added to any existing list of codes on the subscription. * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param string|null $code A code for the coupon that would be applied to a subscription * @param AddCouponsRequest|null $body * @@ -608,7 +608,7 @@ public function applyCouponsToSubscription( * documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and- * Subscriptions#removing-a-coupon) * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param string|null $couponCode The coupon code * * @return string Response from the API call @@ -696,7 +696,7 @@ public function removeCouponFromSubscription(int $subscriptionId, ?string $coupo * the invoice back to the subscription. * * - * @param int $subscriptionId The Chargify id of the subscription + * @param int $subscriptionId The Chargify id of the subscription. * @param ActivateSubscriptionRequest|null $body * * @return SubscriptionResponse Response from the API call diff --git a/src/Models/AllocateComponents.php b/src/Models/AllocateComponents.php index 5ca6f86..e7f7f92 100644 --- a/src/Models/AllocateComponents.php +++ b/src/Models/AllocateComponents.php @@ -135,7 +135,6 @@ public function setAccrueCharge(?bool $accrueCharge): void * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -149,7 +148,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -163,7 +161,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { @@ -174,7 +171,6 @@ public function unsetUpgradeCharge(): void * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getDowngradeCredit(): ?string { @@ -188,7 +184,6 @@ public function getDowngradeCredit(): ?string * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps downgrade_credit * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -202,7 +197,6 @@ public function setDowngradeCredit(?string $downgradeCredit): void * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetDowngradeCredit(): void { diff --git a/src/Models/Allocation.php b/src/Models/Allocation.php index bcc9716..638730b 100644 --- a/src/Models/Allocation.php +++ b/src/Models/Allocation.php @@ -590,7 +590,6 @@ public function setInitiateDunning(?bool $initiateDunning): void * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -604,7 +603,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -618,7 +616,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { @@ -629,7 +626,6 @@ public function unsetUpgradeCharge(): void * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getDowngradeCredit(): ?string { @@ -643,7 +639,6 @@ public function getDowngradeCredit(): ?string * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps downgrade_credit * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -657,7 +652,6 @@ public function setDowngradeCredit(?string $downgradeCredit): void * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetDowngradeCredit(): void { diff --git a/src/Models/AllocationPreviewItem.php b/src/Models/AllocationPreviewItem.php index b65ff90..14763b4 100644 --- a/src/Models/AllocationPreviewItem.php +++ b/src/Models/AllocationPreviewItem.php @@ -303,7 +303,6 @@ public function setAccrueCharge(?bool $accrueCharge): void * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -317,7 +316,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -331,7 +329,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { @@ -342,7 +339,6 @@ public function unsetUpgradeCharge(): void * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getDowngradeCredit(): ?string { @@ -356,7 +352,6 @@ public function getDowngradeCredit(): ?string * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps downgrade_credit * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -370,7 +365,6 @@ public function setDowngradeCredit(?string $downgradeCredit): void * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetDowngradeCredit(): void { diff --git a/src/Models/AllocationSettings.php b/src/Models/AllocationSettings.php index 1fbb720..799592a 100644 --- a/src/Models/AllocationSettings.php +++ b/src/Models/AllocationSettings.php @@ -34,7 +34,6 @@ class AllocationSettings implements \JsonSerializable * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -48,7 +47,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -62,7 +60,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { @@ -73,7 +70,6 @@ public function unsetUpgradeCharge(): void * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getDowngradeCredit(): ?string { @@ -87,7 +83,6 @@ public function getDowngradeCredit(): ?string * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps downgrade_credit * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -101,7 +96,6 @@ public function setDowngradeCredit(?string $downgradeCredit): void * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetDowngradeCredit(): void { diff --git a/src/Models/AvailableActions.php b/src/Models/AvailableActions.php new file mode 100644 index 0000000..088449c --- /dev/null +++ b/src/Models/AvailableActions.php @@ -0,0 +1,101 @@ +sendEmail; + } + + /** + * Sets Send Email. + * + * @maps send_email + */ + public function setSendEmail(?SendEmail $sendEmail): void + { + $this->sendEmail = $sendEmail; + } + + /** + * Converts the AvailableActions object to a human-readable string representation. + * + * @return string The string representation of the AvailableActions object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'AvailableActions', + ['sendEmail' => $this->sendEmail, 'additionalProperties' => $this->additionalProperties] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->sendEmail)) { + $json['send_email'] = $this->sendEmail; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/Builders/AvailableActionsBuilder.php b/src/Models/Builders/AvailableActionsBuilder.php new file mode 100644 index 0000000..64baff7 --- /dev/null +++ b/src/Models/Builders/AvailableActionsBuilder.php @@ -0,0 +1,72 @@ +instance = $instance; + } + + /** + * Initializes a new Available Actions Builder object. + */ + public static function init(): self + { + return new self(new AvailableActions()); + } + + /** + * Sets send email field. + * + * @param SendEmail|null $value + */ + public function sendEmail(?SendEmail $value): self + { + $this->instance->setSendEmail($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Available Actions object. + */ + public function build(): AvailableActions + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CancellationOptionsBuilder.php b/src/Models/Builders/CancellationOptionsBuilder.php index bfbfffb..a303890 100644 --- a/src/Models/Builders/CancellationOptionsBuilder.php +++ b/src/Models/Builders/CancellationOptionsBuilder.php @@ -60,6 +60,48 @@ public function reasonCode(?string $value): self return $this; } + /** + * Sets cancel at end of period field. + * + * @param bool|null $value + */ + public function cancelAtEndOfPeriod(?bool $value): self + { + $this->instance->setCancelAtEndOfPeriod($value); + return $this; + } + + /** + * Sets scheduled cancellation at field. + * + * @param \DateTime|null $value + */ + public function scheduledCancellationAt(?\DateTime $value): self + { + $this->instance->setScheduledCancellationAt($value); + return $this; + } + + /** + * Unsets scheduled cancellation at field. + */ + public function unsetScheduledCancellationAt(): self + { + $this->instance->unsetScheduledCancellationAt(); + return $this; + } + + /** + * Sets refund prepayment account balance field. + * + * @param bool|null $value + */ + public function refundPrepaymentAccountBalance(?bool $value): self + { + $this->instance->setRefundPrepaymentAccountBalance($value); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/CloneComponentPricePointBuilder.php b/src/Models/Builders/CloneComponentPricePointBuilder.php new file mode 100644 index 0000000..5c44b78 --- /dev/null +++ b/src/Models/Builders/CloneComponentPricePointBuilder.php @@ -0,0 +1,73 @@ +instance = $instance; + } + + /** + * Initializes a new Clone Component Price Point Builder object. + * + * @param string $name + */ + public static function init(string $name): self + { + return new self(new CloneComponentPricePoint($name)); + } + + /** + * Sets handle field. + * + * @param string|null $value + */ + public function handle(?string $value): self + { + $this->instance->setHandle($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Clone Component Price Point object. + */ + public function build(): CloneComponentPricePoint + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CloneComponentPricePointRequestBuilder.php b/src/Models/Builders/CloneComponentPricePointRequestBuilder.php new file mode 100644 index 0000000..78325fa --- /dev/null +++ b/src/Models/Builders/CloneComponentPricePointRequestBuilder.php @@ -0,0 +1,63 @@ +instance = $instance; + } + + /** + * Initializes a new Clone Component Price Point Request Builder object. + * + * @param CloneComponentPricePoint $pricePoint + */ + public static function init(CloneComponentPricePoint $pricePoint): self + { + return new self(new CloneComponentPricePointRequest($pricePoint)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Clone Component Price Point Request object. + */ + public function build(): CloneComponentPricePointRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ComponentCustomPriceBuilder.php b/src/Models/Builders/ComponentCustomPriceBuilder.php index 39a68b6..18774ac 100644 --- a/src/Models/Builders/ComponentCustomPriceBuilder.php +++ b/src/Models/Builders/ComponentCustomPriceBuilder.php @@ -94,6 +94,37 @@ public function unsetIntervalUnit(): self return $this; } + /** + * Sets list price point id field. + * + * @param int|null $value + */ + public function listPricePointId(?int $value): self + { + $this->instance->setListPricePointId($value); + return $this; + } + + /** + * Unsets list price point id field. + */ + public function unsetListPricePointId(): self + { + $this->instance->unsetListPricePointId(); + return $this; + } + + /** + * Sets use default list price field. + * + * @param bool|null $value + */ + public function useDefaultListPrice(?bool $value): self + { + $this->instance->setUseDefaultListPrice($value); + return $this; + } + /** * Sets renew prepaid allocation field. * diff --git a/src/Models/Builders/ComponentPricePointCurrencyOverageResponseBuilder.php b/src/Models/Builders/ComponentPricePointCurrencyOverageResponseBuilder.php new file mode 100644 index 0000000..518bed2 --- /dev/null +++ b/src/Models/Builders/ComponentPricePointCurrencyOverageResponseBuilder.php @@ -0,0 +1,63 @@ +instance = $instance; + } + + /** + * Initializes a new Component Price Point Currency Overage Response Builder object. + * + * @param CurrencyOveragePrices $pricePoint + */ + public static function init(CurrencyOveragePrices $pricePoint): self + { + return new self(new ComponentPricePointCurrencyOverageResponse($pricePoint)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Component Price Point Currency Overage Response object. + */ + public function build(): ComponentPricePointCurrencyOverageResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ContractBuilder.php b/src/Models/Builders/ContractBuilder.php new file mode 100644 index 0000000..c386ecb --- /dev/null +++ b/src/Models/Builders/ContractBuilder.php @@ -0,0 +1,114 @@ +instance = $instance; + } + + /** + * Initializes a new Contract Builder object. + */ + public static function init(): self + { + return new self(new Contract()); + } + + /** + * Sets id field. + * + * @param int|null $value + */ + public function id(?int $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Sets maxio id field. + * + * @param string|null $value + */ + public function maxioId(?string $value): self + { + $this->instance->setMaxioId($value); + return $this; + } + + /** + * Sets number field. + * + * @param string|null $value + */ + public function number(?string $value): self + { + $this->instance->setNumber($value); + return $this; + } + + /** + * Unsets number field. + */ + public function unsetNumber(): self + { + $this->instance->unsetNumber(); + return $this; + } + + /** + * Sets register field. + * + * @param Register|null $value + */ + public function register(?Register $value): self + { + $this->instance->setRegister($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Contract object. + */ + public function build(): Contract + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/CreateAllocationBuilder.php b/src/Models/Builders/CreateAllocationBuilder.php index 737dbd1..b8e07e6 100644 --- a/src/Models/Builders/CreateAllocationBuilder.php +++ b/src/Models/Builders/CreateAllocationBuilder.php @@ -11,6 +11,7 @@ namespace AdvancedBillingLib\Models\Builders; use AdvancedBillingLib\Models\BillingSchedule; +use AdvancedBillingLib\Models\ComponentCustomPrice; use AdvancedBillingLib\Models\CreateAllocation; use Core\Utils\CoreHelper; @@ -41,6 +42,39 @@ public static function init(float $quantity): self return new self(new CreateAllocation($quantity)); } + /** + * Sets decimal quantity field. + * + * @param string|null $value + */ + public function decimalQuantity(?string $value): self + { + $this->instance->setDecimalQuantity($value); + return $this; + } + + /** + * Sets previous quantity field. + * + * @param float|null $value + */ + public function previousQuantity(?float $value): self + { + $this->instance->setPreviousQuantity($value); + return $this; + } + + /** + * Sets decimal previous quantity field. + * + * @param string|null $value + */ + public function decimalPreviousQuantity(?string $value): self + { + $this->instance->setDecimalPreviousQuantity($value); + return $this; + } + /** * Sets component id field. * @@ -85,17 +119,6 @@ public function prorationUpgradeScheme(?string $value): self return $this; } - /** - * Sets accrue charge field. - * - * @param bool|null $value - */ - public function accrueCharge(?bool $value): self - { - $this->instance->setAccrueCharge($value); - return $this; - } - /** * Sets downgrade credit field. * @@ -136,6 +159,17 @@ public function unsetUpgradeCharge(): self return $this; } + /** + * Sets accrue charge field. + * + * @param bool|null $value + */ + public function accrueCharge(?bool $value): self + { + $this->instance->setAccrueCharge($value); + return $this; + } + /** * Sets initiate dunning field. * @@ -178,6 +212,17 @@ public function billingSchedule(?BillingSchedule $value): self return $this; } + /** + * Sets custom price field. + * + * @param ComponentCustomPrice|null $value + */ + public function customPrice(?ComponentCustomPrice $value): self + { + $this->instance->setCustomPrice($value); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/CurrencyOveragePricesBuilder.php b/src/Models/Builders/CurrencyOveragePricesBuilder.php new file mode 100644 index 0000000..851d552 --- /dev/null +++ b/src/Models/Builders/CurrencyOveragePricesBuilder.php @@ -0,0 +1,380 @@ +instance = $instance; + } + + /** + * Initializes a new Currency Overage Prices Builder object. + */ + public static function init(): self + { + return new self(new CurrencyOveragePrices()); + } + + /** + * Sets id field. + * + * @param int|null $value + */ + public function id(?int $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Sets type field. + * + * @param string|null $value + */ + public function type(?string $value): self + { + $this->instance->setType($value); + return $this; + } + + /** + * Sets default field. + * + * @param bool|null $value + */ + public function default(?bool $value): self + { + $this->instance->setDefault($value); + return $this; + } + + /** + * Sets name field. + * + * @param string|null $value + */ + public function name(?string $value): self + { + $this->instance->setName($value); + return $this; + } + + /** + * Sets pricing scheme field. + * + * @param string|null $value + */ + public function pricingScheme(?string $value): self + { + $this->instance->setPricingScheme($value); + return $this; + } + + /** + * Sets component id field. + * + * @param int|null $value + */ + public function componentId(?int $value): self + { + $this->instance->setComponentId($value); + return $this; + } + + /** + * Sets handle field. + * + * @param string|null $value + */ + public function handle(?string $value): self + { + $this->instance->setHandle($value); + return $this; + } + + /** + * Unsets handle field. + */ + public function unsetHandle(): self + { + $this->instance->unsetHandle(); + return $this; + } + + /** + * Sets archived at field. + * + * @param \DateTime|null $value + */ + public function archivedAt(?\DateTime $value): self + { + $this->instance->setArchivedAt($value); + return $this; + } + + /** + * Unsets archived at field. + */ + public function unsetArchivedAt(): self + { + $this->instance->unsetArchivedAt(); + return $this; + } + + /** + * Sets created at field. + * + * @param \DateTime|null $value + */ + public function createdAt(?\DateTime $value): self + { + $this->instance->setCreatedAt($value); + return $this; + } + + /** + * Sets updated at field. + * + * @param \DateTime|null $value + */ + public function updatedAt(?\DateTime $value): self + { + $this->instance->setUpdatedAt($value); + return $this; + } + + /** + * Sets prices field. + * + * @param ComponentPrice[]|null $value + */ + public function prices(?array $value): self + { + $this->instance->setPrices($value); + return $this; + } + + /** + * Sets use site exchange rate field. + * + * @param bool|null $value + */ + public function useSiteExchangeRate(?bool $value): self + { + $this->instance->setUseSiteExchangeRate($value); + return $this; + } + + /** + * Sets subscription id field. + * + * @param int|null $value + */ + public function subscriptionId(?int $value): self + { + $this->instance->setSubscriptionId($value); + return $this; + } + + /** + * Sets tax included field. + * + * @param bool|null $value + */ + public function taxIncluded(?bool $value): self + { + $this->instance->setTaxIncluded($value); + return $this; + } + + /** + * Sets interval field. + * + * @param int|null $value + */ + public function interval(?int $value): self + { + $this->instance->setInterval($value); + return $this; + } + + /** + * Unsets interval field. + */ + public function unsetInterval(): self + { + $this->instance->unsetInterval(); + return $this; + } + + /** + * Sets interval unit field. + * + * @param string|null $value + */ + public function intervalUnit(?string $value): self + { + $this->instance->setIntervalUnit($value); + return $this; + } + + /** + * Unsets interval unit field. + */ + public function unsetIntervalUnit(): self + { + $this->instance->unsetIntervalUnit(); + return $this; + } + + /** + * Sets currency prices field. + * + * @param ComponentCurrencyPrice[]|null $value + */ + public function currencyPrices(?array $value): self + { + $this->instance->setCurrencyPrices($value); + return $this; + } + + /** + * Sets overage prices field. + * + * @param ComponentPrice[]|null $value + */ + public function overagePrices(?array $value): self + { + $this->instance->setOveragePrices($value); + return $this; + } + + /** + * Sets overage pricing scheme field. + * + * @param string|null $value + */ + public function overagePricingScheme(?string $value): self + { + $this->instance->setOveragePricingScheme($value); + return $this; + } + + /** + * Sets renew prepaid allocation field. + * + * @param bool|null $value + */ + public function renewPrepaidAllocation(?bool $value): self + { + $this->instance->setRenewPrepaidAllocation($value); + return $this; + } + + /** + * Sets rollover prepaid remainder field. + * + * @param bool|null $value + */ + public function rolloverPrepaidRemainder(?bool $value): self + { + $this->instance->setRolloverPrepaidRemainder($value); + return $this; + } + + /** + * Sets expiration interval field. + * + * @param int|null $value + */ + public function expirationInterval(?int $value): self + { + $this->instance->setExpirationInterval($value); + return $this; + } + + /** + * Unsets expiration interval field. + */ + public function unsetExpirationInterval(): self + { + $this->instance->unsetExpirationInterval(); + return $this; + } + + /** + * Sets expiration interval unit field. + * + * @param string|null $value + */ + public function expirationIntervalUnit(?string $value): self + { + $this->instance->setExpirationIntervalUnit($value); + return $this; + } + + /** + * Unsets expiration interval unit field. + */ + public function unsetExpirationIntervalUnit(): self + { + $this->instance->unsetExpirationIntervalUnit(); + return $this; + } + + /** + * Sets currency overage prices field. + * + * @param ComponentCurrencyPrice[]|null $value + */ + public function currencyOveragePrices(?array $value): self + { + $this->instance->setCurrencyOveragePrices($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Currency Overage Prices object. + */ + public function build(): CurrencyOveragePrices + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/DeliverProformaInvoiceRequestBuilder.php b/src/Models/Builders/DeliverProformaInvoiceRequestBuilder.php new file mode 100644 index 0000000..f481aee --- /dev/null +++ b/src/Models/Builders/DeliverProformaInvoiceRequestBuilder.php @@ -0,0 +1,93 @@ +instance = $instance; + } + + /** + * Initializes a new Deliver Proforma Invoice Request Builder object. + */ + public static function init(): self + { + return new self(new DeliverProformaInvoiceRequest()); + } + + /** + * Sets recipient emails field. + * + * @param string[]|null $value + */ + public function recipientEmails(?array $value): self + { + $this->instance->setRecipientEmails($value); + return $this; + } + + /** + * Sets cc recipient emails field. + * + * @param string[]|null $value + */ + public function ccRecipientEmails(?array $value): self + { + $this->instance->setCcRecipientEmails($value); + return $this; + } + + /** + * Sets bcc recipient emails field. + * + * @param string[]|null $value + */ + public function bccRecipientEmails(?array $value): self + { + $this->instance->setBccRecipientEmails($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Deliver Proforma Invoice Request object. + */ + public function build(): DeliverProformaInvoiceRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ProductFamilyBuilder.php b/src/Models/Builders/ProductFamilyBuilder.php index 407b9e9..bf18e1c 100644 --- a/src/Models/Builders/ProductFamilyBuilder.php +++ b/src/Models/Builders/ProductFamilyBuilder.php @@ -133,6 +133,26 @@ public function updatedAt(?\DateTime $value): self return $this; } + /** + * Sets archived at field. + * + * @param \DateTime|null $value + */ + public function archivedAt(?\DateTime $value): self + { + $this->instance->setArchivedAt($value); + return $this; + } + + /** + * Unsets archived at field. + */ + public function unsetArchivedAt(): self + { + $this->instance->unsetArchivedAt(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/ProformaInvoiceBuilder.php b/src/Models/Builders/ProformaInvoiceBuilder.php index 248e69a..824f90d 100644 --- a/src/Models/Builders/ProformaInvoiceBuilder.php +++ b/src/Models/Builders/ProformaInvoiceBuilder.php @@ -10,6 +10,7 @@ namespace AdvancedBillingLib\Models\Builders; +use AdvancedBillingLib\Models\AvailableActions; use AdvancedBillingLib\Models\InvoiceAddress; use AdvancedBillingLib\Models\InvoiceCustomer; use AdvancedBillingLib\Models\InvoiceCustomField; @@ -488,6 +489,17 @@ public function unsetPublicUrl(): self return $this; } + /** + * Sets available actions field. + * + * @param AvailableActions|null $value + */ + public function availableActions(?AvailableActions $value): self + { + $this->instance->setAvailableActions($value); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/RegisterBuilder.php b/src/Models/Builders/RegisterBuilder.php new file mode 100644 index 0000000..357f0ff --- /dev/null +++ b/src/Models/Builders/RegisterBuilder.php @@ -0,0 +1,104 @@ +instance = $instance; + } + + /** + * Initializes a new Register Builder object. + */ + public static function init(): self + { + return new self(new Register()); + } + + /** + * Sets id field. + * + * @param int|null $value + */ + public function id(?int $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Sets maxio id field. + * + * @param string|null $value + */ + public function maxioId(?string $value): self + { + $this->instance->setMaxioId($value); + return $this; + } + + /** + * Sets name field. + * + * @param string|null $value + */ + public function name(?string $value): self + { + $this->instance->setName($value); + return $this; + } + + /** + * Sets currency code field. + * + * @param string|null $value + */ + public function currencyCode(?string $value): self + { + $this->instance->setCurrencyCode($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Register object. + */ + public function build(): Register + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalComponentCustomPriceBuilder.php b/src/Models/Builders/ScheduledRenewalComponentCustomPriceBuilder.php new file mode 100644 index 0000000..6023eae --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalComponentCustomPriceBuilder.php @@ -0,0 +1,75 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Component Custom Price Builder object. + * + * @param string $pricingScheme + * @param Price[] $prices + */ + public static function init(string $pricingScheme, array $prices): self + { + return new self(new ScheduledRenewalComponentCustomPrice($pricingScheme, $prices)); + } + + /** + * Sets tax included field. + * + * @param bool|null $value + */ + public function taxIncluded(?bool $value): self + { + $this->instance->setTaxIncluded($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Component Custom Price object. + */ + public function build(): ScheduledRenewalComponentCustomPrice + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationBuilder.php new file mode 100644 index 0000000..87fe63e --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationBuilder.php @@ -0,0 +1,172 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Builder object. + */ + public static function init(): self + { + return new self(new ScheduledRenewalConfiguration()); + } + + /** + * Sets id field. + * + * @param int|null $value + */ + public function id(?int $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Sets site id field. + * + * @param int|null $value + */ + public function siteId(?int $value): self + { + $this->instance->setSiteId($value); + return $this; + } + + /** + * Sets subscription id field. + * + * @param int|null $value + */ + public function subscriptionId(?int $value): self + { + $this->instance->setSubscriptionId($value); + return $this; + } + + /** + * Sets starts at field. + * + * @param \DateTime|null $value + */ + public function startsAt(?\DateTime $value): self + { + $this->instance->setStartsAt($value); + return $this; + } + + /** + * Sets ends at field. + * + * @param \DateTime|null $value + */ + public function endsAt(?\DateTime $value): self + { + $this->instance->setEndsAt($value); + return $this; + } + + /** + * Sets lock in at field. + * + * @param \DateTime|null $value + */ + public function lockInAt(?\DateTime $value): self + { + $this->instance->setLockInAt($value); + return $this; + } + + /** + * Sets created at field. + * + * @param \DateTime|null $value + */ + public function createdAt(?\DateTime $value): self + { + $this->instance->setCreatedAt($value); + return $this; + } + + /** + * Sets status field. + * + * @param string|null $value + */ + public function status(?string $value): self + { + $this->instance->setStatus($value); + return $this; + } + + /** + * Sets scheduled renewal configuration items field. + * + * @param ScheduledRenewalConfigurationItem[]|null $value + */ + public function scheduledRenewalConfigurationItems(?array $value): self + { + $this->instance->setScheduledRenewalConfigurationItems($value); + return $this; + } + + /** + * Sets contract field. + * + * @param Contract|null $value + */ + public function contract(?Contract $value): self + { + $this->instance->setContract($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration object. + */ + public function build(): ScheduledRenewalConfiguration + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationItemBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationItemBuilder.php new file mode 100644 index 0000000..3b8b28d --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationItemBuilder.php @@ -0,0 +1,181 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Item Builder object. + */ + public static function init(): self + { + return new self(new ScheduledRenewalConfigurationItem()); + } + + /** + * Sets id field. + * + * @param int|null $value + */ + public function id(?int $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Sets subscription id field. + * + * @param int|null $value + */ + public function subscriptionId(?int $value): self + { + $this->instance->setSubscriptionId($value); + return $this; + } + + /** + * Sets subscription renewal configuration id field. + * + * @param int|null $value + */ + public function subscriptionRenewalConfigurationId(?int $value): self + { + $this->instance->setSubscriptionRenewalConfigurationId($value); + return $this; + } + + /** + * Sets item id field. + * + * @param int|null $value + */ + public function itemId(?int $value): self + { + $this->instance->setItemId($value); + return $this; + } + + /** + * Sets item type field. + * + * @param string|null $value + */ + public function itemType(?string $value): self + { + $this->instance->setItemType($value); + return $this; + } + + /** + * Sets item subclass field. + * + * @param string|null $value + */ + public function itemSubclass(?string $value): self + { + $this->instance->setItemSubclass($value); + return $this; + } + + /** + * Sets price point id field. + * + * @param int|null $value + */ + public function pricePointId(?int $value): self + { + $this->instance->setPricePointId($value); + return $this; + } + + /** + * Sets price point type field. + * + * @param string|null $value + */ + public function pricePointType(?string $value): self + { + $this->instance->setPricePointType($value); + return $this; + } + + /** + * Sets quantity field. + * + * @param int|null $value + */ + public function quantity(?int $value): self + { + $this->instance->setQuantity($value); + return $this; + } + + /** + * Sets decimal quantity field. + * + * @param string|null $value + */ + public function decimalQuantity(?string $value): self + { + $this->instance->setDecimalQuantity($value); + return $this; + } + + /** + * Sets created at field. + * + * @param \DateTime|null $value + */ + public function createdAt(?\DateTime $value): self + { + $this->instance->setCreatedAt($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration Item object. + */ + public function build(): ScheduledRenewalConfigurationItem + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationItemRequestBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationItemRequestBuilder.php new file mode 100644 index 0000000..b4d7c2c --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationItemRequestBuilder.php @@ -0,0 +1,64 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Item Request Builder object. + * + * @param ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct $renewalConfigurationItem + */ + public static function init($renewalConfigurationItem): self + { + return new self(new ScheduledRenewalConfigurationItemRequest($renewalConfigurationItem)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration Item Request object. + */ + public function build(): ScheduledRenewalConfigurationItemRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationItemResponseBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationItemResponseBuilder.php new file mode 100644 index 0000000..e6a7cc4 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationItemResponseBuilder.php @@ -0,0 +1,72 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Item Response Builder object. + */ + public static function init(): self + { + return new self(new ScheduledRenewalConfigurationItemResponse()); + } + + /** + * Sets scheduled renewal configuration item field. + * + * @param ScheduledRenewalConfigurationItem|null $value + */ + public function scheduledRenewalConfigurationItem(?ScheduledRenewalConfigurationItem $value): self + { + $this->instance->setScheduledRenewalConfigurationItem($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration Item Response object. + */ + public function build(): ScheduledRenewalConfigurationItemResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationRequestBodyBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationRequestBodyBuilder.php new file mode 100644 index 0000000..b24e73d --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationRequestBodyBuilder.php @@ -0,0 +1,115 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Request Body Builder object. + */ + public static function init(): self + { + return new self(new ScheduledRenewalConfigurationRequestBody()); + } + + /** + * Sets starts at field. + * + * @param \DateTime|null $value + */ + public function startsAt(?\DateTime $value): self + { + $this->instance->setStartsAt($value); + return $this; + } + + /** + * Sets ends at field. + * + * @param \DateTime|null $value + */ + public function endsAt(?\DateTime $value): self + { + $this->instance->setEndsAt($value); + return $this; + } + + /** + * Sets lock in at field. + * + * @param \DateTime|null $value + */ + public function lockInAt(?\DateTime $value): self + { + $this->instance->setLockInAt($value); + return $this; + } + + /** + * Sets contract id field. + * + * @param int|null $value + */ + public function contractId(?int $value): self + { + $this->instance->setContractId($value); + return $this; + } + + /** + * Sets create new contract field. + * + * @param bool|null $value + */ + public function createNewContract(?bool $value): self + { + $this->instance->setCreateNewContract($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration Request Body object. + */ + public function build(): ScheduledRenewalConfigurationRequestBody + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationRequestBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationRequestBuilder.php new file mode 100644 index 0000000..490f316 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationRequestBuilder.php @@ -0,0 +1,63 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Request Builder object. + * + * @param ScheduledRenewalConfigurationRequestBody $renewalConfiguration + */ + public static function init(ScheduledRenewalConfigurationRequestBody $renewalConfiguration): self + { + return new self(new ScheduledRenewalConfigurationRequest($renewalConfiguration)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration Request object. + */ + public function build(): ScheduledRenewalConfigurationRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationResponseBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationResponseBuilder.php new file mode 100644 index 0000000..59ced74 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationResponseBuilder.php @@ -0,0 +1,72 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configuration Response Builder object. + */ + public static function init(): self + { + return new self(new ScheduledRenewalConfigurationResponse()); + } + + /** + * Sets scheduled renewal configuration field. + * + * @param ScheduledRenewalConfiguration|null $value + */ + public function scheduledRenewalConfiguration(?ScheduledRenewalConfiguration $value): self + { + $this->instance->setScheduledRenewalConfiguration($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configuration Response object. + */ + public function build(): ScheduledRenewalConfigurationResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalConfigurationsResponseBuilder.php b/src/Models/Builders/ScheduledRenewalConfigurationsResponseBuilder.php new file mode 100644 index 0000000..13ebff3 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalConfigurationsResponseBuilder.php @@ -0,0 +1,72 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Configurations Response Builder object. + */ + public static function init(): self + { + return new self(new ScheduledRenewalConfigurationsResponse()); + } + + /** + * Sets scheduled renewal configurations field. + * + * @param ScheduledRenewalConfiguration[]|null $value + */ + public function scheduledRenewalConfigurations(?array $value): self + { + $this->instance->setScheduledRenewalConfigurations($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Configurations Response object. + */ + public function build(): ScheduledRenewalConfigurationsResponse + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalItemRequestBodyComponentBuilder.php b/src/Models/Builders/ScheduledRenewalItemRequestBodyComponentBuilder.php new file mode 100644 index 0000000..3e92d79 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalItemRequestBodyComponentBuilder.php @@ -0,0 +1,96 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Item Request Body Component Builder object. + * + * @param int $itemId + */ + public static function init(int $itemId): self + { + return new self(new ScheduledRenewalItemRequestBodyComponent($itemId)); + } + + /** + * Sets price point id field. + * + * @param int|null $value + */ + public function pricePointId(?int $value): self + { + $this->instance->setPricePointId($value); + return $this; + } + + /** + * Sets quantity field. + * + * @param int|null $value + */ + public function quantity(?int $value): self + { + $this->instance->setQuantity($value); + return $this; + } + + /** + * Sets custom price field. + * + * @param ScheduledRenewalComponentCustomPrice|null $value + */ + public function customPrice(?ScheduledRenewalComponentCustomPrice $value): self + { + $this->instance->setCustomPrice($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Item Request Body Component object. + */ + public function build(): ScheduledRenewalItemRequestBodyComponent + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalItemRequestBodyProductBuilder.php b/src/Models/Builders/ScheduledRenewalItemRequestBodyProductBuilder.php new file mode 100644 index 0000000..acefa01 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalItemRequestBodyProductBuilder.php @@ -0,0 +1,96 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Item Request Body Product Builder object. + * + * @param int $itemId + */ + public static function init(int $itemId): self + { + return new self(new ScheduledRenewalItemRequestBodyProduct($itemId)); + } + + /** + * Sets price point id field. + * + * @param int|null $value + */ + public function pricePointId(?int $value): self + { + $this->instance->setPricePointId($value); + return $this; + } + + /** + * Sets quantity field. + * + * @param int|null $value + */ + public function quantity(?int $value): self + { + $this->instance->setQuantity($value); + return $this; + } + + /** + * Sets custom price field. + * + * @param ScheduledRenewalProductPricePoint|null $value + */ + public function customPrice(?ScheduledRenewalProductPricePoint $value): self + { + $this->instance->setCustomPrice($value); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Item Request Body Product object. + */ + public function build(): ScheduledRenewalItemRequestBodyProduct + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalLockInRequestBuilder.php b/src/Models/Builders/ScheduledRenewalLockInRequestBuilder.php new file mode 100644 index 0000000..5a04e70 --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalLockInRequestBuilder.php @@ -0,0 +1,62 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Lock In Request Builder object. + * + * @param \DateTime $lockInAt + */ + public static function init(\DateTime $lockInAt): self + { + return new self(new ScheduledRenewalLockInRequest($lockInAt)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Lock In Request object. + */ + public function build(): ScheduledRenewalLockInRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalProductPricePointBuilder.php b/src/Models/Builders/ScheduledRenewalProductPricePointBuilder.php new file mode 100644 index 0000000..20124eb --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalProductPricePointBuilder.php @@ -0,0 +1,149 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Product Price Point Builder object. + * + * @param string|int $priceInCents + * @param string|int $interval + */ + public static function init($priceInCents, $interval): self + { + return new self(new ScheduledRenewalProductPricePoint($priceInCents, $interval)); + } + + /** + * Sets name field. + * + * @param string|null $value + */ + public function name(?string $value): self + { + $this->instance->setName($value); + return $this; + } + + /** + * Sets handle field. + * + * @param string|null $value + */ + public function handle(?string $value): self + { + $this->instance->setHandle($value); + return $this; + } + + /** + * Sets interval unit field. + * + * @param string|null $value + */ + public function intervalUnit(?string $value): self + { + $this->instance->setIntervalUnit($value); + return $this; + } + + /** + * Sets tax included field. + * + * @param bool|null $value + */ + public function taxIncluded(?bool $value): self + { + $this->instance->setTaxIncluded($value); + return $this; + } + + /** + * Sets initial charge in cents field. + * + * @param int|null $value + */ + public function initialChargeInCents(?int $value): self + { + $this->instance->setInitialChargeInCents($value); + return $this; + } + + /** + * Sets expiration interval field. + * + * @param int|null $value + */ + public function expirationInterval(?int $value): self + { + $this->instance->setExpirationInterval($value); + return $this; + } + + /** + * Sets expiration interval unit field. + * + * @param string|null $value + */ + public function expirationIntervalUnit(?string $value): self + { + $this->instance->setExpirationIntervalUnit($value); + return $this; + } + + /** + * Unsets expiration interval unit field. + */ + public function unsetExpirationIntervalUnit(): self + { + $this->instance->unsetExpirationIntervalUnit(); + return $this; + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Product Price Point object. + */ + public function build(): ScheduledRenewalProductPricePoint + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/ScheduledRenewalUpdateRequestBuilder.php b/src/Models/Builders/ScheduledRenewalUpdateRequestBuilder.php new file mode 100644 index 0000000..689d26f --- /dev/null +++ b/src/Models/Builders/ScheduledRenewalUpdateRequestBuilder.php @@ -0,0 +1,64 @@ +instance = $instance; + } + + /** + * Initializes a new Scheduled Renewal Update Request Builder object. + * + * @param ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct $renewalConfigurationItem + */ + public static function init($renewalConfigurationItem): self + { + return new self(new ScheduledRenewalUpdateRequest($renewalConfigurationItem)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Scheduled Renewal Update Request object. + */ + public function build(): ScheduledRenewalUpdateRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/SendEmailBuilder.php b/src/Models/Builders/SendEmailBuilder.php new file mode 100644 index 0000000..891f6eb --- /dev/null +++ b/src/Models/Builders/SendEmailBuilder.php @@ -0,0 +1,63 @@ +instance = $instance; + } + + /** + * Initializes a new Send Email Builder object. + * + * @param bool $canExecute + * @param string $url + */ + public static function init(bool $canExecute, string $url): self + { + return new self(new SendEmail($canExecute, $url)); + } + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function additionalProperty(string $name, $value): self + { + $this->instance->addAdditionalProperty($name, $value); + return $this; + } + + /** + * Initializes a new Send Email object. + */ + public function build(): SendEmail + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/SendInvoiceRequestBuilder.php b/src/Models/Builders/SendInvoiceRequestBuilder.php index d03e5e7..387256e 100644 --- a/src/Models/Builders/SendInvoiceRequestBuilder.php +++ b/src/Models/Builders/SendInvoiceRequestBuilder.php @@ -71,6 +71,17 @@ public function bccRecipientEmails(?array $value): self return $this; } + /** + * Sets attachment urls field. + * + * @param string[]|null $value + */ + public function attachmentUrls(?array $value): self + { + $this->instance->setAttachmentUrls($value); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/SubscriptionGroupBuilder.php b/src/Models/Builders/SubscriptionGroupBuilder.php index 950f560..0716529 100644 --- a/src/Models/Builders/SubscriptionGroupBuilder.php +++ b/src/Models/Builders/SubscriptionGroupBuilder.php @@ -39,6 +39,17 @@ public static function init(): self return new self(new SubscriptionGroup()); } + /** + * Sets uid field. + * + * @param string|null $value + */ + public function uid(?string $value): self + { + $this->instance->setUid($value); + return $this; + } + /** * Sets customer id field. * diff --git a/src/Models/CancellationOptions.php b/src/Models/CancellationOptions.php index be828e8..8dbd614 100644 --- a/src/Models/CancellationOptions.php +++ b/src/Models/CancellationOptions.php @@ -11,6 +11,7 @@ namespace AdvancedBillingLib\Models; use AdvancedBillingLib\ApiHelper; +use AdvancedBillingLib\Utils\DateTimeHelper; use stdClass; class CancellationOptions implements \JsonSerializable @@ -25,9 +26,24 @@ class CancellationOptions implements \JsonSerializable */ private $reasonCode; + /** + * @var bool|null + */ + private $cancelAtEndOfPeriod; + + /** + * @var array + */ + private $scheduledCancellationAt = []; + + /** + * @var bool|null + */ + private $refundPrepaymentAccountBalance; + /** * Returns Cancellation Message. - * For your internal use. An indication as to why the subscription is being canceled. + * An indication as to why the subscription is being canceled. For your internal use. */ public function getCancellationMessage(): ?string { @@ -36,7 +52,7 @@ public function getCancellationMessage(): ?string /** * Sets Cancellation Message. - * For your internal use. An indication as to why the subscription is being canceled. + * An indication as to why the subscription is being canceled. For your internal use. * * @maps cancellation_message */ @@ -47,7 +63,8 @@ public function setCancellationMessage(?string $cancellationMessage): void /** * Returns Reason Code. - * The reason code associated with the cancellation. See the list of reason codes associated with your + * The reason code associated with the cancellation. Use the [List Reason + * Codes]($e/Reason%20Codes/listReasonCodes) endpoint to retrieve the reason codes associated with your * site. */ public function getReasonCode(): ?string @@ -57,7 +74,8 @@ public function getReasonCode(): ?string /** * Sets Reason Code. - * The reason code associated with the cancellation. See the list of reason codes associated with your + * The reason code associated with the cancellation. Use the [List Reason + * Codes]($e/Reason%20Codes/listReasonCodes) endpoint to retrieve the reason codes associated with your * site. * * @maps reason_code @@ -67,6 +85,93 @@ public function setReasonCode(?string $reasonCode): void $this->reasonCode = $reasonCode; } + /** + * Returns Cancel at End of Period. + * When true, the subscription is cancelled at the current period end instead of immediately. To use + * this option, the Schedule Subscription Cancellation feature must be enabled on your site. + */ + public function getCancelAtEndOfPeriod(): ?bool + { + return $this->cancelAtEndOfPeriod; + } + + /** + * Sets Cancel at End of Period. + * When true, the subscription is cancelled at the current period end instead of immediately. To use + * this option, the Schedule Subscription Cancellation feature must be enabled on your site. + * + * @maps cancel_at_end_of_period + */ + public function setCancelAtEndOfPeriod(?bool $cancelAtEndOfPeriod): void + { + $this->cancelAtEndOfPeriod = $cancelAtEndOfPeriod; + } + + /** + * Returns Scheduled Cancellation At. + * Schedules the cancellation on the provided date. This is option is not applicable for prepaid + * subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on + * your site. + */ + public function getScheduledCancellationAt(): ?\DateTime + { + if (count($this->scheduledCancellationAt) == 0) { + return null; + } + return $this->scheduledCancellationAt['value']; + } + + /** + * Sets Scheduled Cancellation At. + * Schedules the cancellation on the provided date. This is option is not applicable for prepaid + * subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on + * your site. + * + * @maps scheduled_cancellation_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setScheduledCancellationAt(?\DateTime $scheduledCancellationAt): void + { + $this->scheduledCancellationAt['value'] = $scheduledCancellationAt; + } + + /** + * Unsets Scheduled Cancellation At. + * Schedules the cancellation on the provided date. This is option is not applicable for prepaid + * subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on + * your site. + */ + public function unsetScheduledCancellationAt(): void + { + $this->scheduledCancellationAt = []; + } + + /** + * Returns Refund Prepayment Account Balance. + * Applies to prepaid subscriptions. When true, which is the default, the remaining prepaid balance is + * refunded as part of cancellation processing. When false, prepaid balance is not refunded as part of + * cancellation processing. To use this option, the Schedule Subscription Cancellation feature must be + * enabled on your site. + */ + public function getRefundPrepaymentAccountBalance(): ?bool + { + return $this->refundPrepaymentAccountBalance; + } + + /** + * Sets Refund Prepayment Account Balance. + * Applies to prepaid subscriptions. When true, which is the default, the remaining prepaid balance is + * refunded as part of cancellation processing. When false, prepaid balance is not refunded as part of + * cancellation processing. To use this option, the Schedule Subscription Cancellation feature must be + * enabled on your site. + * + * @maps refund_prepayment_account_balance + */ + public function setRefundPrepaymentAccountBalance(?bool $refundPrepaymentAccountBalance): void + { + $this->refundPrepaymentAccountBalance = $refundPrepaymentAccountBalance; + } + /** * Converts the CancellationOptions object to a human-readable string representation. * @@ -79,6 +184,9 @@ public function __toString(): string [ 'cancellationMessage' => $this->cancellationMessage, 'reasonCode' => $this->reasonCode, + 'cancelAtEndOfPeriod' => $this->cancelAtEndOfPeriod, + 'scheduledCancellationAt' => $this->getScheduledCancellationAt(), + 'refundPrepaymentAccountBalance' => $this->refundPrepaymentAccountBalance, 'additionalProperties' => $this->additionalProperties ] ); @@ -125,10 +233,22 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; if (isset($this->cancellationMessage)) { - $json['cancellation_message'] = $this->cancellationMessage; + $json['cancellation_message'] = $this->cancellationMessage; } if (isset($this->reasonCode)) { - $json['reason_code'] = $this->reasonCode; + $json['reason_code'] = $this->reasonCode; + } + if (isset($this->cancelAtEndOfPeriod)) { + $json['cancel_at_end_of_period'] = $this->cancelAtEndOfPeriod; + } + if (!empty($this->scheduledCancellationAt)) { + $json['scheduled_cancellation_at'] = + DateTimeHelper::toRfc3339DateTime( + $this->scheduledCancellationAt['value'] + ); + } + if (isset($this->refundPrepaymentAccountBalance)) { + $json['refund_prepayment_account_balance'] = $this->refundPrepaymentAccountBalance; } $json = array_merge($json, $this->additionalProperties); diff --git a/src/Models/CloneComponentPricePoint.php b/src/Models/CloneComponentPricePoint.php new file mode 100644 index 0000000..c6b41e9 --- /dev/null +++ b/src/Models/CloneComponentPricePoint.php @@ -0,0 +1,138 @@ +name = $name; + } + + /** + * Returns Name. + */ + public function getName(): string + { + return $this->name; + } + + /** + * Sets Name. + * + * @required + * @maps name + */ + public function setName(string $name): void + { + $this->name = $name; + } + + /** + * Returns Handle. + */ + public function getHandle(): ?string + { + return $this->handle; + } + + /** + * Sets Handle. + * + * @maps handle + */ + public function setHandle(?string $handle): void + { + $this->handle = $handle; + } + + /** + * Converts the CloneComponentPricePoint object to a human-readable string representation. + * + * @return string The string representation of the CloneComponentPricePoint object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'CloneComponentPricePoint', + [ + 'name' => $this->name, + 'handle' => $this->handle, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['name'] = $this->name; + if (isset($this->handle)) { + $json['handle'] = $this->handle; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CloneComponentPricePointRequest.php b/src/Models/CloneComponentPricePointRequest.php new file mode 100644 index 0000000..1f41e64 --- /dev/null +++ b/src/Models/CloneComponentPricePointRequest.php @@ -0,0 +1,108 @@ +pricePoint = $pricePoint; + } + + /** + * Returns Price Point. + */ + public function getPricePoint(): CloneComponentPricePoint + { + return $this->pricePoint; + } + + /** + * Sets Price Point. + * + * @required + * @maps price_point + */ + public function setPricePoint(CloneComponentPricePoint $pricePoint): void + { + $this->pricePoint = $pricePoint; + } + + /** + * Converts the CloneComponentPricePointRequest object to a human-readable string representation. + * + * @return string The string representation of the CloneComponentPricePointRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'CloneComponentPricePointRequest', + ['pricePoint' => $this->pricePoint, 'additionalProperties' => $this->additionalProperties] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['price_point'] = $this->pricePoint; + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/Component.php b/src/Models/Component.php index fabd4f7..f924ccb 100644 --- a/src/Models/Component.php +++ b/src/Models/Component.php @@ -766,7 +766,6 @@ public function setRecurring(?bool $recurring): void * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -780,7 +779,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -794,7 +792,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { @@ -805,7 +802,6 @@ public function unsetUpgradeCharge(): void * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getDowngradeCredit(): ?string { @@ -819,7 +815,6 @@ public function getDowngradeCredit(): ?string * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps downgrade_credit * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -833,7 +828,6 @@ public function setDowngradeCredit(?string $downgradeCredit): void * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetDowngradeCredit(): void { diff --git a/src/Models/ComponentCustomPrice.php b/src/Models/ComponentCustomPrice.php index 1544292..35e1f25 100644 --- a/src/Models/ComponentCustomPrice.php +++ b/src/Models/ComponentCustomPrice.php @@ -38,6 +38,16 @@ class ComponentCustomPrice implements \JsonSerializable */ private $intervalUnit = []; + /** + * @var array + */ + private $listPricePointId = []; + + /** + * @var bool|null + */ + private $useDefaultListPrice; + /** * @var Price[] */ @@ -172,9 +182,66 @@ public function unsetIntervalUnit(): void $this->intervalUnit = []; } + /** + * Returns List Price Point Id. + * Optional id of the price point to use for list price calculations when + * overriding the customer price. + */ + public function getListPricePointId(): ?int + { + if (count($this->listPricePointId) == 0) { + return null; + } + return $this->listPricePointId['value']; + } + + /** + * Sets List Price Point Id. + * Optional id of the price point to use for list price calculations when + * overriding the customer price. + * + * @maps list_price_point_id + */ + public function setListPricePointId(?int $listPricePointId): void + { + $this->listPricePointId['value'] = $listPricePointId; + } + + /** + * Unsets List Price Point Id. + * Optional id of the price point to use for list price calculations when + * overriding the customer price. + */ + public function unsetListPricePointId(): void + { + $this->listPricePointId = []; + } + + /** + * Returns Use Default List Price. + * When true, list price calculations will continue to use the default price point even when a + * `custom_price` is supplied. + */ + public function getUseDefaultListPrice(): ?bool + { + return $this->useDefaultListPrice; + } + + /** + * Sets Use Default List Price. + * When true, list price calculations will continue to use the default price point even when a + * `custom_price` is supplied. + * + * @maps use_default_list_price + */ + public function setUseDefaultListPrice(?bool $useDefaultListPrice): void + { + $this->useDefaultListPrice = $useDefaultListPrice; + } + /** * Returns Prices. - * On/off components only need one price bracket starting at 1 + * On/off components only need one price bracket starting at 1. * * @return Price[] */ @@ -185,7 +252,7 @@ public function getPrices(): array /** * Sets Prices. - * On/off components only need one price bracket starting at 1 + * On/off components only need one price bracket starting at 1. * * @required * @maps prices @@ -323,6 +390,8 @@ public function __toString(): string 'pricingScheme' => $this->pricingScheme, 'interval' => $this->interval, 'intervalUnit' => $this->getIntervalUnit(), + 'listPricePointId' => $this->getListPricePointId(), + 'useDefaultListPrice' => $this->useDefaultListPrice, 'prices' => $this->prices, 'renewPrepaidAllocation' => $this->renewPrepaidAllocation, 'rolloverPrepaidRemainder' => $this->rolloverPrepaidRemainder, @@ -385,6 +454,12 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->intervalUnit)) { $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); } + if (!empty($this->listPricePointId)) { + $json['list_price_point_id'] = $this->listPricePointId['value']; + } + if (isset($this->useDefaultListPrice)) { + $json['use_default_list_price'] = $this->useDefaultListPrice; + } $json['prices'] = $this->prices; if (isset($this->renewPrepaidAllocation)) { $json['renew_prepaid_allocation'] = $this->renewPrepaidAllocation; diff --git a/src/Models/ComponentPricePoint.php b/src/Models/ComponentPricePoint.php index 66c328f..1cfcae8 100644 --- a/src/Models/ComponentPricePoint.php +++ b/src/Models/ComponentPricePoint.php @@ -516,7 +516,8 @@ public function unsetIntervalUnit(): void * Returns Currency Prices. * 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. + * only in the response of read endpoints, after including the appropriate query parameter. The clone + * endpoint always returns currency prices if they are present. * * @return ComponentCurrencyPrice[]|null */ @@ -529,7 +530,8 @@ public function getCurrencyPrices(): ?array * Sets Currency Prices. * 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. + * only in the response of read endpoints, after including the appropriate query parameter. The clone + * endpoint always returns currency prices if they are present. * * @maps currency_prices * diff --git a/src/Models/ComponentPricePointCurrencyOverageResponse.php b/src/Models/ComponentPricePointCurrencyOverageResponse.php new file mode 100644 index 0000000..ad6417d --- /dev/null +++ b/src/Models/ComponentPricePointCurrencyOverageResponse.php @@ -0,0 +1,111 @@ +pricePoint = $pricePoint; + } + + /** + * Returns Price Point. + * Extends a component price point with currency overage prices. + */ + public function getPricePoint(): CurrencyOveragePrices + { + return $this->pricePoint; + } + + /** + * Sets Price Point. + * Extends a component price point with currency overage prices. + * + * @required + * @maps price_point + */ + public function setPricePoint(CurrencyOveragePrices $pricePoint): void + { + $this->pricePoint = $pricePoint; + } + + /** + * Converts the ComponentPricePointCurrencyOverageResponse object to a human-readable string + * representation. + * + * @return string The string representation of the ComponentPricePointCurrencyOverageResponse object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ComponentPricePointCurrencyOverageResponse', + ['pricePoint' => $this->pricePoint, 'additionalProperties' => $this->additionalProperties] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['price_point'] = $this->pricePoint; + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/Contract.php b/src/Models/Contract.php new file mode 100644 index 0000000..9ec248e --- /dev/null +++ b/src/Models/Contract.php @@ -0,0 +1,199 @@ +id; + } + + /** + * Sets Id. + * + * @maps id + */ + public function setId(?int $id): void + { + $this->id = $id; + } + + /** + * Returns Maxio Id. + */ + public function getMaxioId(): ?string + { + return $this->maxioId; + } + + /** + * Sets Maxio Id. + * + * @maps maxio_id + */ + public function setMaxioId(?string $maxioId): void + { + $this->maxioId = $maxioId; + } + + /** + * Returns Number. + */ + public function getNumber(): ?string + { + if (count($this->number) == 0) { + return null; + } + return $this->number['value']; + } + + /** + * Sets Number. + * + * @maps number + */ + public function setNumber(?string $number): void + { + $this->number['value'] = $number; + } + + /** + * Unsets Number. + */ + public function unsetNumber(): void + { + $this->number = []; + } + + /** + * Returns Register. + */ + public function getRegister(): ?Register + { + return $this->register; + } + + /** + * Sets Register. + * + * @maps register + */ + public function setRegister(?Register $register): void + { + $this->register = $register; + } + + /** + * Converts the Contract object to a human-readable string representation. + * + * @return string The string representation of the Contract object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'Contract', + [ + 'id' => $this->id, + 'maxioId' => $this->maxioId, + 'number' => $this->getNumber(), + 'register' => $this->register, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->id)) { + $json['id'] = $this->id; + } + if (isset($this->maxioId)) { + $json['maxio_id'] = $this->maxioId; + } + if (!empty($this->number)) { + $json['number'] = $this->number['value']; + } + if (isset($this->register)) { + $json['register'] = $this->register; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateAllocation.php b/src/Models/CreateAllocation.php index 2e53ada..5edda3d 100644 --- a/src/Models/CreateAllocation.php +++ b/src/Models/CreateAllocation.php @@ -20,6 +20,21 @@ class CreateAllocation implements \JsonSerializable */ private $quantity; + /** + * @var string|null + */ + private $decimalQuantity; + + /** + * @var float|null + */ + private $previousQuantity; + + /** + * @var string|null + */ + private $decimalPreviousQuantity; + /** * @var int|null */ @@ -40,11 +55,6 @@ class CreateAllocation implements \JsonSerializable */ private $prorationUpgradeScheme; - /** - * @var bool|null - */ - private $accrueCharge; - /** * @var array */ @@ -55,6 +65,11 @@ class CreateAllocation implements \JsonSerializable */ private $upgradeCharge = []; + /** + * @var bool|null + */ + private $accrueCharge; + /** * @var bool|null */ @@ -70,6 +85,11 @@ class CreateAllocation implements \JsonSerializable */ private $billingSchedule; + /** + * @var ComponentCustomPrice|null + */ + private $customPrice; + /** * @param float $quantity */ @@ -103,10 +123,78 @@ public function setQuantity(float $quantity): void $this->quantity = $quantity; } + /** + * Returns Decimal Quantity. + * Decimal representation of the allocated quantity. Only valid when decimal + * allocations are enabled for the component. + */ + public function getDecimalQuantity(): ?string + { + return $this->decimalQuantity; + } + + /** + * Sets Decimal Quantity. + * Decimal representation of the allocated quantity. Only valid when decimal + * allocations are enabled for the component. + * + * @maps decimal_quantity + */ + public function setDecimalQuantity(?string $decimalQuantity): void + { + $this->decimalQuantity = $decimalQuantity; + } + + /** + * Returns Previous Quantity. + * The quantity that was in effect before this allocation. Responses always + * include this value; it may be supplied on preview requests to ensure the + * expected change is evaluated. + */ + public function getPreviousQuantity(): ?float + { + return $this->previousQuantity; + } + + /** + * Sets Previous Quantity. + * The quantity that was in effect before this allocation. Responses always + * include this value; it may be supplied on preview requests to ensure the + * expected change is evaluated. + * + * @maps previous_quantity + */ + public function setPreviousQuantity(?float $previousQuantity): void + { + $this->previousQuantity = $previousQuantity; + } + + /** + * Returns Decimal Previous Quantity. + * Decimal representation of `previous_quantity`. Only valid when decimal + * allocations are enabled for the component. + */ + public function getDecimalPreviousQuantity(): ?string + { + return $this->decimalPreviousQuantity; + } + + /** + * Sets Decimal Previous Quantity. + * Decimal representation of `previous_quantity`. Only valid when decimal + * allocations are enabled for the component. + * + * @maps decimal_previous_quantity + */ + public function setDecimalPreviousQuantity(?string $decimalPreviousQuantity): void + { + $this->decimalPreviousQuantity = $decimalPreviousQuantity; + } + /** * Returns Component Id. * (required for the multiple allocations endpoint) The id associated with the component for which the - * allocation is being made + * allocation is being made. */ public function getComponentId(): ?int { @@ -116,7 +204,7 @@ public function getComponentId(): ?int /** * Sets Component Id. * (required for the multiple allocations endpoint) The id associated with the component for which the - * allocation is being made + * allocation is being made. * * @maps component_id */ @@ -127,7 +215,7 @@ public function setComponentId(?int $componentId): void /** * Returns Memo. - * A memo to record along with the allocation + * A memo to record along with the allocation. */ public function getMemo(): ?string { @@ -136,7 +224,7 @@ public function getMemo(): ?string /** * Sets Memo. - * A memo to record along with the allocation + * A memo to record along with the allocation. * * @maps memo */ @@ -185,33 +273,16 @@ public function setProrationUpgradeScheme(?string $prorationUpgradeScheme): void $this->prorationUpgradeScheme = $prorationUpgradeScheme; } - /** - * Returns Accrue Charge. - * If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal - * or if capture should be attempted immediately. Defaults to the site setting if one is not provided. - */ - public function getAccrueCharge(): ?bool - { - return $this->accrueCharge; - } - - /** - * Sets Accrue Charge. - * If the change in cost is an upgrade, this determines if the charge should accrue to the next renewal - * or if capture should be attempted immediately. Defaults to the site setting if one is not provided. - * - * @maps accrue_charge - */ - public function setAccrueCharge(?bool $accrueCharge): void - { - $this->accrueCharge = $accrueCharge; - } - /** * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site - * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * setting if one is not provided. Values are: + * + * `full` - A full price credit is added for the amount owed. + * + * `prorated` - A prorated credit is added for the amount owed. + * + * `none` - No charge is added. */ public function getDowngradeCredit(): ?string { @@ -224,11 +295,16 @@ public function getDowngradeCredit(): ?string /** * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site - * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * setting if one is not provided. Values are: + * + * `full` - A full price credit is added for the amount owed. + * + * `prorated` - A prorated credit is added for the amount owed. + * + * `none` - No charge is added. * * @maps downgrade_credit - * @factory \AdvancedBillingLib\Models\CreditType::checkValue + * @factory \AdvancedBillingLib\Models\DowngradeCreditCreditType::checkValue */ public function setDowngradeCredit(?string $downgradeCredit): void { @@ -238,8 +314,13 @@ public function setDowngradeCredit(?string $downgradeCredit): void /** * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site - * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * setting if one is not provided. Values are: + * + * `full` - A full price credit is added for the amount owed. + * + * `prorated` - A prorated credit is added for the amount owed. + * + * `none` - No charge is added. */ public function unsetDowngradeCredit(): void { @@ -249,8 +330,13 @@ public function unsetDowngradeCredit(): void /** * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site - * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * setting if one is not provided. Values are: + * + * `full` - A charge is added for the full price of the component. + * + * `prorated` - A charge is added for the prorated price of the component change. + * + * `none` - No charge is added. */ public function getUpgradeCharge(): ?string { @@ -263,11 +349,16 @@ public function getUpgradeCharge(): ?string /** * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site - * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * setting if one is not provided. Values are: + * + * `full` - A charge is added for the full price of the component. + * + * `prorated` - A charge is added for the prorated price of the component change. + * + * `none` - No charge is added. * * @maps upgrade_charge - * @factory \AdvancedBillingLib\Models\CreditType::checkValue + * @factory \AdvancedBillingLib\Models\UpgradeChargeCreditType::checkValue */ public function setUpgradeCharge(?string $upgradeCharge): void { @@ -277,14 +368,55 @@ public function setUpgradeCharge(?string $upgradeCharge): void /** * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site - * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. + * setting if one is not provided. Values are: + * + * `full` - A charge is added for the full price of the component. + * + * `prorated` - A charge is added for the prorated price of the component change. + * + * `none` - No charge is added. */ public function unsetUpgradeCharge(): void { $this->upgradeCharge = []; } + /** + * Returns Accrue Charge. + * "If the change in cost is an upgrade, this determines if the charge should accrue to the next + * renewal or if capture should be attempted immediately. + * + * `true` - Attempt to charge the customer at the next renewal. + * + * `false` - Attempt to charge the customer right away. If it fails, the charge will be accrued until + * the next renewal. + * + * Defaults to the site setting if unspecified in the request. + */ + public function getAccrueCharge(): ?bool + { + return $this->accrueCharge; + } + + /** + * Sets Accrue Charge. + * "If the change in cost is an upgrade, this determines if the charge should accrue to the next + * renewal or if capture should be attempted immediately. + * + * `true` - Attempt to charge the customer at the next renewal. + * + * `false` - Attempt to charge the customer right away. If it fails, the charge will be accrued until + * the next renewal. + * + * Defaults to the site setting if unspecified in the request. + * + * @maps accrue_charge + */ + public function setAccrueCharge(?bool $accrueCharge): void + { + $this->accrueCharge = $accrueCharge; + } + /** * Returns Initiate Dunning. * If set to true, if the immediate component payment fails, initiate dunning for the subscription. @@ -369,6 +501,26 @@ public function setBillingSchedule(?BillingSchedule $billingSchedule): void $this->billingSchedule = $billingSchedule; } + /** + * Returns Custom Price. + * Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. + */ + public function getCustomPrice(): ?ComponentCustomPrice + { + return $this->customPrice; + } + + /** + * Sets Custom Price. + * Create or update custom pricing unique to the subscription. Used in place of `price_point_id`. + * + * @maps custom_price + */ + public function setCustomPrice(?ComponentCustomPrice $customPrice): void + { + $this->customPrice = $customPrice; + } + /** * Converts the CreateAllocation object to a human-readable string representation. * @@ -380,16 +532,20 @@ public function __toString(): string 'CreateAllocation', [ 'quantity' => $this->quantity, + 'decimalQuantity' => $this->decimalQuantity, + 'previousQuantity' => $this->previousQuantity, + 'decimalPreviousQuantity' => $this->decimalPreviousQuantity, 'componentId' => $this->componentId, 'memo' => $this->memo, 'prorationDowngradeScheme' => $this->prorationDowngradeScheme, 'prorationUpgradeScheme' => $this->prorationUpgradeScheme, - 'accrueCharge' => $this->accrueCharge, 'downgradeCredit' => $this->getDowngradeCredit(), 'upgradeCharge' => $this->getUpgradeCharge(), + 'accrueCharge' => $this->accrueCharge, 'initiateDunning' => $this->initiateDunning, 'pricePointId' => $this->getPricePointId(), 'billingSchedule' => $this->billingSchedule, + 'customPrice' => $this->customPrice, 'additionalProperties' => $this->additionalProperties ] ); @@ -436,6 +592,15 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['quantity'] = $this->quantity; + if (isset($this->decimalQuantity)) { + $json['decimal_quantity'] = $this->decimalQuantity; + } + if (isset($this->previousQuantity)) { + $json['previous_quantity'] = $this->previousQuantity; + } + if (isset($this->decimalPreviousQuantity)) { + $json['decimal_previous_quantity'] = $this->decimalPreviousQuantity; + } if (isset($this->componentId)) { $json['component_id'] = $this->componentId; } @@ -448,14 +613,17 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->prorationUpgradeScheme)) { $json['proration_upgrade_scheme'] = $this->prorationUpgradeScheme; } - if (isset($this->accrueCharge)) { - $json['accrue_charge'] = $this->accrueCharge; - } if (!empty($this->downgradeCredit)) { - $json['downgrade_credit'] = CreditType::checkValue($this->downgradeCredit['value']); + $json['downgrade_credit'] = + DowngradeCreditCreditType::checkValue( + $this->downgradeCredit['value'] + ); } if (!empty($this->upgradeCharge)) { - $json['upgrade_charge'] = CreditType::checkValue($this->upgradeCharge['value']); + $json['upgrade_charge'] = UpgradeChargeCreditType::checkValue($this->upgradeCharge['value']); + } + if (isset($this->accrueCharge)) { + $json['accrue_charge'] = $this->accrueCharge; } if (isset($this->initiateDunning)) { $json['initiate_dunning'] = $this->initiateDunning; @@ -470,6 +638,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->billingSchedule)) { $json['billing_schedule'] = $this->billingSchedule; } + if (isset($this->customPrice)) { + $json['custom_price'] = $this->customPrice; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/CreateSubscription.php b/src/Models/CreateSubscription.php index 7705065..3db9dd7 100644 --- a/src/Models/CreateSubscription.php +++ b/src/Models/CreateSubscription.php @@ -353,7 +353,8 @@ public function setProductPricePointId(?int $productPricePointId): void /** * Returns Custom Price. * (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the - * subscription + * subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result + * in an API error. */ public function getCustomPrice(): ?SubscriptionCustomPrice { @@ -363,7 +364,8 @@ public function getCustomPrice(): ?SubscriptionCustomPrice /** * Sets Custom Price. * (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the - * subscription + * subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result + * in an API error. * * @maps custom_price */ diff --git a/src/Models/CreditType.php b/src/Models/CreditType.php index 7f48023..c71cc6a 100644 --- a/src/Models/CreditType.php +++ b/src/Models/CreditType.php @@ -17,7 +17,6 @@ /** * 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`. */ class CreditType { diff --git a/src/Models/CurrencyOveragePrices.php b/src/Models/CurrencyOveragePrices.php new file mode 100644 index 0000000..101cbf7 --- /dev/null +++ b/src/Models/CurrencyOveragePrices.php @@ -0,0 +1,895 @@ +id; + } + + /** + * Sets Id. + * + * @maps id + */ + public function setId(?int $id): void + { + $this->id = $id; + } + + /** + * Returns Type. + * 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. + */ + public function getType(): ?string + { + return $this->type; + } + + /** + * Sets Type. + * 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. + * + * @maps type + * @factory \AdvancedBillingLib\Models\PricePointType::checkValue + */ + public function setType(?string $type): void + { + $this->type = $type; + } + + /** + * Returns Default. + * Note: Refer to type attribute instead + */ + public function getDefault(): ?bool + { + return $this->default; + } + + /** + * Sets Default. + * Note: Refer to type attribute instead + * + * @maps default + */ + public function setDefault(?bool $default): void + { + $this->default = $default; + } + + /** + * Returns Name. + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets Name. + * + * @maps name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * Returns Pricing Scheme. + * The identifier for the pricing scheme. See [Product Components](https://help.chargify. + * com/products/product-components.html) for an overview of pricing schemes. + */ + public function getPricingScheme(): ?string + { + return $this->pricingScheme; + } + + /** + * Sets Pricing Scheme. + * The identifier for the pricing scheme. See [Product Components](https://help.chargify. + * com/products/product-components.html) for an overview of pricing schemes. + * + * @maps pricing_scheme + * @factory \AdvancedBillingLib\Models\PricingScheme::checkValue + */ + public function setPricingScheme(?string $pricingScheme): void + { + $this->pricingScheme = $pricingScheme; + } + + /** + * Returns Component Id. + */ + public function getComponentId(): ?int + { + return $this->componentId; + } + + /** + * Sets Component Id. + * + * @maps component_id + */ + public function setComponentId(?int $componentId): void + { + $this->componentId = $componentId; + } + + /** + * Returns Handle. + */ + public function getHandle(): ?string + { + if (count($this->handle) == 0) { + return null; + } + return $this->handle['value']; + } + + /** + * Sets Handle. + * + * @maps handle + */ + public function setHandle(?string $handle): void + { + $this->handle['value'] = $handle; + } + + /** + * Unsets Handle. + */ + public function unsetHandle(): void + { + $this->handle = []; + } + + /** + * Returns Archived At. + */ + public function getArchivedAt(): ?\DateTime + { + if (count($this->archivedAt) == 0) { + return null; + } + return $this->archivedAt['value']; + } + + /** + * Sets Archived At. + * + * @maps archived_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setArchivedAt(?\DateTime $archivedAt): void + { + $this->archivedAt['value'] = $archivedAt; + } + + /** + * Unsets Archived At. + */ + public function unsetArchivedAt(): void + { + $this->archivedAt = []; + } + + /** + * Returns Created At. + */ + public function getCreatedAt(): ?\DateTime + { + return $this->createdAt; + } + + /** + * Sets Created At. + * + * @maps created_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setCreatedAt(?\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * Returns Updated At. + */ + public function getUpdatedAt(): ?\DateTime + { + return $this->updatedAt; + } + + /** + * Sets Updated At. + * + * @maps updated_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setUpdatedAt(?\DateTime $updatedAt): void + { + $this->updatedAt = $updatedAt; + } + + /** + * Returns Prices. + * + * @return ComponentPrice[]|null + */ + public function getPrices(): ?array + { + return $this->prices; + } + + /** + * Sets Prices. + * + * @maps prices + * + * @param ComponentPrice[]|null $prices + */ + public function setPrices(?array $prices): void + { + $this->prices = $prices; + } + + /** + * Returns Use Site Exchange Rate. + * 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. + */ + public function getUseSiteExchangeRate(): ?bool + { + return $this->useSiteExchangeRate; + } + + /** + * Sets Use Site Exchange Rate. + * 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. + * + * @maps use_site_exchange_rate + */ + public function setUseSiteExchangeRate(?bool $useSiteExchangeRate): void + { + $this->useSiteExchangeRate = $useSiteExchangeRate; + } + + /** + * Returns Subscription Id. + * (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the + * subscription that the custom price point is for. + */ + public function getSubscriptionId(): ?int + { + return $this->subscriptionId; + } + + /** + * Sets Subscription Id. + * (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the + * subscription that the custom price point is for. + * + * @maps subscription_id + */ + public function setSubscriptionId(?int $subscriptionId): void + { + $this->subscriptionId = $subscriptionId; + } + + /** + * Returns Tax Included. + */ + public function getTaxIncluded(): ?bool + { + return $this->taxIncluded; + } + + /** + * Sets Tax Included. + * + * @maps tax_included + */ + public function setTaxIncluded(?bool $taxIncluded): void + { + $this->taxIncluded = $taxIncluded; + } + + /** + * Returns Interval. + * 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. + */ + public function getInterval(): ?int + { + if (count($this->interval) == 0) { + return null; + } + return $this->interval['value']; + } + + /** + * Sets Interval. + * 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. + * + * @maps interval + */ + public function setInterval(?int $interval): void + { + $this->interval['value'] = $interval; + } + + /** + * Unsets Interval. + * 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. + */ + public function unsetInterval(): void + { + $this->interval = []; + } + + /** + * Returns Interval Unit. + * 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. + */ + public function getIntervalUnit(): ?string + { + if (count($this->intervalUnit) == 0) { + return null; + } + return $this->intervalUnit['value']; + } + + /** + * Sets Interval Unit. + * 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. + * + * @maps interval_unit + * @factory \AdvancedBillingLib\Models\IntervalUnit::checkValue + */ + public function setIntervalUnit(?string $intervalUnit): void + { + $this->intervalUnit['value'] = $intervalUnit; + } + + /** + * Unsets Interval Unit. + * 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. + */ + public function unsetIntervalUnit(): void + { + $this->intervalUnit = []; + } + + /** + * Returns Currency Prices. + * An array of currency pricing data is available when multiple currencies are defined for the site. It + * varies based on the use_site_exchange_rate setting for the price point. This parameter is present + * only in the response of read endpoints, after including the appropriate query parameter. The clone + * endpoint always returns currency prices if they are present. + * + * @return ComponentCurrencyPrice[]|null + */ + public function getCurrencyPrices(): ?array + { + return $this->currencyPrices; + } + + /** + * Sets Currency Prices. + * An array of currency pricing data is available when multiple currencies are defined for the site. It + * varies based on the use_site_exchange_rate setting for the price point. This parameter is present + * only in the response of read endpoints, after including the appropriate query parameter. The clone + * endpoint always returns currency prices if they are present. + * + * @maps currency_prices + * + * @param ComponentCurrencyPrice[]|null $currencyPrices + */ + public function setCurrencyPrices(?array $currencyPrices): void + { + $this->currencyPrices = $currencyPrices; + } + + /** + * Returns Overage Prices. + * Applicable only to prepaid usage components. An array of overage price brackets. + * + * @return ComponentPrice[]|null + */ + public function getOveragePrices(): ?array + { + return $this->overagePrices; + } + + /** + * Sets Overage Prices. + * Applicable only to prepaid usage components. An array of overage price brackets. + * + * @maps overage_prices + * + * @param ComponentPrice[]|null $overagePrices + */ + public function setOveragePrices(?array $overagePrices): void + { + $this->overagePrices = $overagePrices; + } + + /** + * Returns Overage Pricing Scheme. + * Applicable only to prepaid usage components. Pricing scheme for overage pricing. + */ + public function getOveragePricingScheme(): ?string + { + return $this->overagePricingScheme; + } + + /** + * Sets Overage Pricing Scheme. + * Applicable only to prepaid usage components. Pricing scheme for overage pricing. + * + * @maps overage_pricing_scheme + * @factory \AdvancedBillingLib\Models\PricingScheme::checkValue + */ + public function setOveragePricingScheme(?string $overagePricingScheme): void + { + $this->overagePricingScheme = $overagePricingScheme; + } + + /** + * Returns Renew Prepaid Allocation. + * Applicable only to prepaid usage components. Boolean which controls whether or not the allocated + * quantity should be renewed at the beginning of each period. + */ + public function getRenewPrepaidAllocation(): ?bool + { + return $this->renewPrepaidAllocation; + } + + /** + * Sets Renew Prepaid Allocation. + * Applicable only to prepaid usage components. Boolean which controls whether or not the allocated + * quantity should be renewed at the beginning of each period. + * + * @maps renew_prepaid_allocation + */ + public function setRenewPrepaidAllocation(?bool $renewPrepaidAllocation): void + { + $this->renewPrepaidAllocation = $renewPrepaidAllocation; + } + + /** + * Returns Rollover Prepaid Remainder. + * Applicable only to prepaid usage components. Boolean which controls whether or not remaining units + * should be rolled over to the next period. + */ + public function getRolloverPrepaidRemainder(): ?bool + { + return $this->rolloverPrepaidRemainder; + } + + /** + * Sets Rollover Prepaid Remainder. + * Applicable only to prepaid usage components. Boolean which controls whether or not remaining units + * should be rolled over to the next period. + * + * @maps rollover_prepaid_remainder + */ + public function setRolloverPrepaidRemainder(?bool $rolloverPrepaidRemainder): void + { + $this->rolloverPrepaidRemainder = $rolloverPrepaidRemainder; + } + + /** + * Returns Expiration Interval. + * Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of + * `expiration_interval_unit`s after which rollover amounts should expire. + */ + public function getExpirationInterval(): ?int + { + if (count($this->expirationInterval) == 0) { + return null; + } + return $this->expirationInterval['value']; + } + + /** + * Sets Expiration Interval. + * Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of + * `expiration_interval_unit`s after which rollover amounts should expire. + * + * @maps expiration_interval + */ + public function setExpirationInterval(?int $expirationInterval): void + { + $this->expirationInterval['value'] = $expirationInterval; + } + + /** + * Unsets Expiration Interval. + * Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of + * `expiration_interval_unit`s after which rollover amounts should expire. + */ + public function unsetExpirationInterval(): void + { + $this->expirationInterval = []; + } + + /** + * Returns Expiration Interval Unit. + * Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string + * representing the expiration interval unit for this component, either month or day. + */ + public function getExpirationIntervalUnit(): ?string + { + if (count($this->expirationIntervalUnit) == 0) { + return null; + } + return $this->expirationIntervalUnit['value']; + } + + /** + * Sets Expiration Interval Unit. + * Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string + * representing the expiration interval unit for this component, either month or day. + * + * @maps expiration_interval_unit + * @factory \AdvancedBillingLib\Models\ExpirationIntervalUnit::checkValue + */ + public function setExpirationIntervalUnit(?string $expirationIntervalUnit): void + { + $this->expirationIntervalUnit['value'] = $expirationIntervalUnit; + } + + /** + * Unsets Expiration Interval Unit. + * Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string + * representing the expiration interval unit for this component, either month or day. + */ + public function unsetExpirationIntervalUnit(): void + { + $this->expirationIntervalUnit = []; + } + + /** + * Returns Currency Overage Prices. + * Applicable only to prepaid usage components. An array of currency pricing data for overage prices. + * + * @return ComponentCurrencyPrice[]|null + */ + public function getCurrencyOveragePrices(): ?array + { + return $this->currencyOveragePrices; + } + + /** + * Sets Currency Overage Prices. + * Applicable only to prepaid usage components. An array of currency pricing data for overage prices. + * + * @maps currency_overage_prices + * + * @param ComponentCurrencyPrice[]|null $currencyOveragePrices + */ + public function setCurrencyOveragePrices(?array $currencyOveragePrices): void + { + $this->currencyOveragePrices = $currencyOveragePrices; + } + + /** + * Converts the CurrencyOveragePrices object to a human-readable string representation. + * + * @return string The string representation of the CurrencyOveragePrices object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'CurrencyOveragePrices', + [ + 'id' => $this->id, + 'type' => $this->type, + 'default' => $this->default, + 'name' => $this->name, + 'pricingScheme' => $this->pricingScheme, + 'componentId' => $this->componentId, + 'handle' => $this->getHandle(), + 'archivedAt' => $this->getArchivedAt(), + 'createdAt' => $this->createdAt, + 'updatedAt' => $this->updatedAt, + 'prices' => $this->prices, + 'useSiteExchangeRate' => $this->useSiteExchangeRate, + 'subscriptionId' => $this->subscriptionId, + 'taxIncluded' => $this->taxIncluded, + 'interval' => $this->getInterval(), + 'intervalUnit' => $this->getIntervalUnit(), + 'currencyPrices' => $this->currencyPrices, + 'overagePrices' => $this->overagePrices, + 'overagePricingScheme' => $this->overagePricingScheme, + 'renewPrepaidAllocation' => $this->renewPrepaidAllocation, + 'rolloverPrepaidRemainder' => $this->rolloverPrepaidRemainder, + 'expirationInterval' => $this->getExpirationInterval(), + 'expirationIntervalUnit' => $this->getExpirationIntervalUnit(), + 'currencyOveragePrices' => $this->currencyOveragePrices, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->id)) { + $json['id'] = $this->id; + } + if (isset($this->type)) { + $json['type'] = PricePointType::checkValue($this->type); + } + if (isset($this->default)) { + $json['default'] = $this->default; + } + if (isset($this->name)) { + $json['name'] = $this->name; + } + if (isset($this->pricingScheme)) { + $json['pricing_scheme'] = PricingScheme::checkValue($this->pricingScheme); + } + if (isset($this->componentId)) { + $json['component_id'] = $this->componentId; + } + if (!empty($this->handle)) { + $json['handle'] = $this->handle['value']; + } + if (!empty($this->archivedAt)) { + $json['archived_at'] = DateTimeHelper::toRfc3339DateTime($this->archivedAt['value']); + } + if (isset($this->createdAt)) { + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + } + if (isset($this->updatedAt)) { + $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); + } + if (isset($this->prices)) { + $json['prices'] = $this->prices; + } + if (isset($this->useSiteExchangeRate)) { + $json['use_site_exchange_rate'] = $this->useSiteExchangeRate; + } + if (isset($this->subscriptionId)) { + $json['subscription_id'] = $this->subscriptionId; + } + if (isset($this->taxIncluded)) { + $json['tax_included'] = $this->taxIncluded; + } + if (!empty($this->interval)) { + $json['interval'] = $this->interval['value']; + } + if (!empty($this->intervalUnit)) { + $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); + } + if (isset($this->currencyPrices)) { + $json['currency_prices'] = $this->currencyPrices; + } + if (isset($this->overagePrices)) { + $json['overage_prices'] = $this->overagePrices; + } + if (isset($this->overagePricingScheme)) { + $json['overage_pricing_scheme'] = PricingScheme::checkValue($this->overagePricingScheme); + } + if (isset($this->renewPrepaidAllocation)) { + $json['renew_prepaid_allocation'] = $this->renewPrepaidAllocation; + } + if (isset($this->rolloverPrepaidRemainder)) { + $json['rollover_prepaid_remainder'] = $this->rolloverPrepaidRemainder; + } + if (!empty($this->expirationInterval)) { + $json['expiration_interval'] = $this->expirationInterval['value']; + } + if (!empty($this->expirationIntervalUnit)) { + $json['expiration_interval_unit'] = + ExpirationIntervalUnit::checkValue( + $this->expirationIntervalUnit['value'] + ); + } + if (isset($this->currencyOveragePrices)) { + $json['currency_overage_prices'] = $this->currencyOveragePrices; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/DeliverProformaInvoiceRequest.php b/src/Models/DeliverProformaInvoiceRequest.php new file mode 100644 index 0000000..4b1ae4f --- /dev/null +++ b/src/Models/DeliverProformaInvoiceRequest.php @@ -0,0 +1,170 @@ +recipientEmails; + } + + /** + * Sets Recipient Emails. + * + * @maps recipient_emails + * + * @param string[]|null $recipientEmails + */ + public function setRecipientEmails(?array $recipientEmails): void + { + $this->recipientEmails = $recipientEmails; + } + + /** + * Returns Cc Recipient Emails. + * + * @return string[]|null + */ + public function getCcRecipientEmails(): ?array + { + return $this->ccRecipientEmails; + } + + /** + * Sets Cc Recipient Emails. + * + * @maps cc_recipient_emails + * + * @param string[]|null $ccRecipientEmails + */ + public function setCcRecipientEmails(?array $ccRecipientEmails): void + { + $this->ccRecipientEmails = $ccRecipientEmails; + } + + /** + * Returns Bcc Recipient Emails. + * + * @return string[]|null + */ + public function getBccRecipientEmails(): ?array + { + return $this->bccRecipientEmails; + } + + /** + * Sets Bcc Recipient Emails. + * + * @maps bcc_recipient_emails + * + * @param string[]|null $bccRecipientEmails + */ + public function setBccRecipientEmails(?array $bccRecipientEmails): void + { + $this->bccRecipientEmails = $bccRecipientEmails; + } + + /** + * Converts the DeliverProformaInvoiceRequest object to a human-readable string representation. + * + * @return string The string representation of the DeliverProformaInvoiceRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'DeliverProformaInvoiceRequest', + [ + 'recipientEmails' => $this->recipientEmails, + 'ccRecipientEmails' => $this->ccRecipientEmails, + 'bccRecipientEmails' => $this->bccRecipientEmails, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->recipientEmails)) { + $json['recipient_emails'] = $this->recipientEmails; + } + if (isset($this->ccRecipientEmails)) { + $json['cc_recipient_emails'] = $this->ccRecipientEmails; + } + if (isset($this->bccRecipientEmails)) { + $json['bcc_recipient_emails'] = $this->bccRecipientEmails; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/DowngradeCreditCreditType.php b/src/Models/DowngradeCreditCreditType.php new file mode 100644 index 0000000..40bfe4a --- /dev/null +++ b/src/Models/DowngradeCreditCreditType.php @@ -0,0 +1,54 @@ +updatedAt = $updatedAt; } + /** + * Returns Archived At. + * Timestamp indicating when this product family was archived. `null` if the product family is not + * archived. + */ + public function getArchivedAt(): ?\DateTime + { + if (count($this->archivedAt) == 0) { + return null; + } + return $this->archivedAt['value']; + } + + /** + * Sets Archived At. + * Timestamp indicating when this product family was archived. `null` if the product family is not + * archived. + * + * @maps archived_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setArchivedAt(?\DateTime $archivedAt): void + { + $this->archivedAt['value'] = $archivedAt; + } + + /** + * Unsets Archived At. + * Timestamp indicating when this product family was archived. `null` if the product family is not + * archived. + */ + public function unsetArchivedAt(): void + { + $this->archivedAt = []; + } + /** * Converts the ProductFamily object to a human-readable string representation. * @@ -218,6 +259,7 @@ public function __toString(): string 'description' => $this->getDescription(), 'createdAt' => $this->createdAt, 'updatedAt' => $this->updatedAt, + 'archivedAt' => $this->getArchivedAt(), 'additionalProperties' => $this->additionalProperties ] ); @@ -284,6 +326,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->updatedAt)) { $json['updated_at'] = DateTimeHelper::toRfc3339DateTime($this->updatedAt); } + if (!empty($this->archivedAt)) { + $json['archived_at'] = DateTimeHelper::toRfc3339DateTime($this->archivedAt['value']); + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/ProformaInvoice.php b/src/Models/ProformaInvoice.php index 2a3edd4..908cf0d 100644 --- a/src/Models/ProformaInvoice.php +++ b/src/Models/ProformaInvoice.php @@ -196,6 +196,11 @@ class ProformaInvoice implements \JsonSerializable */ private $publicUrl = []; + /** + * @var AvailableActions|null + */ + private $availableActions; + /** * Returns Uid. */ @@ -965,6 +970,24 @@ public function unsetPublicUrl(): void $this->publicUrl = []; } + /** + * Returns Available Actions. + */ + public function getAvailableActions(): ?AvailableActions + { + return $this->availableActions; + } + + /** + * Sets Available Actions. + * + * @maps available_actions + */ + public function setAvailableActions(?AvailableActions $availableActions): void + { + $this->availableActions = $availableActions; + } + /** * Converts the ProformaInvoice object to a human-readable string representation. * @@ -1011,6 +1034,7 @@ public function __toString(): string 'payments' => $this->payments, 'customFields' => $this->customFields, 'publicUrl' => $this->getPublicUrl(), + 'availableActions' => $this->availableActions, 'additionalProperties' => $this->additionalProperties ] ); @@ -1164,6 +1188,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->publicUrl)) { $json['public_url'] = $this->publicUrl['value']; } + if (isset($this->availableActions)) { + $json['available_actions'] = $this->availableActions; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/QuantityBasedComponent.php b/src/Models/QuantityBasedComponent.php index 00e2ec0..1b3d323 100644 --- a/src/Models/QuantityBasedComponent.php +++ b/src/Models/QuantityBasedComponent.php @@ -290,7 +290,6 @@ public function setPrices(?array $prices): void * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -304,7 +303,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -318,7 +316,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { @@ -329,7 +326,6 @@ public function unsetUpgradeCharge(): void * Returns Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getDowngradeCredit(): ?string { @@ -343,7 +339,6 @@ public function getDowngradeCredit(): ?string * Sets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps downgrade_credit * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -357,7 +352,6 @@ public function setDowngradeCredit(?string $downgradeCredit): void * Unsets Downgrade Credit. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetDowngradeCredit(): void { diff --git a/src/Models/ReactivateSubscriptionRequest.php b/src/Models/ReactivateSubscriptionRequest.php index 79b61d3..d4daab8 100644 --- a/src/Models/ReactivateSubscriptionRequest.php +++ b/src/Models/ReactivateSubscriptionRequest.php @@ -131,8 +131,8 @@ public function setCouponCode(?string $couponCode): void /** * Returns Use Credits and Prepayments. - * If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is - * sent, the service credits and prepayments will be ignored. + * If true is sent, Advanced Billing will use service credits and prepayments upon reactivation. If + * false is sent, the service credits and prepayments will be ignored. */ public function getUseCreditsAndPrepayments(): ?bool { @@ -141,8 +141,8 @@ public function getUseCreditsAndPrepayments(): ?bool /** * Sets Use Credits and Prepayments. - * If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is - * sent, the service credits and prepayments will be ignored. + * If true is sent, Advanced Billing will use service credits and prepayments upon reactivation. If + * false is sent, the service credits and prepayments will be ignored. * * @maps use_credits_and_prepayments */ @@ -153,9 +153,10 @@ public function setUseCreditsAndPrepayments(?bool $useCreditsAndPrepayments): vo /** * Returns Resume. - * If `true`, Chargify will attempt to resume the subscription's billing period. if not resumable, the - * subscription will be reactivated with a new billing period. If `false`: Chargify will only attempt - * to reactivate the subscription. + * If `true`, Advanced Billing will attempt to resume the subscription's billing period. If not + * resumable, the subscription will be reactivated with a new billing period. If `false` or omitted, + * Advanced Billing will only attempt to reactivate the subscription with a new billing period, + * regardless of whether or not the subscription is resumable. * * @return bool|ResumeOptions|null */ @@ -166,9 +167,10 @@ public function getResume() /** * Sets Resume. - * If `true`, Chargify will attempt to resume the subscription's billing period. if not resumable, the - * subscription will be reactivated with a new billing period. If `false`: Chargify will only attempt - * to reactivate the subscription. + * If `true`, Advanced Billing will attempt to resume the subscription's billing period. If not + * resumable, the subscription will be reactivated with a new billing period. If `false` or omitted, + * Advanced Billing will only attempt to reactivate the subscription with a new billing period, + * regardless of whether or not the subscription is resumable. * * @maps resume * @mapsBy anyOf(oneOf(bool,ResumeOptions),null) diff --git a/src/Models/Register.php b/src/Models/Register.php new file mode 100644 index 0000000..f1f97f2 --- /dev/null +++ b/src/Models/Register.php @@ -0,0 +1,187 @@ +id; + } + + /** + * Sets Id. + * + * @maps id + */ + public function setId(?int $id): void + { + $this->id = $id; + } + + /** + * Returns Maxio Id. + */ + public function getMaxioId(): ?string + { + return $this->maxioId; + } + + /** + * Sets Maxio Id. + * + * @maps maxio_id + */ + public function setMaxioId(?string $maxioId): void + { + $this->maxioId = $maxioId; + } + + /** + * Returns Name. + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets Name. + * + * @maps name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * Returns Currency Code. + * The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. + */ + public function getCurrencyCode(): ?string + { + return $this->currencyCode; + } + + /** + * Sets Currency Code. + * The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. + * + * @maps currency_code + */ + public function setCurrencyCode(?string $currencyCode): void + { + $this->currencyCode = $currencyCode; + } + + /** + * Converts the Register object to a human-readable string representation. + * + * @return string The string representation of the Register object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'Register', + [ + 'id' => $this->id, + 'maxioId' => $this->maxioId, + 'name' => $this->name, + 'currencyCode' => $this->currencyCode, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->id)) { + $json['id'] = $this->id; + } + if (isset($this->maxioId)) { + $json['maxio_id'] = $this->maxioId; + } + if (isset($this->name)) { + $json['name'] = $this->name; + } + if (isset($this->currencyCode)) { + $json['currency_code'] = $this->currencyCode; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalComponentCustomPrice.php b/src/Models/ScheduledRenewalComponentCustomPrice.php new file mode 100644 index 0000000..163d490 --- /dev/null +++ b/src/Models/ScheduledRenewalComponentCustomPrice.php @@ -0,0 +1,180 @@ +pricingScheme = $pricingScheme; + $this->prices = $prices; + } + + /** + * Returns Tax Included. + * Whether or not the price point includes tax + */ + public function getTaxIncluded(): ?bool + { + return $this->taxIncluded; + } + + /** + * Sets Tax Included. + * Whether or not the price point includes tax + * + * @maps tax_included + */ + public function setTaxIncluded(?bool $taxIncluded): void + { + $this->taxIncluded = $taxIncluded; + } + + /** + * Returns Pricing Scheme. + * Omit for On/Off components + */ + public function getPricingScheme(): string + { + return $this->pricingScheme; + } + + /** + * Sets Pricing Scheme. + * Omit for On/Off components + * + * @required + * @maps pricing_scheme + * @factory \AdvancedBillingLib\Models\PricingScheme::checkValue + */ + public function setPricingScheme(string $pricingScheme): void + { + $this->pricingScheme = $pricingScheme; + } + + /** + * Returns Prices. + * On/off components only need one price bracket starting at 1. + * + * @return Price[] + */ + public function getPrices(): array + { + return $this->prices; + } + + /** + * Sets Prices. + * On/off components only need one price bracket starting at 1. + * + * @required + * @maps prices + * + * @param Price[] $prices + */ + public function setPrices(array $prices): void + { + $this->prices = $prices; + } + + /** + * Converts the ScheduledRenewalComponentCustomPrice object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalComponentCustomPrice object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalComponentCustomPrice', + [ + 'taxIncluded' => $this->taxIncluded, + 'pricingScheme' => $this->pricingScheme, + 'prices' => $this->prices, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->taxIncluded)) { + $json['tax_included'] = $this->taxIncluded; + } + $json['pricing_scheme'] = PricingScheme::checkValue($this->pricingScheme); + $json['prices'] = $this->prices; + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfiguration.php b/src/Models/ScheduledRenewalConfiguration.php new file mode 100644 index 0000000..2d3b479 --- /dev/null +++ b/src/Models/ScheduledRenewalConfiguration.php @@ -0,0 +1,364 @@ +id; + } + + /** + * Sets Id. + * ID of the renewal. + * + * @maps id + */ + public function setId(?int $id): void + { + $this->id = $id; + } + + /** + * Returns Site Id. + * ID of the site to which the renewal belongs. + */ + public function getSiteId(): ?int + { + return $this->siteId; + } + + /** + * Sets Site Id. + * ID of the site to which the renewal belongs. + * + * @maps site_id + */ + public function setSiteId(?int $siteId): void + { + $this->siteId = $siteId; + } + + /** + * Returns Subscription Id. + * The id of the subscription. + */ + public function getSubscriptionId(): ?int + { + return $this->subscriptionId; + } + + /** + * Sets Subscription Id. + * The id of the subscription. + * + * @maps subscription_id + */ + public function setSubscriptionId(?int $subscriptionId): void + { + $this->subscriptionId = $subscriptionId; + } + + /** + * Returns Starts At. + */ + public function getStartsAt(): ?\DateTime + { + return $this->startsAt; + } + + /** + * Sets Starts At. + * + * @maps starts_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setStartsAt(?\DateTime $startsAt): void + { + $this->startsAt = $startsAt; + } + + /** + * Returns Ends At. + */ + public function getEndsAt(): ?\DateTime + { + return $this->endsAt; + } + + /** + * Sets Ends At. + * + * @maps ends_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setEndsAt(?\DateTime $endsAt): void + { + $this->endsAt = $endsAt; + } + + /** + * Returns Lock in At. + */ + public function getLockInAt(): ?\DateTime + { + return $this->lockInAt; + } + + /** + * Sets Lock in At. + * + * @maps lock_in_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setLockInAt(?\DateTime $lockInAt): void + { + $this->lockInAt = $lockInAt; + } + + /** + * Returns Created At. + */ + public function getCreatedAt(): ?\DateTime + { + return $this->createdAt; + } + + /** + * Sets Created At. + * + * @maps created_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setCreatedAt(?\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * Returns Status. + */ + public function getStatus(): ?string + { + return $this->status; + } + + /** + * Sets Status. + * + * @maps status + */ + public function setStatus(?string $status): void + { + $this->status = $status; + } + + /** + * Returns Scheduled Renewal Configuration Items. + * + * @return ScheduledRenewalConfigurationItem[]|null + */ + public function getScheduledRenewalConfigurationItems(): ?array + { + return $this->scheduledRenewalConfigurationItems; + } + + /** + * Sets Scheduled Renewal Configuration Items. + * + * @maps scheduled_renewal_configuration_items + * + * @param ScheduledRenewalConfigurationItem[]|null $scheduledRenewalConfigurationItems + */ + public function setScheduledRenewalConfigurationItems(?array $scheduledRenewalConfigurationItems): void + { + $this->scheduledRenewalConfigurationItems = $scheduledRenewalConfigurationItems; + } + + /** + * Returns Contract. + * Contract linked to the scheduled renewal configuration. + */ + public function getContract(): ?Contract + { + return $this->contract; + } + + /** + * Sets Contract. + * Contract linked to the scheduled renewal configuration. + * + * @maps contract + */ + public function setContract(?Contract $contract): void + { + $this->contract = $contract; + } + + /** + * Converts the ScheduledRenewalConfiguration object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalConfiguration object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfiguration', + [ + 'id' => $this->id, + 'siteId' => $this->siteId, + 'subscriptionId' => $this->subscriptionId, + 'startsAt' => $this->startsAt, + 'endsAt' => $this->endsAt, + 'lockInAt' => $this->lockInAt, + 'createdAt' => $this->createdAt, + 'status' => $this->status, + 'scheduledRenewalConfigurationItems' => $this->scheduledRenewalConfigurationItems, + 'contract' => $this->contract, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->id)) { + $json['id'] = $this->id; + } + if (isset($this->siteId)) { + $json['site_id'] = $this->siteId; + } + if (isset($this->subscriptionId)) { + $json['subscription_id'] = $this->subscriptionId; + } + if (isset($this->startsAt)) { + $json['starts_at'] = DateTimeHelper::toRfc3339DateTime($this->startsAt); + } + if (isset($this->endsAt)) { + $json['ends_at'] = DateTimeHelper::toRfc3339DateTime($this->endsAt); + } + if (isset($this->lockInAt)) { + $json['lock_in_at'] = DateTimeHelper::toRfc3339DateTime($this->lockInAt); + } + if (isset($this->createdAt)) { + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + } + if (isset($this->status)) { + $json['status'] = $this->status; + } + if (isset($this->scheduledRenewalConfigurationItems)) { + $json['scheduled_renewal_configuration_items'] = $this->scheduledRenewalConfigurationItems; + } + if (isset($this->contract)) { + $json['contract'] = $this->contract; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationItem.php b/src/Models/ScheduledRenewalConfigurationItem.php new file mode 100644 index 0000000..9b791df --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationItem.php @@ -0,0 +1,376 @@ +id; + } + + /** + * Sets Id. + * + * @maps id + */ + public function setId(?int $id): void + { + $this->id = $id; + } + + /** + * Returns Subscription Id. + */ + public function getSubscriptionId(): ?int + { + return $this->subscriptionId; + } + + /** + * Sets Subscription Id. + * + * @maps subscription_id + */ + public function setSubscriptionId(?int $subscriptionId): void + { + $this->subscriptionId = $subscriptionId; + } + + /** + * Returns Subscription Renewal Configuration Id. + */ + public function getSubscriptionRenewalConfigurationId(): ?int + { + return $this->subscriptionRenewalConfigurationId; + } + + /** + * Sets Subscription Renewal Configuration Id. + * + * @maps subscription_renewal_configuration_id + */ + public function setSubscriptionRenewalConfigurationId(?int $subscriptionRenewalConfigurationId): void + { + $this->subscriptionRenewalConfigurationId = $subscriptionRenewalConfigurationId; + } + + /** + * Returns Item Id. + */ + public function getItemId(): ?int + { + return $this->itemId; + } + + /** + * Sets Item Id. + * + * @maps item_id + */ + public function setItemId(?int $itemId): void + { + $this->itemId = $itemId; + } + + /** + * Returns Item Type. + */ + public function getItemType(): ?string + { + return $this->itemType; + } + + /** + * Sets Item Type. + * + * @maps item_type + */ + public function setItemType(?string $itemType): void + { + $this->itemType = $itemType; + } + + /** + * Returns Item Subclass. + */ + public function getItemSubclass(): ?string + { + return $this->itemSubclass; + } + + /** + * Sets Item Subclass. + * + * @maps item_subclass + */ + public function setItemSubclass(?string $itemSubclass): void + { + $this->itemSubclass = $itemSubclass; + } + + /** + * Returns Price Point Id. + */ + public function getPricePointId(): ?int + { + return $this->pricePointId; + } + + /** + * Sets Price Point Id. + * + * @maps price_point_id + */ + public function setPricePointId(?int $pricePointId): void + { + $this->pricePointId = $pricePointId; + } + + /** + * Returns Price Point Type. + */ + public function getPricePointType(): ?string + { + return $this->pricePointType; + } + + /** + * Sets Price Point Type. + * + * @maps price_point_type + */ + public function setPricePointType(?string $pricePointType): void + { + $this->pricePointType = $pricePointType; + } + + /** + * Returns Quantity. + */ + public function getQuantity(): ?int + { + return $this->quantity; + } + + /** + * Sets Quantity. + * + * @maps quantity + */ + public function setQuantity(?int $quantity): void + { + $this->quantity = $quantity; + } + + /** + * Returns Decimal Quantity. + */ + public function getDecimalQuantity(): ?string + { + return $this->decimalQuantity; + } + + /** + * Sets Decimal Quantity. + * + * @maps decimal_quantity + */ + public function setDecimalQuantity(?string $decimalQuantity): void + { + $this->decimalQuantity = $decimalQuantity; + } + + /** + * Returns Created At. + */ + public function getCreatedAt(): ?\DateTime + { + return $this->createdAt; + } + + /** + * Sets Created At. + * + * @maps created_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setCreatedAt(?\DateTime $createdAt): void + { + $this->createdAt = $createdAt; + } + + /** + * Converts the ScheduledRenewalConfigurationItem object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationItem object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationItem', + [ + 'id' => $this->id, + 'subscriptionId' => $this->subscriptionId, + 'subscriptionRenewalConfigurationId' => $this->subscriptionRenewalConfigurationId, + 'itemId' => $this->itemId, + 'itemType' => $this->itemType, + 'itemSubclass' => $this->itemSubclass, + 'pricePointId' => $this->pricePointId, + 'pricePointType' => $this->pricePointType, + 'quantity' => $this->quantity, + 'decimalQuantity' => $this->decimalQuantity, + 'createdAt' => $this->createdAt, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->id)) { + $json['id'] = $this->id; + } + if (isset($this->subscriptionId)) { + $json['subscription_id'] = $this->subscriptionId; + } + if (isset($this->subscriptionRenewalConfigurationId)) { + $json['subscription_renewal_configuration_id'] = $this->subscriptionRenewalConfigurationId; + } + if (isset($this->itemId)) { + $json['item_id'] = $this->itemId; + } + if (isset($this->itemType)) { + $json['item_type'] = $this->itemType; + } + if (isset($this->itemSubclass)) { + $json['item_subclass'] = $this->itemSubclass; + } + if (isset($this->pricePointId)) { + $json['price_point_id'] = $this->pricePointId; + } + if (isset($this->pricePointType)) { + $json['price_point_type'] = $this->pricePointType; + } + if (isset($this->quantity)) { + $json['quantity'] = $this->quantity; + } + if (isset($this->decimalQuantity)) { + $json['decimal_quantity'] = $this->decimalQuantity; + } + if (isset($this->createdAt)) { + $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationItemRequest.php b/src/Models/ScheduledRenewalConfigurationItemRequest.php new file mode 100644 index 0000000..0ee98af --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationItemRequest.php @@ -0,0 +1,122 @@ +renewalConfigurationItem = $renewalConfigurationItem; + } + + /** + * Returns Renewal Configuration Item. + * + * @return ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct + */ + public function getRenewalConfigurationItem() + { + return $this->renewalConfigurationItem; + } + + /** + * Sets Renewal Configuration Item. + * + * @required + * @maps renewal_configuration_item + * @mapsBy oneOf(ScheduledRenewalItemRequestBodyComponent,ScheduledRenewalItemRequestBodyProduct) + * + * @param ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct $renewalConfigurationItem + */ + public function setRenewalConfigurationItem($renewalConfigurationItem): void + { + $this->renewalConfigurationItem = $renewalConfigurationItem; + } + + /** + * Converts the ScheduledRenewalConfigurationItemRequest object to a human-readable string + * representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationItemRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationItemRequest', + [ + 'renewalConfigurationItem' => $this->renewalConfigurationItem, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['renewal_configuration_item'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->renewalConfigurationItem, + 'oneOf(ScheduledRenewalItemRequestBodyComponent,ScheduledRenewalItemRequestBodyProduc' . + 't)' + ); + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationItemResponse.php b/src/Models/ScheduledRenewalConfigurationItemResponse.php new file mode 100644 index 0000000..72b9136 --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationItemResponse.php @@ -0,0 +1,106 @@ +scheduledRenewalConfigurationItem; + } + + /** + * Sets Scheduled Renewal Configuration Item. + * + * @maps scheduled_renewal_configuration_item + */ + public function setScheduledRenewalConfigurationItem( + ?ScheduledRenewalConfigurationItem $scheduledRenewalConfigurationItem + ): void { + $this->scheduledRenewalConfigurationItem = $scheduledRenewalConfigurationItem; + } + + /** + * Converts the ScheduledRenewalConfigurationItemResponse object to a human-readable string + * representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationItemResponse object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationItemResponse', + [ + 'scheduledRenewalConfigurationItem' => $this->scheduledRenewalConfigurationItem, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->scheduledRenewalConfigurationItem)) { + $json['scheduled_renewal_configuration_item'] = $this->scheduledRenewalConfigurationItem; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationRequest.php b/src/Models/ScheduledRenewalConfigurationRequest.php new file mode 100644 index 0000000..50d81e4 --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationRequest.php @@ -0,0 +1,111 @@ +renewalConfiguration = $renewalConfiguration; + } + + /** + * Returns Renewal Configuration. + */ + public function getRenewalConfiguration(): ScheduledRenewalConfigurationRequestBody + { + return $this->renewalConfiguration; + } + + /** + * Sets Renewal Configuration. + * + * @required + * @maps renewal_configuration + */ + public function setRenewalConfiguration(ScheduledRenewalConfigurationRequestBody $renewalConfiguration): void + { + $this->renewalConfiguration = $renewalConfiguration; + } + + /** + * Converts the ScheduledRenewalConfigurationRequest object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationRequest', + [ + 'renewalConfiguration' => $this->renewalConfiguration, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['renewal_configuration'] = $this->renewalConfiguration; + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationRequestBody.php b/src/Models/ScheduledRenewalConfigurationRequestBody.php new file mode 100644 index 0000000..c6668ed --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationRequestBody.php @@ -0,0 +1,231 @@ +startsAt; + } + + /** + * Sets Starts At. + * (Optional) Start of the renewal term. + * + * @maps starts_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setStartsAt(?\DateTime $startsAt): void + { + $this->startsAt = $startsAt; + } + + /** + * Returns Ends At. + * (Optional) End of the renewal term. + */ + public function getEndsAt(): ?\DateTime + { + return $this->endsAt; + } + + /** + * Sets Ends At. + * (Optional) End of the renewal term. + * + * @maps ends_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setEndsAt(?\DateTime $endsAt): void + { + $this->endsAt = $endsAt; + } + + /** + * Returns Lock in At. + * (Optional) Lock-in date for the renewal. + */ + public function getLockInAt(): ?\DateTime + { + return $this->lockInAt; + } + + /** + * Sets Lock in At. + * (Optional) Lock-in date for the renewal. + * + * @maps lock_in_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setLockInAt(?\DateTime $lockInAt): void + { + $this->lockInAt = $lockInAt; + } + + /** + * Returns Contract Id. + * (Optional) Existing contract to associate with the scheduled renewal. Contracts must be enabled for + * your site. + */ + public function getContractId(): ?int + { + return $this->contractId; + } + + /** + * Sets Contract Id. + * (Optional) Existing contract to associate with the scheduled renewal. Contracts must be enabled for + * your site. + * + * @maps contract_id + */ + public function setContractId(?int $contractId): void + { + $this->contractId = $contractId; + } + + /** + * Returns Create New Contract. + * (Optional) Set to true to create a new contract when contracts are enabled. Contracts must be + * enabled for your site. + */ + public function getCreateNewContract(): ?bool + { + return $this->createNewContract; + } + + /** + * Sets Create New Contract. + * (Optional) Set to true to create a new contract when contracts are enabled. Contracts must be + * enabled for your site. + * + * @maps create_new_contract + */ + public function setCreateNewContract(?bool $createNewContract): void + { + $this->createNewContract = $createNewContract; + } + + /** + * Converts the ScheduledRenewalConfigurationRequestBody object to a human-readable string + * representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationRequestBody object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationRequestBody', + [ + 'startsAt' => $this->startsAt, + 'endsAt' => $this->endsAt, + 'lockInAt' => $this->lockInAt, + 'contractId' => $this->contractId, + 'createNewContract' => $this->createNewContract, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->startsAt)) { + $json['starts_at'] = DateTimeHelper::toRfc3339DateTime($this->startsAt); + } + if (isset($this->endsAt)) { + $json['ends_at'] = DateTimeHelper::toRfc3339DateTime($this->endsAt); + } + if (isset($this->lockInAt)) { + $json['lock_in_at'] = DateTimeHelper::toRfc3339DateTime($this->lockInAt); + } + if (isset($this->contractId)) { + $json['contract_id'] = $this->contractId; + } + if (isset($this->createNewContract)) { + $json['create_new_contract'] = $this->createNewContract; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationResponse.php b/src/Models/ScheduledRenewalConfigurationResponse.php new file mode 100644 index 0000000..a23ecf1 --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationResponse.php @@ -0,0 +1,105 @@ +scheduledRenewalConfiguration; + } + + /** + * Sets Scheduled Renewal Configuration. + * + * @maps scheduled_renewal_configuration + */ + public function setScheduledRenewalConfiguration( + ?ScheduledRenewalConfiguration $scheduledRenewalConfiguration + ): void { + $this->scheduledRenewalConfiguration = $scheduledRenewalConfiguration; + } + + /** + * Converts the ScheduledRenewalConfigurationResponse object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationResponse object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationResponse', + [ + 'scheduledRenewalConfiguration' => $this->scheduledRenewalConfiguration, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->scheduledRenewalConfiguration)) { + $json['scheduled_renewal_configuration'] = $this->scheduledRenewalConfiguration; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalConfigurationsResponse.php b/src/Models/ScheduledRenewalConfigurationsResponse.php new file mode 100644 index 0000000..40c2e38 --- /dev/null +++ b/src/Models/ScheduledRenewalConfigurationsResponse.php @@ -0,0 +1,108 @@ +scheduledRenewalConfigurations; + } + + /** + * Sets Scheduled Renewal Configurations. + * + * @maps scheduled_renewal_configurations + * + * @param ScheduledRenewalConfiguration[]|null $scheduledRenewalConfigurations + */ + public function setScheduledRenewalConfigurations(?array $scheduledRenewalConfigurations): void + { + $this->scheduledRenewalConfigurations = $scheduledRenewalConfigurations; + } + + /** + * Converts the ScheduledRenewalConfigurationsResponse object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalConfigurationsResponse object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalConfigurationsResponse', + [ + 'scheduledRenewalConfigurations' => $this->scheduledRenewalConfigurations, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->scheduledRenewalConfigurations)) { + $json['scheduled_renewal_configurations'] = $this->scheduledRenewalConfigurations; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalItemRequestBodyComponent.php b/src/Models/ScheduledRenewalItemRequestBodyComponent.php new file mode 100644 index 0000000..9128eef --- /dev/null +++ b/src/Models/ScheduledRenewalItemRequestBodyComponent.php @@ -0,0 +1,228 @@ +itemId = $itemId; + } + + /** + * Returns Item Type. + * Item type to add. Either Product or Component. + */ + public function getItemType(): string + { + return $this->itemType; + } + + /** + * Sets Item Type. + * Item type to add. Either Product or Component. + * + * @maps item_type + */ + public function setItemType(string $itemType): void + { + $this->itemType = $itemType; + } + + /** + * Returns Item Id. + * Product or component identifier. + */ + public function getItemId(): int + { + return $this->itemId; + } + + /** + * Sets Item Id. + * Product or component identifier. + * + * @required + * @maps item_id + */ + public function setItemId(int $itemId): void + { + $this->itemId = $itemId; + } + + /** + * Returns Price Point Id. + * Price point identifier. + */ + public function getPricePointId(): ?int + { + return $this->pricePointId; + } + + /** + * Sets Price Point Id. + * Price point identifier. + * + * @maps price_point_id + */ + public function setPricePointId(?int $pricePointId): void + { + $this->pricePointId = $pricePointId; + } + + /** + * Returns Quantity. + * Optional quantity for the item. + */ + public function getQuantity(): ?int + { + return $this->quantity; + } + + /** + * Sets Quantity. + * Optional quantity for the item. + * + * @maps quantity + */ + public function setQuantity(?int $quantity): void + { + $this->quantity = $quantity; + } + + /** + * Returns Custom Price. + * Custom pricing for a component within a scheduled renewal. + */ + public function getCustomPrice(): ?ScheduledRenewalComponentCustomPrice + { + return $this->customPrice; + } + + /** + * Sets Custom Price. + * Custom pricing for a component within a scheduled renewal. + * + * @maps custom_price + */ + public function setCustomPrice(?ScheduledRenewalComponentCustomPrice $customPrice): void + { + $this->customPrice = $customPrice; + } + + /** + * Converts the ScheduledRenewalItemRequestBodyComponent object to a human-readable string + * representation. + * + * @return string The string representation of the ScheduledRenewalItemRequestBodyComponent object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalItemRequestBodyComponent', + [ + 'itemType' => $this->itemType, + 'itemId' => $this->itemId, + 'pricePointId' => $this->pricePointId, + 'quantity' => $this->quantity, + 'customPrice' => $this->customPrice, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['item_type'] = $this->itemType; + $json['item_id'] = $this->itemId; + if (isset($this->pricePointId)) { + $json['price_point_id'] = $this->pricePointId; + } + if (isset($this->quantity)) { + $json['quantity'] = $this->quantity; + } + if (isset($this->customPrice)) { + $json['custom_price'] = $this->customPrice; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalItemRequestBodyProduct.php b/src/Models/ScheduledRenewalItemRequestBodyProduct.php new file mode 100644 index 0000000..2abee1a --- /dev/null +++ b/src/Models/ScheduledRenewalItemRequestBodyProduct.php @@ -0,0 +1,227 @@ +itemId = $itemId; + } + + /** + * Returns Item Type. + * Item type to add. Either Product or Component. + */ + public function getItemType(): string + { + return $this->itemType; + } + + /** + * Sets Item Type. + * Item type to add. Either Product or Component. + * + * @maps item_type + */ + public function setItemType(string $itemType): void + { + $this->itemType = $itemType; + } + + /** + * Returns Item Id. + * Product or component identifier. + */ + public function getItemId(): int + { + return $this->itemId; + } + + /** + * Sets Item Id. + * Product or component identifier. + * + * @required + * @maps item_id + */ + public function setItemId(int $itemId): void + { + $this->itemId = $itemId; + } + + /** + * Returns Price Point Id. + * Price point identifier. + */ + public function getPricePointId(): ?int + { + return $this->pricePointId; + } + + /** + * Sets Price Point Id. + * Price point identifier. + * + * @maps price_point_id + */ + public function setPricePointId(?int $pricePointId): void + { + $this->pricePointId = $pricePointId; + } + + /** + * Returns Quantity. + * Optional quantity for the item. + */ + public function getQuantity(): ?int + { + return $this->quantity; + } + + /** + * Sets Quantity. + * Optional quantity for the item. + * + * @maps quantity + */ + public function setQuantity(?int $quantity): void + { + $this->quantity = $quantity; + } + + /** + * Returns Custom Price. + * Custom pricing for a product within a scheduled renewal. + */ + public function getCustomPrice(): ?ScheduledRenewalProductPricePoint + { + return $this->customPrice; + } + + /** + * Sets Custom Price. + * Custom pricing for a product within a scheduled renewal. + * + * @maps custom_price + */ + public function setCustomPrice(?ScheduledRenewalProductPricePoint $customPrice): void + { + $this->customPrice = $customPrice; + } + + /** + * Converts the ScheduledRenewalItemRequestBodyProduct object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalItemRequestBodyProduct object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalItemRequestBodyProduct', + [ + 'itemType' => $this->itemType, + 'itemId' => $this->itemId, + 'pricePointId' => $this->pricePointId, + 'quantity' => $this->quantity, + 'customPrice' => $this->customPrice, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['item_type'] = $this->itemType; + $json['item_id'] = $this->itemId; + if (isset($this->pricePointId)) { + $json['price_point_id'] = $this->pricePointId; + } + if (isset($this->quantity)) { + $json['quantity'] = $this->quantity; + } + if (isset($this->customPrice)) { + $json['custom_price'] = $this->customPrice; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalLockInRequest.php b/src/Models/ScheduledRenewalLockInRequest.php new file mode 100644 index 0000000..28c1138 --- /dev/null +++ b/src/Models/ScheduledRenewalLockInRequest.php @@ -0,0 +1,112 @@ +lockInAt = $lockInAt; + } + + /** + * Returns Lock in At. + * Date to lock in the renewal. + */ + public function getLockInAt(): \DateTime + { + return $this->lockInAt; + } + + /** + * Sets Lock in At. + * Date to lock in the renewal. + * + * @required + * @maps lock_in_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromSimpleDate + */ + public function setLockInAt(\DateTime $lockInAt): void + { + $this->lockInAt = $lockInAt; + } + + /** + * Converts the ScheduledRenewalLockInRequest object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalLockInRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalLockInRequest', + ['lockInAt' => $this->lockInAt, 'additionalProperties' => $this->additionalProperties] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['lock_in_at'] = DateTimeHelper::toSimpleDate($this->lockInAt); + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalProductPricePoint.php b/src/Models/ScheduledRenewalProductPricePoint.php new file mode 100644 index 0000000..810e728 --- /dev/null +++ b/src/Models/ScheduledRenewalProductPricePoint.php @@ -0,0 +1,387 @@ +priceInCents = $priceInCents; + $this->interval = $interval; + } + + /** + * Returns Name. + * (Optional) + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * Sets Name. + * (Optional) + * + * @maps name + */ + public function setName(?string $name): void + { + $this->name = $name; + } + + /** + * Returns Handle. + * (Optional) + */ + public function getHandle(): ?string + { + return $this->handle; + } + + /** + * Sets Handle. + * (Optional) + * + * @maps handle + */ + public function setHandle(?string $handle): void + { + $this->handle = $handle; + } + + /** + * Returns Price in Cents. + * Required if using `custom_price` attribute. + * + * @return string|int + */ + public function getPriceInCents() + { + return $this->priceInCents; + } + + /** + * Sets Price in Cents. + * Required if using `custom_price` attribute. + * + * @required + * @maps price_in_cents + * @mapsBy oneOf(string,int) + * + * @param string|int $priceInCents + */ + public function setPriceInCents($priceInCents): void + { + $this->priceInCents = $priceInCents; + } + + /** + * Returns Interval. + * Required if using `custom_price` attribute. + * + * @return string|int + */ + public function getInterval() + { + return $this->interval; + } + + /** + * Sets Interval. + * Required if using `custom_price` attribute. + * + * @required + * @maps interval + * @mapsBy oneOf(string,int) + * + * @param string|int $interval + */ + public function setInterval($interval): void + { + $this->interval = $interval; + } + + /** + * Returns Interval Unit. + * Required if using `custom_price` attribute. + */ + public function getIntervalUnit(): ?string + { + return $this->intervalUnit; + } + + /** + * Sets Interval Unit. + * Required if using `custom_price` attribute. + * + * @maps interval_unit + * @factory \AdvancedBillingLib\Models\IntervalUnit::checkValue + */ + public function setIntervalUnit(?string $intervalUnit): void + { + $this->intervalUnit = $intervalUnit; + } + + /** + * Returns Tax Included. + * (Optional) + */ + public function getTaxIncluded(): ?bool + { + return $this->taxIncluded; + } + + /** + * Sets Tax Included. + * (Optional) + * + * @maps tax_included + */ + public function setTaxIncluded(?bool $taxIncluded): void + { + $this->taxIncluded = $taxIncluded; + } + + /** + * Returns Initial Charge in Cents. + * The product price point initial charge, in integer cents. + */ + public function getInitialChargeInCents(): ?int + { + return $this->initialChargeInCents; + } + + /** + * Sets Initial Charge in Cents. + * The product price point initial charge, in integer cents. + * + * @maps initial_charge_in_cents + */ + public function setInitialChargeInCents(?int $initialChargeInCents): void + { + $this->initialChargeInCents = $initialChargeInCents; + } + + /** + * Returns Expiration Interval. + * 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. + */ + public function getExpirationInterval(): ?int + { + return $this->expirationInterval; + } + + /** + * Sets Expiration Interval. + * 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. + * + * @maps expiration_interval + */ + public function setExpirationInterval(?int $expirationInterval): void + { + $this->expirationInterval = $expirationInterval; + } + + /** + * Returns Expiration Interval Unit. + * A string representing the expiration interval unit for this product price point, either month, day + * or never + */ + public function getExpirationIntervalUnit(): ?string + { + if (count($this->expirationIntervalUnit) == 0) { + return null; + } + return $this->expirationIntervalUnit['value']; + } + + /** + * Sets Expiration Interval Unit. + * A string representing the expiration interval unit for this product price point, either month, day + * or never + * + * @maps expiration_interval_unit + * @factory \AdvancedBillingLib\Models\ExpirationIntervalUnit::checkValue + */ + public function setExpirationIntervalUnit(?string $expirationIntervalUnit): void + { + $this->expirationIntervalUnit['value'] = $expirationIntervalUnit; + } + + /** + * Unsets Expiration Interval Unit. + * A string representing the expiration interval unit for this product price point, either month, day + * or never + */ + public function unsetExpirationIntervalUnit(): void + { + $this->expirationIntervalUnit = []; + } + + /** + * Converts the ScheduledRenewalProductPricePoint object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalProductPricePoint object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalProductPricePoint', + [ + 'name' => $this->name, + 'handle' => $this->handle, + 'priceInCents' => $this->priceInCents, + 'interval' => $this->interval, + 'intervalUnit' => $this->intervalUnit, + 'taxIncluded' => $this->taxIncluded, + 'initialChargeInCents' => $this->initialChargeInCents, + 'expirationInterval' => $this->expirationInterval, + 'expirationIntervalUnit' => $this->getExpirationIntervalUnit(), + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->name)) { + $json['name'] = $this->name; + } + if (isset($this->handle)) { + $json['handle'] = $this->handle; + } + $json['price_in_cents'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->priceInCents, + 'oneOf(string,int)' + ); + $json['interval'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->interval, + 'oneOf(string,int)' + ); + $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit); + if (isset($this->taxIncluded)) { + $json['tax_included'] = $this->taxIncluded; + } + if (isset($this->initialChargeInCents)) { + $json['initial_charge_in_cents'] = $this->initialChargeInCents; + } + if (isset($this->expirationInterval)) { + $json['expiration_interval'] = $this->expirationInterval; + } + if (!empty($this->expirationIntervalUnit)) { + $json['expiration_interval_unit'] = + ExpirationIntervalUnit::checkValue( + $this->expirationIntervalUnit['value'] + ); + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/ScheduledRenewalUpdateRequest.php b/src/Models/ScheduledRenewalUpdateRequest.php new file mode 100644 index 0000000..e506681 --- /dev/null +++ b/src/Models/ScheduledRenewalUpdateRequest.php @@ -0,0 +1,121 @@ +renewalConfigurationItem = $renewalConfigurationItem; + } + + /** + * Returns Renewal Configuration Item. + * + * @return ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct + */ + public function getRenewalConfigurationItem() + { + return $this->renewalConfigurationItem; + } + + /** + * Sets Renewal Configuration Item. + * + * @required + * @maps renewal_configuration_item + * @mapsBy oneOf(ScheduledRenewalItemRequestBodyComponent,ScheduledRenewalItemRequestBodyProduct) + * + * @param ScheduledRenewalItemRequestBodyComponent|ScheduledRenewalItemRequestBodyProduct $renewalConfigurationItem + */ + public function setRenewalConfigurationItem($renewalConfigurationItem): void + { + $this->renewalConfigurationItem = $renewalConfigurationItem; + } + + /** + * Converts the ScheduledRenewalUpdateRequest object to a human-readable string representation. + * + * @return string The string representation of the ScheduledRenewalUpdateRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'ScheduledRenewalUpdateRequest', + [ + 'renewalConfigurationItem' => $this->renewalConfigurationItem, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['renewal_configuration_item'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->renewalConfigurationItem, + 'oneOf(ScheduledRenewalItemRequestBodyComponent,ScheduledRenewalItemRequestBodyProduc' . + 't)' + ); + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/SendEmail.php b/src/Models/SendEmail.php new file mode 100644 index 0000000..67af256 --- /dev/null +++ b/src/Models/SendEmail.php @@ -0,0 +1,139 @@ +canExecute = $canExecute; + $this->url = $url; + } + + /** + * Returns Can Execute. + */ + public function getCanExecute(): bool + { + return $this->canExecute; + } + + /** + * Sets Can Execute. + * + * @required + * @maps can_execute + */ + public function setCanExecute(bool $canExecute): void + { + $this->canExecute = $canExecute; + } + + /** + * Returns Url. + */ + public function getUrl(): string + { + return $this->url; + } + + /** + * Sets Url. + * + * @required + * @maps url + */ + public function setUrl(string $url): void + { + $this->url = $url; + } + + /** + * Converts the SendEmail object to a human-readable string representation. + * + * @return string The string representation of the SendEmail object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'SendEmail', + [ + 'canExecute' => $this->canExecute, + 'url' => $this->url, + 'additionalProperties' => $this->additionalProperties + ] + ); + } + + private $additionalProperties = []; + + /** + * Add an additional property to this model. + * + * @param string $name Name of property. + * @param mixed $value Value of property. + */ + public function addAdditionalProperty(string $name, $value) + { + $this->additionalProperties[$name] = $value; + } + + /** + * Find an additional property by name in this model or false if property does not exist. + * + * @param string $name Name of property. + * + * @return mixed|false Value of the property. + */ + public function findAdditionalProperty(string $name) + { + if (isset($this->additionalProperties[$name])) { + return $this->additionalProperties[$name]; + } + return false; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + $json['can_execute'] = $this->canExecute; + $json['url'] = $this->url; + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/SendInvoiceRequest.php b/src/Models/SendInvoiceRequest.php index 63ce714..a735d0f 100644 --- a/src/Models/SendInvoiceRequest.php +++ b/src/Models/SendInvoiceRequest.php @@ -30,6 +30,11 @@ class SendInvoiceRequest implements \JsonSerializable */ private $bccRecipientEmails; + /** + * @var string[]|null + */ + private $attachmentUrls; + /** * Returns Recipient Emails. * @@ -96,6 +101,30 @@ public function setBccRecipientEmails(?array $bccRecipientEmails): void $this->bccRecipientEmails = $bccRecipientEmails; } + /** + * Returns Attachment Urls. + * Array of URLs to files to attach to the invoice email. Max 10 files, 10MB each. + * + * @return string[]|null + */ + public function getAttachmentUrls(): ?array + { + return $this->attachmentUrls; + } + + /** + * Sets Attachment Urls. + * Array of URLs to files to attach to the invoice email. Max 10 files, 10MB each. + * + * @maps attachment_urls + * + * @param string[]|null $attachmentUrls + */ + public function setAttachmentUrls(?array $attachmentUrls): void + { + $this->attachmentUrls = $attachmentUrls; + } + /** * Converts the SendInvoiceRequest object to a human-readable string representation. * @@ -109,6 +138,7 @@ public function __toString(): string 'recipientEmails' => $this->recipientEmails, 'ccRecipientEmails' => $this->ccRecipientEmails, 'bccRecipientEmails' => $this->bccRecipientEmails, + 'attachmentUrls' => $this->attachmentUrls, 'additionalProperties' => $this->additionalProperties ] ); @@ -163,6 +193,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->bccRecipientEmails)) { $json['bcc_recipient_emails'] = $this->bccRecipientEmails; } + if (isset($this->attachmentUrls)) { + $json['attachment_urls'] = $this->attachmentUrls; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/Status.php b/src/Models/Status.php new file mode 100644 index 0000000..e3fcbfc --- /dev/null +++ b/src/Models/Status.php @@ -0,0 +1,51 @@ +uid; + } + + /** + * Sets Uid. + * + * @maps uid + */ + public function setUid(?string $uid): void + { + $this->uid = $uid; + } + /** * Returns Customer Id. */ @@ -153,6 +176,7 @@ public function __toString(): string return ApiHelper::stringify( 'SubscriptionGroup', [ + 'uid' => $this->uid, 'customerId' => $this->customerId, 'paymentProfile' => $this->paymentProfile, 'paymentCollectionMethod' => $this->paymentCollectionMethod, @@ -203,6 +227,9 @@ public function findAdditionalProperty(string $name) public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; + if (isset($this->uid)) { + $json['uid'] = $this->uid; + } if (isset($this->customerId)) { $json['customer_id'] = $this->customerId; } diff --git a/src/Models/SubscriptionGroupSignupItem.php b/src/Models/SubscriptionGroupSignupItem.php index b66bf14..738a9a1 100644 --- a/src/Models/SubscriptionGroupSignupItem.php +++ b/src/Models/SubscriptionGroupSignupItem.php @@ -299,7 +299,8 @@ public function setComponents(?array $components): void /** * Returns Custom Price. * (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the - * subscription + * subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result + * in an API error. */ public function getCustomPrice(): ?SubscriptionCustomPrice { @@ -309,7 +310,8 @@ public function getCustomPrice(): ?SubscriptionCustomPrice /** * Sets Custom Price. * (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the - * subscription + * subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result + * in an API error. * * @maps custom_price */ diff --git a/src/Models/SubscriptionSort.php b/src/Models/SubscriptionSort.php index 7895bbc..c55ee7d 100644 --- a/src/Models/SubscriptionSort.php +++ b/src/Models/SubscriptionSort.php @@ -28,13 +28,25 @@ class SubscriptionSort public const CREATED_AT = 'created_at'; + public const TOTAL_PAYMENTS = 'total_payments'; + + public const ID = 'id'; + + public const OPEN_BALANCE = 'open_balance'; + + public const EXPIRES_AT = 'expires_at'; + private const _ALL_VALUES = [ self::SIGNUP_DATE, self::PERIOD_START, self::PERIOD_END, self::NEXT_ASSESSMENT, self::UPDATED_AT, - self::CREATED_AT + self::CREATED_AT, + self::TOTAL_PAYMENTS, + self::ID, + self::OPEN_BALANCE, + self::EXPIRES_AT ]; /** diff --git a/src/Models/UpdateComponent.php b/src/Models/UpdateComponent.php index 3251629..931cdee 100644 --- a/src/Models/UpdateComponent.php +++ b/src/Models/UpdateComponent.php @@ -269,7 +269,6 @@ public function setDisplayOnHostedPage(?bool $displayOnHostedPage): void * Returns Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function getUpgradeCharge(): ?string { @@ -283,7 +282,6 @@ public function getUpgradeCharge(): ?string * Sets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. * * @maps upgrade_charge * @factory \AdvancedBillingLib\Models\CreditType::checkValue @@ -297,7 +295,6 @@ public function setUpgradeCharge(?string $upgradeCharge): void * Unsets Upgrade Charge. * The type of credit to be created when upgrading/downgrading. Defaults to the component and then site * setting if one is not provided. - * Available values: `full`, `prorated`, `none`. */ public function unsetUpgradeCharge(): void { diff --git a/src/Models/UpdateSubscription.php b/src/Models/UpdateSubscription.php index 3144b96..ba32179 100644 --- a/src/Models/UpdateSubscription.php +++ b/src/Models/UpdateSubscription.php @@ -489,7 +489,8 @@ public function setReference(?string $reference): void /** * Returns Custom Price. * (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the - * subscription + * subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result + * in an API error. */ public function getCustomPrice(): ?SubscriptionCustomPrice { @@ -499,7 +500,8 @@ public function getCustomPrice(): ?SubscriptionCustomPrice /** * Sets Custom Price. * (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the - * subscription + * subscription. A subscription can have up to 30 custom price points. Exceeding this limit will result + * in an API error. * * @maps custom_price */ diff --git a/src/Models/UpgradeChargeCreditType.php b/src/Models/UpgradeChargeCreditType.php new file mode 100644 index 0000000..23a040f --- /dev/null +++ b/src/Models/UpgradeChargeCreditType.php @@ -0,0 +1,54 @@ +