diff --git a/README.md b/README.md index d9d24861..5c905ddd 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:9.1.0" +composer require "maxio/advanced-billing-sdk:10.0.0" ``` Or add it to the composer.json file manually as given below: ```json "require": { - "maxio/advanced-billing-sdk": "9.1.0" + "maxio/advanced-billing-sdk": "10.0.0" } ``` You can also view the package at: -https://packagist.org/packages/maxio/advanced-billing-sdk#9.1.0 +https://packagist.org/packages/maxio/advanced-billing-sdk#10.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/9.1.0/doc/client.md) +**_Note:_** Documentation for the client can be found [here.](https://www.github.com/maxio-com/ab-php-sdk/tree/10.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`](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/README.md#environments) | The API environment.
**Default: `Environment.US`** | +| environment | [`Environment`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.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/9.1.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.1.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | +| proxyConfiguration | [`ProxyConfigurationBuilder`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.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/10.0.0/doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication | The API client can be initialized as follows: @@ -99,56 +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/9.1.0/doc/auth/basic-authentication.md) +* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/auth/basic-authentication.md) ## List of APIs -* [API Exports](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/api-exports.md) -* [Advance Invoice](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/advance-invoice.md) -* [Billing Portal](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/billing-portal.md) -* [Component Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/component-price-points.md) -* [Custom Fields](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/custom-fields.md) -* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/events-based-billing-segments.md) -* [Payment Profiles](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/payment-profiles.md) -* [Product Families](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/product-families.md) -* [Product Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/product-price-points.md) -* [Proforma Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/proforma-invoices.md) -* [Reason Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/reason-codes.md) -* [Referral Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/referral-codes.md) -* [Sales Commissions](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/sales-commissions.md) -* [Subscription Components](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-components.md) -* [Subscription Groups](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-groups.md) -* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-group-invoice-account.md) -* [Subscription Group Status](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-group-status.md) -* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-invoice-account.md) -* [Subscription Notes](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-notes.md) -* [Subscription Products](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-products.md) -* [Subscription Renewals](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-renewals.md) -* [Subscription Status](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscription-status.md) -* [Coupons](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/coupons.md) -* [Components](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/components.md) -* [Customers](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/customers.md) -* [Events](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/events.md) -* [Insights](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/insights.md) -* [Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/invoices.md) -* [Offers](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/offers.md) -* [Products](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/products.md) -* [Sites](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/sites.md) -* [Subscriptions](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/subscriptions.md) -* [Webhooks](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/controllers/webhooks.md) +* [API Exports](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/api-exports.md) +* [Advance Invoice](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/advance-invoice.md) +* [Billing Portal](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/billing-portal.md) +* [Component Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/component-price-points.md) +* [Custom Fields](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/custom-fields.md) +* [Events-Based Billing Segments](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/events-based-billing-segments.md) +* [Payment Profiles](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/payment-profiles.md) +* [Product Families](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/product-families.md) +* [Product Price Points](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/product-price-points.md) +* [Proforma Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/proforma-invoices.md) +* [Reason Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/reason-codes.md) +* [Referral Codes](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/referral-codes.md) +* [Sales Commissions](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/sales-commissions.md) +* [Subscription Components](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-components.md) +* [Subscription Groups](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-groups.md) +* [Subscription Group Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-group-invoice-account.md) +* [Subscription Group Status](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-group-status.md) +* [Subscription Invoice Account](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-invoice-account.md) +* [Subscription Notes](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-notes.md) +* [Subscription Products](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-products.md) +* [Subscription Renewals](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-renewals.md) +* [Subscription Status](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscription-status.md) +* [Coupons](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/coupons.md) +* [Components](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/components.md) +* [Customers](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/customers.md) +* [Events](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/events.md) +* [Insights](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/insights.md) +* [Invoices](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/invoices.md) +* [Offers](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/offers.md) +* [Products](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/products.md) +* [Sites](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/sites.md) +* [Subscriptions](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/subscriptions.md) +* [Webhooks](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/controllers/webhooks.md) ## SDK Infrastructure ### Configuration -* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/proxy-configuration-builder.md) +* [ProxyConfigurationBuilder](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/proxy-configuration-builder.md) ### HTTP -* [HttpRequest](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/http-request.md) -* [HttpResponse](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/http-response.md) +* [HttpRequest](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/http-request.md) +* [HttpResponse](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/http-response.md) ### Utilities -* [ApiException](https://www.github.com/maxio-com/ab-php-sdk/tree/9.1.0/doc/api-exception.md) +* [ApiException](https://www.github.com/maxio-com/ab-php-sdk/tree/10.0.0/doc/api-exception.md) diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md index 4450e625..7ce407c2 100644 --- a/doc/controllers/advance-invoice.md +++ b/doc/controllers/advance-invoice.md @@ -17,10 +17,13 @@ $advanceInvoiceController = $client->getAdvanceInvoiceController(); # Issue Advance Invoice -Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility for generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided. -A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error. -That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated. -We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it. +Issues an invoice in advance for a subscription's next renewal date. For the most part, advance invoices function like any other invoice, except they are issued early and have special behavior upon being voided. For more information on advance invoices, including eligibility for generating one, see [Issue Invoice In Advance](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance). + +A subscription can only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists returns an error. + +Regeneration of the invoice can be forced with the params `force: true`, which voids an advance invoice if one exists and generates a new one. If no advance invoice exists, a new one is generated. + +Consider using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it. ```php function issueAdvanceInvoice(int $subscriptionId, ?IssueAdvanceInvoiceRequest $body = null): Invoice @@ -125,8 +128,11 @@ try { # Void Advance Invoice -Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. -A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs](../../doc/models/invoice.md). +Voids a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. + +A `reason` is required to void, and the invoice must have an open status. Voiding causes 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 [Invoice](../../doc/models/invoice.md). ```php function voidAdvanceInvoice(int $subscriptionId, ?VoidInvoiceRequest $body = null): Invoice diff --git a/doc/controllers/api-exports.md b/doc/controllers/api-exports.md index 6e226e8e..0fa8318a 100644 --- a/doc/controllers/api-exports.md +++ b/doc/controllers/api-exports.md @@ -188,9 +188,7 @@ try { # Export Proforma Invoices -Creates a proforma invoices export and returns a batch job object. - -It is only available for Relationship Invoicing architecture. +Creates a proforma invoices export and returns a batch job object. Proforma invoices are only available on Relationship Invoicing sites. ```php function exportProformaInvoices(): BatchJobResponse @@ -315,7 +313,7 @@ try { # Read Proforma Invoices Export -Returns a batch job object for a proforma invoices export. +Returns a batch job object for a proforma invoices export. Proforma invoices are only available on Relationship Invoicing sites. ```php function readProformaInvoicesExport(string $batchId): BatchJobResponse diff --git a/doc/controllers/billing-portal.md b/doc/controllers/billing-portal.md index c93a1dad..3becfc4f 100644 --- a/doc/controllers/billing-portal.md +++ b/doc/controllers/billing-portal.md @@ -20,21 +20,15 @@ $billingPortalController = $client->getBillingPortalController(); Enables Billing Portal access for a customer, with an option to send an invitation email at the same time. -## Billing Portal Documentation - -Full documentation on how the Billing Portal operates within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24252412965133-Billing-Portal-Overview). - -This documentation is focused on how to configure the Billing Portal Settings, as well as Subscriber Interaction and Merchant Management of the Billing Portal. - -You can use this endpoint to enable Billing Portal access for a Customer, with the option of sending the Customer an Invitation email at the same time. - ## Billing Portal Security -If your customer has been invited to the Billing Portal, then they will receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.** +If your customer has been invited to the Billing Portal, they receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.** + +If you need to provide your customer their Management URL through other means, you can retrieve it [via the API](../../doc/controllers/billing-portal.md#read-billing-portal-link). Because the URL is cryptographically signed with a timestamp, merchants cannot generate the URL without requesting it through the API. -If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing. +To prevent abuse and overuse, request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request every time. -In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time. +For more information configuring the Billing Portal, see [Billing Portal Overview](https://maxio.zendesk.com/hc/en-us/articles/24252412965133-Billing-Portal-Overview). ```php function enableBillingPortalForCustomer(int $customerId, ?int $autoInvite = null): CustomerResponse @@ -86,13 +80,13 @@ try { Returns the exact URL required for a subscriber to access the Billing Portal. -## Rules for Management Link API +## Management Link Request Rules -+ When retrieving a management URL, multiple requests for the same customer in a short period will return the **same** URL -+ We will not generate a new URL for 15 days ++ When retrieving a management URL, multiple requests for the same customer in a short period return the **same** URL ++ A new URL is not generated for 15 days + You must cache and remember this URL if you are going to need it again within 15 days + Only request a new URL after the `new_link_available_at` date -+ You are limited to 15 requests for the same URL. If you make more than 15 requests before `new_link_available_at`, you will be blocked from further Management URL requests (with a response code `429`) ++ You are limited to 15 requests for the same URL. If you make more than 15 requests before `new_link_available_at`, you are blocked from further Management URL requests (with a response code `429`). ```php function readBillingPortalLink(int $customerId): PortalManagementLink diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md index b43339c5..5daba993 100644 --- a/doc/controllers/component-price-points.md +++ b/doc/controllers/component-price-points.md @@ -198,8 +198,6 @@ Lists the price points associated with a component. You may specify the component by using either the numeric id or the `handle:gold` syntax. -When fetching a component's price points, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. - If the price point is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. ```php @@ -215,7 +213,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `componentId` | `int` | Template, Required | The Advanced Billing id of the component | -| `currencyPrices` | `?bool` | Query, Optional | Include an array of currency price data | +| `currencyPrices` | `?bool` | Query, Optional | Include an array of currency price data. | | `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` | | `filterType` | [`?(string(PricePointType)[])`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. | @@ -713,7 +711,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `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. | -| `currencyPrices` | `?bool` | Query, Optional | Include an array of currency price data | +| `currencyPrices` | `?bool` | Query, Optional | Include an array of currency price data. | ## Response Type diff --git a/doc/controllers/components.md b/doc/controllers/components.md index c5c3af59..610f4944 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -32,8 +32,14 @@ Metered components are used to bill for any type of unit that resets to 0 at the Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead. +#### Hybrid Pricing + +A `volume`, `tiered`, or `stairstep` metered component can combine its primary pricing with a secondary pricing model (the `overage_pricing` parameter) so both bill as a single invoice line item instead of two. This does not apply to metered components configured for event-based billing (metric, meter, or formula). See [Hybrid Pricing](page:introduction/basic-concepts/hybrid-pricing) for requirements and configuration details. + For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending `"tax_code": ""` returns `422`. + ```php function createMeteredComponent( string $productFamilyId, @@ -158,7 +164,7 @@ try { Creates a Quantity Based component definition under the specified product family. A Quantity Based component can then be added and “allocated” for a subscription. -When defining a Quantity Based component, you can choose one of 2 types: +When defining a Quantity Based component, you can choose one of two types: #### Recurring @@ -170,8 +176,16 @@ One-time quantity-based components are used to create ad hoc usage charges that The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made. +For more information, see [Components Overview](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + +#### Hybrid Pricing + +A `volume`, `tiered`, or `stairstep` component can combine its primary pricing with a secondary pricing model (the `overage_pricing` parameter) so both bill as a single invoice line item instead of two. See [Hybrid Pricing](page:introduction/basic-concepts/hybrid-pricing) for requirements and configuration details. + For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending `"tax_code": ""` returns `422`. + ```php function createQuantityBasedComponent( string $productFamilyId, @@ -304,6 +318,8 @@ On/off components are used for any flat fee, recurring add on (think $99/month f For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending `"tax_code": ""` returns `422`. + ```php function createOnOffComponent(string $productFamilyId, ?CreateOnOffComponent $body = null): ComponentResponse ``` @@ -412,9 +428,11 @@ try { Creates a prepaid usage component definition under the specified product family. A prepaid component can then be added and “allocated” for a subscription. -Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased. +Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and usage is subsequently tracked against the amount purchased. -For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information, see [Components Overview](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`; sending a blank value results in a validation error. ```php function createPrepaidUsageComponent( @@ -574,7 +592,9 @@ Event-based components are similar to other component types, in that you define So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. -For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). +For more information, see [Components Overview](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview). + +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`; sending a blank value results in a validation error. ```php function createEventBasedComponent(string $productFamilyId, ?CreateEBBComponent $body = null): ComponentResponse @@ -842,6 +862,8 @@ Updates a component from a specific product family. You may read the component by either the component's id or handle. When using the handle, it must be prefixed with `handle:`. +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending `"tax_code": ""` returns `422`. + ```php function updateProductFamilyComponent( int $productFamilyId, @@ -1036,8 +1058,8 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `startDate` | `?string` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. | | `endDate` | `?string` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. | | `startDatetime` | `?string` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. | -| `endDatetime` | `?string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. optional | -| `includeArchived` | `?bool` | Query, Optional | Include archived items | +| `endDatetime` | `?string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. | +| `includeArchived` | `?bool` | Query, Optional | Include archived items. | | `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` | [`?ListComponentsFilter`](../../doc/models/list-components-filter.md) | Query, Optional | Filter to use for List Components operations | @@ -1183,6 +1205,8 @@ Updates a component. You may read the component by either the component's id or handle. When using the handle, it must be prefixed with `handle:`. +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending `"tax_code": ""` returns `422`. + ```php function updateComponent(string $componentId, ?UpdateComponentRequest $body = null): ComponentResponse ``` @@ -1291,7 +1315,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `filter` | [`?ListComponentsFilter`](../../doc/models/list-components-filter.md) | Query, Optional | Filter to use for List Components operations | | `dateField` | [`?string(BasicDateField)`](../../doc/models/basic-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. Use in query `date_field=created_at`. | | `endDate` | `?string` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. | -| `endDatetime` | `?string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. optional. | +| `endDatetime` | `?string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. | | `startDate` | `?string` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. | | `startDatetime` | `?string` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. | diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md index f708983c..1f061961 100644 --- a/doc/controllers/coupons.md +++ b/doc/controllers/coupons.md @@ -30,11 +30,7 @@ $couponsController = $client->getCouponsController(); Creates a coupon under the specified product family. -You can create either a flat amount coupon by specifying amount_in_cents, or a percentage coupon by specifying percentage -You can restrict a coupon to only apply to specific products / components by optionally passing in `restricted_products` and/or `restricted_components` objects in the format: -`{ "": boolean_value }` - -Coupons can be administered in the Advanced Billing application or created via API. See [creating coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creating-Editing-Deleting-Coupons) for more information. +You can create either a flat amount coupon, by specifying `amount_in_cents`, or percentage coupon by specifying `percentage`. See [Apply Coupons to Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions) for information on applying a coupon to a subscription in the Advanced Billing UI. @@ -139,7 +135,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `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 30. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `30`

**Constraints**: `<= 200` | | `filter` | [`?ListCouponsFilter`](../../doc/models/list-coupons-filter.md) | Query, Optional | Filter to use for List Coupons operations | -| `currencyPrices` | `?bool` | Query, Optional | When fetching coupons, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. Use in query `currency_prices=true`. | +| `currencyPrices` | `?bool` | Query, Optional | (Optional) If you have defined multiple currencies at the site level, you can pass `?currency_prices=true` to include an array of currency price data in the response. Use in query `currency_prices=true`. | ## Response Type @@ -281,9 +277,9 @@ try { # Find Coupon -Searches for a coupon by code, returning a 404 if no coupon is found. By passing a code parameter, the find will attempt to locate a coupon that matches that code. +Searches for a coupon by code. -If you have more than one product family and if the coupon you are trying to find does not belong to the default product family in your site, then you will need to specify (either in the url or as a query string param) the product family id. +If you have more than one product family and if the coupon you are trying to find does not belong to the default product family in your site, you need to specify (either in the URL or as a query string param) the `product_family_id`. ```php function findCoupon( @@ -303,7 +299,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `productFamilyId` | `?int` | Query, Optional | The Advanced Billing id of the product family to which the coupon belongs | | `code` | `?string` | Query, Optional | The code of the coupon | -| `currencyPrices` | `?bool` | Query, Optional | When fetching coupons, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. | +| `currencyPrices` | `?bool` | Query, Optional | (Optional) If you have defined multiple currencies at the site level, you can pass `?currency_prices=true` to include an array of currency price data in the response. | ## Response Type @@ -334,12 +330,11 @@ try { # Read Coupon -Returns a coupon by its Advanced Billing-assigned ID. You must identify the Coupon in this call by the ID parameter that Advanced Billing assigns. -If instead you would like to find a Coupon using a Coupon code, see the Coupon Find method. +Returns a coupon by its system-assigned ID. You must identify the Coupon in this call by the ID parameter assigned to it. -When fetching a coupon, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. +If instead you would like to find a Coupon using a Coupon code, use the [Find Coupon](../../doc/controllers/coupons.md#find-coupon) endpoint. -If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. +If the coupon is set to `use_site_exchange_rate: true`, it returns pricing based on the current exchange rate. If the flag is set to false, it returns all of the defined prices for each currency. ```php function readCoupon(int $productFamilyId, int $couponId, ?bool $currencyPrices = null): CouponResponse @@ -355,7 +350,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `productFamilyId` | `int` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs | | `couponId` | `int` | Template, Required | The Advanced Billing id of the coupon | -| `currencyPrices` | `?bool` | Query, Optional | When fetching coupons, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. | +| `currencyPrices` | `?bool` | Query, Optional | (Optional) If you have defined multiple currencies at the site level, you can pass `?currency_prices=true` to include an array of currency price data in the response. | ## Response Type @@ -633,7 +628,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `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 30. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.

**Default**: `30`

**Constraints**: `<= 200` | | `filter` | [`?ListCouponsFilter`](../../doc/models/list-coupons-filter.md) | Query, Optional | Filter to use for List Coupons operations | -| `currencyPrices` | `?bool` | Query, Optional | When fetching coupons, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. Use in query `currency_prices=true`. | +| `currencyPrices` | `?bool` | Query, Optional | (Optional) If you have defined multiple currencies at the site level, you can pass `?currency_prices=true` to include an array of currency price data in the response. Use in query `currency_prices=true`. | ## Response Type @@ -812,23 +807,17 @@ try { # Validate Coupon -Verifies whether a specific coupon code is valid. This method is useful for validating coupon codes that are entered by a customer. If the coupon is found and is valid, the coupon will be returned with a 200 status code. - -If the coupon is invalid, the status code will be 404 and the response will say why it is invalid. If the coupon is valid, the status code will be 200 and the coupon will be returned. The following reasons for invalidity are supported: - -+ Coupon not found -+ Coupon is invalid -+ Coupon expired +Verifies whether a specific coupon code is valid. This method is useful for validating coupon codes that are entered by a customer. -If you have more than one product family and if the coupon you are validating does not belong to the first product family in your site, then you will need to specify the product family, either in the url or as a query string param. This can be done by supplying the id or the handle in the `handle:my-family` format. +If you have more than one product family and if the coupon you are validating does not belong to the first product family in your site, you need to specify the product family, either in the URL or as a query string param. This can be done by supplying the id or the handle in the `handle:my-family` format. -Eg. +Supplying the `product_family_handle` in the URL: ``` https://.chargify.com/product_families/handle:/coupons/validate.?code= ``` -Or: +Supplying the `product_family_id` as a query parameter: ``` https://.chargify.com/coupons/validate.?code=&product_family_id= @@ -984,8 +973,6 @@ try { Creates subcodes for an existing coupon. -## Coupon Subcodes Intro - Coupon Subcodes allow you to create a set of unique codes that allow you to expand the use of one coupon. For example: @@ -1000,21 +987,9 @@ Coupon Subcodes: + DP80302 + SPRINGBALTIMORE -Coupon subcodes can be administered in the Admin Interface or via the API. - -When creating a coupon subcode, you must specify a coupon to attach it to using the coupon_id. Valid coupon subcodes are all capital letters, contain only letters and numbers, and do not have any spaces. Lowercase letters will be capitalized before the subcode is created. - -## Coupon Subcodes Documentation +When creating a coupon subcode, you must specify a coupon to attach it to using the coupon_id. Valid coupon subcodes are all capital letters, contain only letters and numbers, and do not have any spaces. Lowercase letters are capitalized before the subcode is created. -Full documentation on how to create coupon subcodes in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes). - -Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). - -## Create Coupon Subcode - -This request allows you to create specific subcodes underneath an existing coupon code. - -*Note*: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), you must encode them for use in the URL. +Note: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), you must encode them for use in the URL. % to %25 @ to %40 @@ -1023,7 +998,9 @@ This request allows you to create specific subcodes underneath an existing coupo _ to %5F . to %2E -So, if the coupon subcode is `20%OFF`, the URL to delete this coupon subcode would be: `https://.chargify.com/coupons/567/codes/20%25OFF.` +So, if the coupon subcode is `20%OFF`, the URL to delete this coupon subcode would be: `https://.chargify.com/coupons/567/codes/20%25OFF.`. + +For more information on coupon codes and applying coupons to subscriptions, see [Coupon Codes](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes) and [Coupons and Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). ```php function createCouponSubcodes(int $couponId, ?CouponSubcodes $body = null): CouponSubcodesResponse @@ -1254,7 +1231,7 @@ Note: If you are using any of the allowed special characters (“%”, “@”, ## Percent Encoding Example -Or if the coupon subcode is 20%OFF, the URL to delete this coupon subcode would be: @https://.chargify.com/coupons/567/codes/20%25OFF. +Or if the coupon subcode is 20%OFF, the URL to delete this coupon subcode would be: @https://.chargify.com/coupons/567/codes/20%25OFF.. ```php function deleteCouponSubcode(int $couponId, string $subcode): void diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md index c32fd59c..e30b44cd 100644 --- a/doc/controllers/customers.md +++ b/doc/controllers/customers.md @@ -21,30 +21,29 @@ $customersController = $client->getCustomersController(); # Create Customer -Creates a new customer; can also be created alongside a new subscription. The only validation restriction is that you may only create one customer for a given reference value. +Creates a new customer; can also be created alongside a new subscription. The only validation restriction is that you can only create one customer for a given reference value. -If provided, the `reference` value must be unique. It represents a unique identifier for the customer from your own app, i.e. the customer’s ID. This allows you to retrieve a given customer via a piece of shared information. Alternatively, you may choose to leave `reference` blank, and store Advanced Billing’s unique ID for the customer, which is in the `id` attribute. +If provided, the `reference` value must be unique. It represents a unique identifier for the customer from your own app, i.e. the customer’s ID. This allows you to retrieve a given customer via a piece of shared information. Alternatively, you can choose to leave `reference` blank, and store the system-assigned unique ID for the customer, which is in the `id` attribute. -Full documentation on how to locate, create and edit Customers in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24252190590093-Customer-Details). +For more information, see [Customer Details](https://maxio.zendesk.com/hc/en-us/articles/24252190590093-Customer-Details). ## Required Country Format -Advanced Billing requires that you use the ISO Standard Country codes when formatting country attribute of the customer. +Format the country attribute of the customer using the ISO Standard Country codes. -Countries should be formatted as 2 characters. For more information, see the following wikipedia article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) +Countries should be formatted as two characters. For more information, see [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes). ## Required State Format -Advanced Billing requires that you use the ISO Standard State codes when formatting state attribute of the customer. +Format the state attribute of the customer using the ISO Standard State codes. -+ US States (2 characters): [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US) ++ US States (two characters): see [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US). -+ States Outside the US (2-3 characters): To find the correct state codes outside of the US, go to [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to country you wish to populate. ++ States Outside the US (two to three characters): To find the correct state codes outside the US, go to [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the “ISO 3166-2 codes” column next to the country you wish to populate. ## Locale -Advanced Billing allows you to attribute a language/region to your customer to deliver invoices in any required language. -For more: [Customer Locale](https://maxio.zendesk.com/hc/en-us/articles/24286672013709-Customer-Locale) +You can attribute a language/region to the customer to deliver invoices in any required language. For more information, see [Customer Locale](https://maxio.zendesk.com/hc/en-us/articles/24286672013709-Customer-Locale). ```php function createCustomer(?CreateCustomerRequest $body = null): CustomerResponse @@ -130,6 +129,7 @@ try { "portal_invite_last_sent_at": null, "portal_invite_last_accepted_at": null, "tax_exempt": false, + "surcharging": false, "vat_number": null, "parent_id": null, "locale": "en-US" @@ -236,7 +236,8 @@ try { "portal_customer_created_at": "2016-10-04T15:22:29-04:00", "portal_invite_last_sent_at": "2016-10-04T15:22:30-04:00", "portal_invite_last_accepted_at": null, - "tax_exempt": false + "tax_exempt": false, + "surcharging": false } }, { @@ -262,6 +263,7 @@ try { "portal_invite_last_sent_at": "2016-10-13T16:52:54-04:00", "portal_invite_last_accepted_at": null, "tax_exempt": false, + "surcharging": true, "parent_id": 123 } }, @@ -288,6 +290,7 @@ try { "portal_invite_last_sent_at": "2016-10-19T10:49:19-04:00", "portal_invite_last_accepted_at": null, "tax_exempt": false, + "surcharging": false, "parent_id": null } } @@ -363,6 +366,7 @@ try { "portal_invite_last_sent_at": null, "portal_invite_last_accepted_at": null, "tax_exempt": false, + "surcharging": false, "vat_number": null, "parent_id": null, "locale": "es-MX", @@ -453,6 +457,7 @@ try { "portal_invite_last_sent_at": null, "portal_invite_last_accepted_at": null, "tax_exempt": false, + "surcharging": false, "vat_number": "012345678" } } @@ -550,6 +555,8 @@ try { Lists all subscriptions that belong to a customer. +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, subscriptions no longer require an associated product. For subscriptions without an associated product, 'product', 'product_price_point_id', and 'product_price_point_type' are returned as 'null'. + ```php function listCustomerSubscriptions(int $customerId): array ``` diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md index 8c15788f..c1b566f0 100644 --- a/doc/controllers/events-based-billing-segments.md +++ b/doc/controllers/events-based-billing-segments.md @@ -178,9 +178,9 @@ try { # Update Segment -Updates a single segment for a component with a segmented metric. It allows you to update the pricing for the segment. +Updates a single segment for a component with a segmented metric. You can also update the pricing for the segment. -You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax. +You can specify component and/or price point by using either the numeric ID or the `handle:gold` syntax. ```php function updateSegment( diff --git a/doc/controllers/events.md b/doc/controllers/events.md index d1436a88..e6a77600 100644 --- a/doc/controllers/events.md +++ b/doc/controllers/events.md @@ -19,15 +19,11 @@ $eventsController = $client->getEventsController(); Lists events for a site. -## Events Intro +Events include various activity that happens around a Site. This information is **especially** useful to track down issues that arise when subscriptions are not created due to errors. -Advanced Billing Events include various activity that happens around a Site. This information is **especially** useful to track down issues that arise when subscriptions are not created due to errors. +Within the UI, Events are referred to as Site Activity. For more information, see [Site Activity](https://maxio.zendesk.com/hc/en-us/articles/24250671733517-Site-Activity). -Within the Advanced Billing UI, "Events" are referred to as "Site Activity". Full documentation on how to view Events / Site Activity in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24250671733517-Site-Activity). - -## List Events for a Site - -This method will retrieve a list of events for a site. Use query string filters to narrow down results. You may use the `key` filter as part of your query string to narrow down results. +Use query string filters to narrow down results. You can use the `filter` parameter to filter by event key. ### Legacy Filters @@ -42,7 +38,7 @@ The following keys are no longer supported. ## Event Key -The event type is identified by the key property. You can check supported keys [here](../../doc/models/event-key.md). +The event type is identified by the key property. See [Event Key](../../doc/models/event-key.md) for a complete list of supported keys. ## Event Specific Data @@ -59,7 +55,7 @@ Here’s an example event for the `subscription_product_change` event: "event": { "id": 351, "key": "subscription_product_change", - "message": "Product changed on Marky Mark's subscription from 'Basic' to 'Pro'", + "message": "Product changed on Mark Alan's subscription from 'Basic' to 'Pro'", "subscription_id": 205, "event_specific_data": { "new_product_id": 3, @@ -77,7 +73,7 @@ Here’s an example event for the `subscription_state_change` event: "event": { "id": 353, "key": "subscription_state_change", - "message": "State changed on Marky Mark's subscription to Pro from trialing to active", + "message": "State changed on Mark Alan's subscription to Pro from trialing to active", "subscription_id": 205, "event_specific_data": { "new_subscription_state": "active", @@ -88,6 +84,22 @@ Here’s an example event for the `subscription_state_change` event: } ``` +## Enhanced Catalog Experience + +If you’re using the [enhanced Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology), you’ll see updated naming in webhook events and messages. + +Event name changes: + +- subscription_product_change → subscription_plan_change +- component_allocation_change → allocation_change +- component_billing_date_change → product_billing_date_change + +Message updates: + +- “Plan changed on Subscription from previous plan to new plan” +- “Successful payment for allocation changes to Product on Subscription” +- “Failed payment for allocation changes to Product on Subscription” + ```php function listEvents(array $options): array ``` @@ -102,8 +114,8 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `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 | -| `maxId` | `?int` | Query, Optional | Returns events with an id less than or equal to the one specified | +| `sinceId` | `?int` | Query, Optional | Returns events with an id greater than or equal to the one specified. | +| `maxId` | `?int` | Query, Optional | Returns events with an id less than or equal to the one specified. | | `direction` | [`?string(Direction)`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.

**Default**: `Direction::DESC` | | `filter` | [`?(string(EventKey)[])`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | | `dateField` | [`?string(ListEventsDateField)`](../../doc/models/list-events-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. | @@ -212,7 +224,7 @@ Lists events for a subscription. ## Event Key -The event type is identified by the key property. You can check supported keys [here](../../doc/models/event-key.md). +The event type is identified by the key property. See [Event Key](../../doc/models/event-key.md) for a complete list of supported keys. ## Event Specific Data @@ -220,6 +232,22 @@ Different event types may include additional data in `event_specific_data` prope While some events share the same schema for `event_specific_data`, others may not include it at all. For precise mappings from key to event_specific_data, refer to [Event](../../doc/models/event.md). +## Enhanced Catalog Experience + +If you’re using the [enhanced Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology), you’ll see updated naming in webhook events and messages. + +Event name changes: + +- subscription_product_change → subscription_plan_change +- component_allocation_change → allocation_change +- component_billing_date_change → product_billing_date_change + +Message updates: + +- “Successful payment for allocation changes to Product on Subscription” +- “Failed payment for allocation changes to Product on Subscription” +- “Plan changed on Subscription from previous plan to new plan” + ```php function listSubscriptionEvents(array $options): array ``` @@ -235,8 +263,8 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `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 | -| `maxId` | `?int` | Query, Optional | Returns events with an id less than or equal to the one specified | +| `sinceId` | `?int` | Query, Optional | Returns events with an id greater than or equal to the one specified. | +| `maxId` | `?int` | Query, Optional | Returns events with an id less than or equal to the one specified. | | `direction` | [`?string(Direction)`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.

**Default**: `Direction::DESC` | | `filter` | [`?(string(EventKey)[])`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | @@ -319,6 +347,20 @@ try { Returns the total count of events for a given site. +If you’re using the [enhanced Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology), you’ll see updated naming in webhook events and messages. + +Event name changes: + +- subscription_product_change → subscription_plan_change +- component_allocation_change → allocation_change +- component_billing_date_change → product_billing_date_change + +Message updates: + +- “Successful payment for allocation changes to Product on Subscription” +- “Failed payment for allocation changes to Product on Subscription” +- “Plan changed on Subscription from previous plan to new plan” + ```php function readEventsCount(array $options): CountResponse ``` @@ -333,8 +375,8 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `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 | -| `maxId` | `?int` | Query, Optional | Returns events with an id less than or equal to the one specified | +| `sinceId` | `?int` | Query, Optional | Returns events with an id greater than or equal to the one specified. | +| `maxId` | `?int` | Query, Optional | Returns events with an id less than or equal to the one specified. | | `direction` | [`?string(Direction)`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.

**Default**: `Direction::DESC` | | `filter` | [`?(string(EventKey)[])`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. | diff --git a/doc/controllers/insights.md b/doc/controllers/insights.md index 1ef9dd34..9df500b4 100644 --- a/doc/controllers/insights.md +++ b/doc/controllers/insights.md @@ -94,8 +94,8 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `atTime` | `?DateTime` | Query, Optional | submit a timestamp in ISO8601 format to request MRR for a historic time | -| `subscriptionId` | `?int` | Query, Optional | submit the id of a subscription in order to limit results | +| `atTime` | `?DateTime` | Query, Optional | submit a timestamp in ISO8601 format to request MRR for a historic time. | +| `subscriptionId` | `?int` | Query, Optional | submit the id of a subscription in order to limit results. | ## Response Type @@ -179,7 +179,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `subscriptionId` | `?int` | Query, Optional | optionally filter results by subscription | +| `subscriptionId` | `?int` | Query, Optional | (Optional) Filter results by 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 10. The maximum allowed values is 50; any per_page value over 50 will be changed to 50.
Use in query `per_page=20`.

**Default**: `10`

**Constraints**: `<= 50` | | `direction` | [`?string(SortingDirection)`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | @@ -266,7 +266,7 @@ try { **This endpoint is deprecated.** -This endpoint returns your site's current MRR, including plan and usage breakouts split per subscription. +Lists your site's current MRR, including plan and usage breakouts split per subscription. ```php function listMrrPerSubscription(array $options): SubscriptionMRRResponse diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index fd159b98..43c3f221 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -23,6 +23,8 @@ $invoicesController = $client->getInvoicesController(); * [Void Invoice](../../doc/controllers/invoices.md#void-invoice) * [List Consolidated Invoice Segments](../../doc/controllers/invoices.md#list-consolidated-invoice-segments) * [Create Invoice](../../doc/controllers/invoices.md#create-invoice) +* [Update Invoice](../../doc/controllers/invoices.md#update-invoice) +* [Delete Invoice](../../doc/controllers/invoices.md#delete-invoice) * [Send Invoice](../../doc/controllers/invoices.md#send-invoice) * [Preview Customer Information Changes](../../doc/controllers/invoices.md#preview-customer-information-changes) * [Update Customer Information](../../doc/controllers/invoices.md#update-customer-information) @@ -31,7 +33,7 @@ $invoicesController = $client->getInvoicesController(); # Refund Invoice -Refund an invoice, segment, or consolidated invoice. +Refunds an invoice, segment, or consolidated invoice. ## Partial Refund for Consolidated Invoice @@ -102,7 +104,7 @@ try { # List Invoices -By default, invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`, or `refunds`. To include breakdowns, pass the specific field as a key in the query with a value set to `true`. +Lists invoices for a site. By default, invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`, or `refunds`. To include breakdowns, pass the specific field as a key in the query with a value set to `true`. ```php function listInvoices(array $options): ListInvoicesResponse @@ -125,13 +127,13 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `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(Direction)`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned invoices.

**Default**: `Direction::DESC` | -| `lineItems` | `?bool` | Query, Optional | Include line items data

**Default**: `false` | -| `discounts` | `?bool` | Query, Optional | Include discounts data

**Default**: `false` | -| `taxes` | `?bool` | Query, Optional | Include taxes data

**Default**: `false` | -| `credits` | `?bool` | Query, Optional | Include credits data

**Default**: `false` | -| `payments` | `?bool` | Query, Optional | Include payments data

**Default**: `false` | -| `customFields` | `?bool` | Query, Optional | Include custom fields data

**Default**: `false` | -| `refunds` | `?bool` | Query, Optional | Include refunds data

**Default**: `false` | +| `lineItems` | `?bool` | Query, Optional | Include line items data.

**Default**: `false` | +| `discounts` | `?bool` | Query, Optional | Include discounts data.

**Default**: `false` | +| `taxes` | `?bool` | Query, Optional | Include taxes data.

**Default**: `false` | +| `credits` | `?bool` | Query, Optional | Include credits data.

**Default**: `false` | +| `payments` | `?bool` | Query, Optional | Include payments data.

**Default**: `false` | +| `customFields` | `?bool` | Query, Optional | Include custom fields data.

**Default**: `false` | +| `refunds` | `?bool` | Query, Optional | Include refunds data.

**Default**: `false` | | `dateField` | [`?string(InvoiceDateField)`](../../doc/models/invoice-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. Use in query `date_field=issue_date`.

**Default**: `InvoiceDateField::DUE_DATE` | | `startDatetime` | `?string` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns invoices with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. Allowed to be used only along with date_field set to created_at or updated_at. | | `endDatetime` | `?string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns invoices with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. Allowed to be used only along with date_field set to created_at or updated_at. | @@ -464,7 +466,7 @@ try { # Read Invoice -Use this endpoint to retrieve the details for an invoice. +Returns the details for an invoice. ## PDF Invoice retrieval @@ -628,7 +630,7 @@ try { # List Invoice Events -This endpoint returns a list of invoice events. Each event contains event "data" (such as an applied payment) as well as a snapshot of the `invoice` at the time of event completion. +Lists invoice events for a site. Each event contains event "data" (such as an applied payment) as well as a snapshot of the `invoice` at the time of event completion. Exposed event types are: @@ -1088,7 +1090,7 @@ try { # Record Payment for Invoice -Applies a payment of a given type against a specific invoice. If you would like to apply a payment across multiple invoices, you can use the Bulk Payment endpoint. +Applies a payment of a given type against a specific invoice. If you would like to apply a payment across multiple invoices, you can use the [Record Payment for Multiple Invoices](../../doc/controllers/invoices.md#record-payment-for-multiple-invoices) endpoint. ```php function recordPaymentForInvoice(string $uid, ?CreateInvoicePaymentRequest $body = null): Invoice @@ -1152,31 +1154,10 @@ try { # Record Payment for Multiple Invoices -This API call should be used when you want to record an external payment against multiple invoices. +Records an external payment against multiple invoices. To apply a payment to multiple invoices, at minimum, specify the `amount` and `applications` (i.e., `invoice_uid` and `amount`) details. -``` -{ - "payment": { - "memo": "to pay the bills", - "details": "check number 8675309", - "method": "check", - "amount": "250.00", - "applications": [ - { - "invoice_uid": "inv_8gk5bwkct3gqt", - "amount": "100.00" - }, - { - "invoice_uid": "inv_7bc6bwkct3lyt", - "amount": "150.00" - } - ] - } -} -``` - Note that the invoice payment amounts must be greater than 0. Total amount must be greater or equal to invoices payment amount sum. ```php @@ -1270,7 +1251,7 @@ try { # List Credit Notes -Credit Notes are like inverse invoices. They reduce the amount a customer owes. +Lists credit notes for a site. Credit Notes are like inverse invoices. They reduce the amount a customer owes. By default, the credit notes returned by this endpoint will exclude the arrays of `line_items`, `discounts`, `taxes`, `applications`, or `refunds`. To include these arrays, pass the specific field as a key in the query with a value set to `true`. @@ -1289,11 +1270,11 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `subscriptionId` | `?int` | Query, Optional | The subscription's Advanced Billing id | | `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` | -| `lineItems` | `?bool` | Query, Optional | Include line items data

**Default**: `false` | -| `discounts` | `?bool` | Query, Optional | Include discounts data

**Default**: `false` | -| `taxes` | `?bool` | Query, Optional | Include taxes data

**Default**: `false` | -| `refunds` | `?bool` | Query, Optional | Include refunds data

**Default**: `false` | -| `applications` | `?bool` | Query, Optional | Include applications data

**Default**: `false` | +| `lineItems` | `?bool` | Query, Optional | Include line items data.

**Default**: `false` | +| `discounts` | `?bool` | Query, Optional | Include discounts data.

**Default**: `false` | +| `taxes` | `?bool` | Query, Optional | Include taxes data.

**Default**: `false` | +| `refunds` | `?bool` | Query, Optional | Include refunds data.

**Default**: `false` | +| `applications` | `?bool` | Query, Optional | Include applications data.

**Default**: `false` | ## Response Type @@ -1635,7 +1616,7 @@ try { # Read Credit Note -Use this endpoint to retrieve the details for a credit note. +Returns the details for a credit note. ```php function readCreditNote(string $uid): CreditNote @@ -1991,7 +1972,7 @@ try { # Record Payment for Subscription -Record an external payment made against a subscription that will pay partially or in full one or more invoices. +Records an external payment made against a subscription that will pay partially or in full one or more invoices. Payment will be applied starting with the oldest open invoice and then next oldest, and so on until the amount of the payment is fully consumed. @@ -2084,7 +2065,7 @@ try { # Reopen Invoice -This endpoint allows you to reopen any invoice with the "canceled" status. Invoices enter "canceled" status if they were open at the time the subscription was canceled (whether through dunning or an intentional cancellation). +Reopens any invoice with the "canceled" status. Invoices enter "canceled" status if they were open at the time the subscription was canceled (whether through dunning or an intentional cancellation). Invoices with "canceled" status are no longer considered to be due. Once reopened, they are considered due for payment. Payment may then be captured in one of the following ways: @@ -2145,7 +2126,7 @@ try { # Void Invoice -This endpoint allows you to void any invoice with the "open" or "canceled" status. It will also allow voiding of an invoice with the "pending" status if it is not a consolidated invoice. +Voids any invoice with the "open" or "canceled" status. It will also allow voiding of an invoice with the "pending" status if it is not a consolidated invoice. ```php function voidInvoice(string $uid, ?VoidInvoiceRequest $body = null): Invoice @@ -2205,7 +2186,7 @@ try { # List Consolidated Invoice Segments -Invoice segments returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, or `custom_fields`. +Lists segments for a consolidated invoice. Invoice segments returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, or `custom_fields`. ```php function listConsolidatedInvoiceSegments(array $options): ConsolidatedInvoice @@ -2527,7 +2508,7 @@ try { # Create Invoice -This endpoint will allow you to create an ad hoc invoice. +Creates an ad hoc invoice. ### Basic Behavior @@ -2900,9 +2881,174 @@ try { | 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) | +# Update Invoice + +Updates an ad hoc invoice while it is in the `draft` state. + +**Important: only invoices with the `adhoc` role and `draft` status can be updated.** Any other invoice — issued, or with a different role (e.g. `renewal`, `signup`) — cannot be updated through this endpoint and the request returns a `422` error. If the invoice does not belong to the provided subscription, a `404` error is returned. + +Only the attributes submitted in the request are changed — omitted attributes keep their current values. + +### Line Items + +The `line_items` array describes changes to the invoice's line items. Line items not referenced in the array remain unchanged. + +#### Adding a line item + +A line item without a `uid` is added to the invoice. The same line item types and options as on invoice creation are supported (custom items, `product_id`, `component_id`, price points, period date ranges, taxes). + +#### Updating a line item + +A line item with the `uid` of an existing line item updates that line item with the submitted attributes. Amounts and taxes are recalculated. + +#### Removing a line item + +A line item with a `uid` and `"_destroy": true` is removed from the invoice. Other line items remain unchanged. + +Referencing a `uid` which does not exist on the invoice returns a `422` error. + +### Coupons + +When the `coupons` key is present, the submitted coupons replace all discounts currently applied to the invoice. Send an empty array to remove all discounts. Coupon options are the same as on invoice creation. + +### Invoice Options + +#### Issue Date and Net Terms + +The `issue_date` parameter can be sent to change the invoice's issue date. Only today or dates in the past are accepted. The date is interpreted and validated in your site's time zone, using the `YYYY-MM-DD` format. The `net_terms` parameter indicates the number of days after the issue date on which the invoice is due. The due date is recalculated whenever the issue date or net terms change. + +#### Addresses + +The seller, shipping and billing addresses can be sent to replace the addresses on the invoice. Each address requires to send a `first_name` at a minimum in order to work. Taxes are recalculated after an address change. + +#### Memo and Payment Instructions + +A custom memo can be sent with the `memo` parameter. Likewise, custom payment instructions can be sent with the `payment_instructions` parameter. + +```php +function updateInvoice(int $subscriptionId, string $uid, ?UpdateInvoiceRequest $body = null): InvoiceResponse +``` + +## Authentication + +This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `uid` | `string` | Template, Required | The unique identifier for the invoice, this does not refer to the public facing invoice number. | +| `body` | [`?UpdateInvoiceRequest`](../../doc/models/update-invoice-request.md) | Body, Optional | Request payload for updating a draft ad hoc invoice. | + +## Response Type + +**200**: OK + +[`InvoiceResponse`](../../doc/models/invoice-response.md) + +## Example Usage + +```php +$subscriptionId = 222; + +$uid = 'uid0'; + +$body = UpdateInvoiceRequestBuilder::init( + UpdateInvoiceBuilder::init() + ->netTerms(30) + ->memo('Updated memo') + ->build() +)->build(); + +$invoicesController = $client->getInvoicesController(); + +try { + $result = $invoicesController->updateInvoice( + $subscriptionId, + $uid, + $body + ); + echo 'InvoiceResponse:'; + var_dump($result); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) | + + +# Delete Invoice + +Deletes an ad hoc invoice while it is in the `draft` state. + +**Important: only invoices with the `adhoc` role and `draft` status can be deleted.** Any other invoice — issued, or with a different role (e.g. `renewal`, `signup`) — cannot be deleted through this endpoint and the request returns a `422` error. Issued invoices should be voided instead. If the invoice does not belong to the provided subscription, a `404` error is returned. + +A successful deletion returns a `204 No Content` response and the invoice is permanently removed. + +```php +function deleteInvoice(int $subscriptionId, string $uid): void +``` + +## Authentication + +This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) + +## Parameters + +| Parameter | Type | Tags | Description | +| --- | --- | --- | --- | +| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | +| `uid` | `string` | Template, Required | The unique identifier for the invoice, this does not refer to the public facing invoice number. | + +## Response Type + +**204**: No Content + +`void` + +## Example Usage + +```php +$subscriptionId = 222; + +$uid = 'uid0'; + +$invoicesController = $client->getInvoicesController(); + +try { + $invoicesController->deleteInvoice( + $subscriptionId, + $uid + ); +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught:', $exp; +} +``` + +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 404 | Not Found | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + + # Send Invoice -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. +Sends an invoice to the customer 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. @@ -2977,7 +3123,7 @@ try { # Preview Customer Information Changes -Customer information may change after an invoice is issued, which may lead to a mismatch between customer information that is present on an open invoice and actual customer information. This endpoint allows you to preview these differences, if any. +Previews the effect of customer information changes on an open invoice. Customer information may change after an invoice is issued, which may lead to a mismatch between customer information that is present on an open invoice and actual customer information. This endpoint allows you to preview these differences, if any. The endpoint doesn't accept a request body. Customer information differences are calculated on the application side. @@ -3082,7 +3228,7 @@ try { # Update Customer Information -This endpoint updates customer information on an open invoice and returns the updated invoice. If you would like to preview changes that will be applied, use the `/invoices/{uid}/customer_information/preview.json` endpoint first. +Updates customer information on an open invoice and returns the updated invoice. If you would like to preview changes that will be applied, use the `/invoices/{uid}/customer_information/preview.json` endpoint first. The endpoint doesn't accept a request body. Customer information differences are calculated on the application side. @@ -3322,7 +3468,7 @@ try { # Issue Invoice -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. +Issues an invoice that is in "pending" or "draft" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option. You cannot issue a pending child invoice that was created for a member subscription in a group. diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md index fe5be367..21d07872 100644 --- a/doc/controllers/offers.md +++ b/doc/controllers/offers.md @@ -19,15 +19,13 @@ $offersController = $client->getOffersController(); # Create Offer -Creates an offer within your Advanced Billing site. - -## Documentation +Creates an offer within your site. Offers allow you to package complicated combinations of products, components and coupons into a convenient package which can then be subscribed to just like products. Once an offer is defined it can be used as an alternative to the product when creating subscriptions. -Full documentation on how to use offers in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261295098637-Offers-Overview). +For more information, see [Offers](https://maxio.zendesk.com/hc/en-us/articles/24261295098637-Offers-Overview) in the product documentation. ## Using a Product Price Point diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md index 3d1f3acc..12ab21f7 100644 --- a/doc/controllers/payment-profiles.md +++ b/doc/controllers/payment-profiles.md @@ -142,7 +142,7 @@ try { # List Payment Profiles -Returns all active payment profiles for a site, or for one customer within a site. If no payment profiles are found, this endpoint will return an empty array, not a 404. +Lists all active payment profiles for a site, or for one customer within a site. If no payment profiles are found, this endpoint returns an empty array. ```php function listPaymentProfiles(array $options): array @@ -491,7 +491,7 @@ try { Deletes an unused payment profile. -If the payment profile is in use by one or more subscriptions or groups, a 422 and error message will be returned. +If the payment profile is in use by one or more subscriptions or groups, an error message is returned. ```php function deleteUnusedPaymentProfile(int $paymentProfileId): void @@ -541,9 +541,9 @@ try { Deletes a payment profile belonging to the customer on the subscription. -+ If the customer has multiple subscriptions, the payment profile will be removed from all of them. +If the customer has multiple subscriptions, the payment profile is removed from all of them. -+ If you delete the default payment profile for a subscription, you will need to specify another payment profile to be the default through the api, or either prompt the user to enter a card in the billing portal or on the self-service page, or visit the Payment Details tab on the subscription in the Admin UI and use the “Add New Credit Card” or “Make Active Payment Method” link, (depending on whether there are other cards present). +If you delete the default payment profile for a subscription, you need to specify another payment profile to be the default through the API, or either prompt the user to enter a card in the billing portal or on the self-service page, or visit the Payment Details tab on the subscription in the Admin UI and use the “Add New Credit Card” or “Make Active Payment Method” link, (depending on whether there are other cards present). ```php function deleteSubscriptionsPaymentProfile(int $subscriptionId, int $paymentProfileId): void @@ -817,7 +817,7 @@ try { # Change Subscription Group Default Payment Profile -This will change the default payment profile on the subscription group to the existing payment profile with the id specified. +Changes the default payment profile on the subscription group to the existing payment profile with the specified ID. 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. @@ -908,7 +908,7 @@ try { # Read One Time Token -One Time Tokens aka Advanced Billing Tokens house the credit card or ACH (Authorize.Net or Stripe only) data for a customer. +Returns the one-time token data, including credit card or ACH details, associated with the provided token ID. One Time Tokens aka Advanced Billing Tokens house the credit card or ACH (Authorize.Net or Stripe only) data for a customer. You can use One Time Tokens while creating a subscription or payment profile instead of passing all bank account or credit card data directly to a given API endpoint. @@ -961,7 +961,7 @@ try { # Send Request Update Payment Email -You can send a "request payment update" email to the customer associated with the subscription. +Sends a "request payment update" email to the customer associated with the subscription. If you attempt to send a "request payment update" email more than five times within a 30-minute period, you will receive a `422` response with an error message in the body. This error message will indicate that the request has been rejected due to excessive attempts, and will provide instructions on how to resubmit the request. diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md index bddeba3f..208244e3 100644 --- a/doc/controllers/product-families.md +++ b/doc/controllers/product-families.md @@ -41,7 +41,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `endDate` | `?DateTime` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. | | `startDatetime` | `?DateTime` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. | | `endDatetime` | `?DateTime` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. | -| `includeArchived` | `?bool` | Query, Optional | Include archived products | +| `includeArchived` | `?bool` | Query, Optional | Include archived products. | | `mInclude` | [`?string(ListProductsInclude)`](../../doc/models/list-products-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=prepaid_product_price_point`. | ## Response Type @@ -189,7 +189,7 @@ try { # Create Product Family -Creates a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components, and coupons. +Creates a Product Family within your site. Create a Product Family to act as a container for your products, components, and coupons. Full documentation on how Product Families operate within the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product-Families). @@ -221,6 +221,7 @@ $body = CreateProductFamilyRequestBuilder::init( 'Acme Projects' ) ->description('Amazing project management tool') + ->surcharging(false) ->build() )->build(); @@ -246,7 +247,8 @@ try { "name": "Acme Projects", "description": "Amazing project management tool", "handle": "acme-projects", - "accounting_code": null + "accounting_code": null, + "surcharging": false } } ``` @@ -260,7 +262,7 @@ try { # List Product Families -Returns a list of Product Families for a site. +Lists Product Families for a site. ```php function listProductFamilies(array $options): array @@ -315,6 +317,7 @@ try { "description": null, "handle": "acme-projects", "accounting_code": null, + "surcharging": false, "created_at": "2013-02-20T15:05:51-07:00", "updated_at": "2013-02-20T15:05:51-07:00", "archived_at": null @@ -327,6 +330,7 @@ try { "description": "Another family.", "handle": "bat-family", "accounting_code": null, + "surcharging": true, "created_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" @@ -388,6 +392,7 @@ try { "description": "", "handle": "billing-plans", "accounting_code": null, + "surcharging": false, "archived_at": null } } diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md index bb4e9897..9a320146 100644 --- a/doc/controllers/product-price-points.md +++ b/doc/controllers/product-price-points.md @@ -144,7 +144,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `productId` | int\|string | Template, Required | This is a container for one-of cases. | | `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 10. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.

**Default**: `10`

**Constraints**: `<= 200` | -| `currencyPrices` | `?bool` | Query, Optional | When fetching a product's price points, if you have defined multiple currencies at the site level, you can optionally pass the ?currency_prices=true query param to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. | +| `currencyPrices` | `?bool` | Query, Optional | (Optional) If you have defined multiple currencies at the site level, you can pass ?currency_prices=true to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. | | `filterType` | [`?(string(PricePointType)[])`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. | | `archived` | `?bool` | Query, Optional | Set to include archived price points in the response. | @@ -316,7 +316,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `productId` | 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. | -| `currencyPrices` | `?bool` | Query, Optional | When fetching a product's price points, if you have defined multiple currencies at the site level, you can optionally pass the ?currency_prices=true query param to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. | +| `currencyPrices` | `?bool` | Query, Optional | (Optional) If you have defined multiple currencies at the site level, you can pass ?currency_prices=true to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. | ## Response Type diff --git a/doc/controllers/products.md b/doc/controllers/products.md index 7016143c..a97e364a 100644 --- a/doc/controllers/products.md +++ b/doc/controllers/products.md @@ -20,11 +20,13 @@ $productsController = $client->getProductsController(); # Create Product -Creates a product in your Advanced Billing site. +Creates a product in your site. -See the following product documentation for more information: +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, the `auto_create_signup_page` parameter is not supported. If `auto_create_signup_page` is included (with any value) an error is returned. -+ [Products Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview) +For more information, see: + ++ [Products Overview](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview) + [Changing a Subscription's Product](https://maxio.zendesk.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations) ```php diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md index 33ea20dc..79bc3012 100644 --- a/doc/controllers/proforma-invoices.md +++ b/doc/controllers/proforma-invoices.md @@ -24,7 +24,7 @@ $proformaInvoicesController = $client->getProformaInvoicesController(); # Create Consolidated Proforma Invoice -Creates a consolidated proforma invoice asynchronously. It will return a 201 with no message, or a 422 with any errors. To find and view the new consolidated proforma invoice, you may poll the subscription group listing for proforma invoices; only one consolidated proforma invoice may be created per group at a time. +Creates a consolidated proforma invoice asynchronously. To find and view the new consolidated proforma invoice, you can poll the subscription group listing for proforma invoices; only one consolidated proforma invoice can be created per group at a time. If the information becomes outdated, simply void the old consolidated proforma invoice and generate a new one. @@ -94,12 +94,12 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `uid` | `string` | Template, Required | The uid of the subscription group | -| `lineItems` | `?bool` | Query, Optional | Include line items data

**Default**: `false` | -| `discounts` | `?bool` | Query, Optional | Include discounts data

**Default**: `false` | -| `taxes` | `?bool` | Query, Optional | Include taxes data

**Default**: `false` | -| `credits` | `?bool` | Query, Optional | Include credits data

**Default**: `false` | -| `payments` | `?bool` | Query, Optional | Include payments data

**Default**: `false` | -| `customFields` | `?bool` | Query, Optional | Include custom fields data

**Default**: `false` | +| `lineItems` | `?bool` | Query, Optional | Include line items data.

**Default**: `false` | +| `discounts` | `?bool` | Query, Optional | Include discounts data.

**Default**: `false` | +| `taxes` | `?bool` | Query, Optional | Include taxes data.

**Default**: `false` | +| `credits` | `?bool` | Query, Optional | Include credits data.

**Default**: `false` | +| `payments` | `?bool` | Query, Optional | Include payments data.

**Default**: `false` | +| `customFields` | `?bool` | Query, Optional | Include custom fields data.

**Default**: `false` | ## Response Type @@ -267,12 +267,12 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | `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(Direction)`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned invoices.

**Default**: `Direction::DESC` | -| `lineItems` | `?bool` | Query, Optional | Include line items data

**Default**: `false` | -| `discounts` | `?bool` | Query, Optional | Include discounts data

**Default**: `false` | -| `taxes` | `?bool` | Query, Optional | Include taxes data

**Default**: `false` | -| `credits` | `?bool` | Query, Optional | Include credits data

**Default**: `false` | -| `payments` | `?bool` | Query, Optional | Include payments data

**Default**: `false` | -| `customFields` | `?bool` | Query, Optional | Include custom fields data

**Default**: `false` | +| `lineItems` | `?bool` | Query, Optional | Include line items data.

**Default**: `false` | +| `discounts` | `?bool` | Query, Optional | Include discounts data.

**Default**: `false` | +| `taxes` | `?bool` | Query, Optional | Include taxes data.

**Default**: `false` | +| `credits` | `?bool` | Query, Optional | Include credits data.

**Default**: `false` | +| `payments` | `?bool` | Query, Optional | Include payments data.

**Default**: `false` | +| `customFields` | `?bool` | Query, Optional | Include custom fields data.

**Default**: `false` | ## Response Type @@ -449,7 +449,7 @@ try { # Preview Proforma Invoice -Returns a preview of the data that will be included on a given subscription's proforma invoice if one were to be generated. It will have similar line items and totals as a renewal preview, but the response will be presented in the format of a proforma invoice. Consequently it will include additional information such as the name and addresses that will appear on the proforma invoice. +Previews the data that will be included on a given subscription's proforma invoice if one were to be generated. It will have similar line items and totals as a renewal preview, but the response will be presented in the format of a proforma invoice. Consequently it will include additional information such as the name and addresses that will appear on the proforma invoice. The preview endpoint is subject to all the same conditions as the proforma invoice endpoint. For example, previews are only available on the Relationship Invoicing architecture, and previews cannot be made for end-of-life subscriptions. diff --git a/doc/controllers/reason-codes.md b/doc/controllers/reason-codes.md index c3625c5f..f462a018 100644 --- a/doc/controllers/reason-codes.md +++ b/doc/controllers/reason-codes.md @@ -21,21 +21,11 @@ $reasonCodesController = $client->getReasonCodesController(); Creates a reason code for a given site. -# Reason Codes Intro - Reason Codes are a way to gain a high-level view of why your customers are cancelling the subscription to your product or service. Add a set of churn reason codes to be displayed in-app and/or the Maxio Billing Portal. As your subscribers decide to cancel their subscription, learn why they decided to cancel. -## Reason Code Documentation - -Full documentation on how Reason Codes operate within Advanced Billing can be located under the following links. - -[Churn Reason Codes](https://maxio.zendesk.com/hc/en-us/articles/24286647554701-Churn-Reason-Codes) - -## Create Reason Code - -This method gives a merchant the option to create reason codes for a given site. +For more information, see [Churn Reason Codes](https://maxio.zendesk.com/hc/en-us/articles/24286647554701-Churn-Reason-Codes). ```php function createReasonCode(?CreateReasonCodeRequest $body = null): ReasonCodeResponse diff --git a/doc/controllers/referral-codes.md b/doc/controllers/referral-codes.md index c3e60915..2fb73505 100644 --- a/doc/controllers/referral-codes.md +++ b/doc/controllers/referral-codes.md @@ -13,13 +13,7 @@ $referralCodesController = $client->getReferralCodesController(); Validates whether a referral code is valid and applicable within your site. This method is useful for validating referral codes that are entered by a customer. -## Referrals Documentation - -Full documentation on how to use the referrals feature in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/sections/24286965611405-Referrals). - -## Server Response - -If the referral code is valid the status code will be `200` and the referral code will be returned. If the referral code is invalid, a `404` response will be returned. +For more information, see [Understanding Referrals](https://docs.maxio.com/hc/en-us/articles/24286981223693-Understanding-Referrals) in the product documentation. ```php function validateReferralCode(string $code): ReferralValidationResponse diff --git a/doc/controllers/sales-commissions.md b/doc/controllers/sales-commissions.md index e06c228e..32c0c801 100644 --- a/doc/controllers/sales-commissions.md +++ b/doc/controllers/sales-commissions.md @@ -25,7 +25,7 @@ The Sales Commission API differs from other Chargify API endpoints. This resourc Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. -> Note: The request is at seller level, it means `<>` variable will be replaced by `app` +> Note: The request is at seller level, it means `<>` variable will be replaced by `app`. ```php function listSalesCommissionSettings(array $options): array @@ -109,7 +109,7 @@ try { # List Sales Reps -Returns a sales rep list with details. +Lists sales reps with details. ## Modified Authentication Process @@ -117,7 +117,7 @@ The Sales Commission API differs from other Chargify API endpoints. This resourc Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. -> Note: The request is at seller level, it means `<>` variable will be replaced by `app` +> Note: The request is at seller level, it means `<>` variable will be replaced by `app`. ```php function listSalesReps(array $options): array @@ -258,7 +258,7 @@ The Sales Commission API differs from other Chargify API endpoints. This resourc Access to the Sales Commission API endpoints is available to users with financial access, where the seller has the Advanced Analytics component enabled. For further information on getting access to Advanced Analytics contact Maxio support. -> Note: The request is at seller level, it means `<>` variable will be replaced by `app` +> Note: The request is at seller level, it means `<>` variable will be replaced by `app`. ```php function readSalesRep( diff --git a/doc/controllers/sites.md b/doc/controllers/sites.md index 0e9776c5..b8abb45c 100644 --- a/doc/controllers/sites.md +++ b/doc/controllers/sites.md @@ -19,20 +19,19 @@ $sitesController = $client->getSitesController(); Retrieves site data. -Full documentation on Sites in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/sections/24250550707085-Sites). - -Specifically, the [Clearing Site Data](https://maxio.zendesk.com/hc/en-us/articles/24250617028365-Clearing-Site-Data) section is relevant to this endpoint documentation. +For more information, see [Sites](https://maxio.zendesk.com/hc/en-us/sections/24250550707085-Sites) in the product documentation. Specifically, the [Clearing Site Data](https://maxio.zendesk.com/hc/en-us/articles/24250617028365-Clearing-Site-Data) section is relevant to this endpoint. #### Relationship invoicing enabled -If the site has RI enabled then you will see more settings like: +If the site has Relationship invoicing enabled, additional properties are returned in the response: - "customer_hierarchy_enabled": true, - "whopays_enabled": true, - "whopays_default_payer": "self" +``` +"customer_hierarchy_enabled": true, +"whopays_enabled": true, +"whopays_default_payer": "self" +``` -You can read more about these settings here: -[Who Pays & Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays) +For more information, see [Who Pays & Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays). ```php function readSite(): SiteResponse @@ -157,7 +156,7 @@ try { # List Chargify Js Public Keys -Returns public keys used for Maxio.js (formerly Chargify.js). +Lists public keys used for Maxio.js (formerly Chargify.js). ```php function listChargifyJsPublicKeys(array $options): ListPublicKeysResponse diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index d8d8313b..acb85355 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -627,7 +627,7 @@ try { # List Allocations -Returns the 50 most recent Allocations, ordered by most recent first. +Lists the 50 most recent Allocations, ordered by most recent first. ## On/Off Components @@ -1349,7 +1349,7 @@ try { # List Usages -Returns a list of usages associated with a subscription for a particular metered component. This will display the previously recorded components for a subscription. +Lists usages associated with a subscription for a particular metered component. This will display the previously recorded components for a subscription. This endpoint is not compatible with quantity-based components. @@ -1379,8 +1379,8 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `subscriptionIdOrReference` | int\|string | Template, Required | This is a container for one-of cases. | | `componentId` | int\|string | Template, Required | This is a container for one-of cases. | -| `sinceId` | `?int` | Query, Optional | Returns usages with an id greater than or equal to the one specified | -| `maxId` | `?int` | Query, Optional | Returns usages with an id less than or equal to the one specified | +| `sinceId` | `?int` | Query, Optional | Returns usages with an id greater than or equal to the one specified. | +| `maxId` | `?int` | Query, Optional | Returns usages with an id less than or equal to the one specified. | | `sinceDate` | `?DateTime` | Query, Optional | Returns usages with a created_at date greater than or equal to midnight (12:00 AM) on the date specified. | | `untilDate` | `?DateTime` | Query, Optional | Returns usages with a created_at date less than or equal to midnight (12:00 AM) on the date specified. | | `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` | @@ -1449,13 +1449,13 @@ try { Activates an event-based component for a single subscription. -In order to bill your subscribers on your Events data under the Events-Based Billing feature, the components must be activated for the subscriber. +To bill your subscribers on your Events data under the Events-Based Billing feature, the components must be activated for the subscriber. -Learn more about the role of activation in the [Events-Based Billing docs](https://maxio.zendesk.com/hc/en-us/articles/24260323329805-Events-Based-Billing-Overview). +For more information, see [Design Your Catalog](https://docs.maxio.com/hc/en-us/articles/24181036583053-Design-Your-Catalog?method=componenttypes). -Use this endpoint to activate an event-based component for a single subscription. Activating an event-based component causes Advanced Billing to bill for events when the subscription is renewed. +Use this endpoint to activate an event-based component for a single subscription. Activating an event-based component causes billing for events when the subscription is renewed. -*Note: it is possible to stream events for a subscription at any time, regardless of component activation status. The activation status only determines if the subscription should be billed for event-based component usage at renewal.* +Note: it is possible to stream events for a subscription at any time, regardless of component activation status. The activation status only determines if the subscription should be billed for event-based component usage at renewal. ```php function activateEventBasedComponent( @@ -1581,21 +1581,15 @@ try { Records a single event for Events-Based Billing. -## Documentation - Events-Based Billing is an evolved form of metered billing that is based on data-rich events streamed in real-time from your system to Advanced Billing. These events can then be transformed, enriched, or analyzed to form the computed totals of usage charges billed to your customers. This API allows you to stream events into the Advanced Billing data ingestion engine. -Learn more about the feature in general in the [Events-Based Billing help docs](https://maxio.zendesk.com/hc/en-us/articles/24260323329805-Events-Based-Billing-Overview). - -## Record Event - -Use this endpoint to record a single event. +For more information, see [Design Your Catalog](https://docs.maxio.com/hc/en-us/articles/24181036583053-Design-Your-Catalog?method=componenttypes). -*Note: this endpoint differs from the standard Chargify API endpoints in that the URL subdomain will be `events` and your site subdomain will be included in the URL path. For example:* +Note: this endpoint differs from the standard URL for this API in that `events` and your site subdomain are included in the path. For example: ``` https://events.chargify.com/my-site-subdomain/events/my-stream-api-handle @@ -1614,7 +1608,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `apiHandle` | `string` | Template, Required | Identifies the Stream for which the event should be published. | -| `storeUid` | `?string` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. | +| `storeUid` | `?string` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. This applies to Legacy Metering sites only — it has no effect on Maxio Metering sites. | | `body` | [`?EBBEvent`](../../doc/models/ebb-event.md) | Body, Optional | - | ## Response Type @@ -1655,7 +1649,7 @@ try { Records a collection of events. -*Note: this endpoint differs from the standard Chargify API endpoints in that the subdomain will be `events` and your site subdomain will be included in the URL path.* +Note: this endpoint differs from the standard URL for this API in that `events` and your site subdomain are included in the path. A maximum of 1000 events can be published in a single request. A 422 will be returned if this limit is exceeded. @@ -1672,7 +1666,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `apiHandle` | `string` | Template, Required | Identifies the Stream for which the events should be published. | -| `storeUid` | `?string` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. | +| `storeUid` | `?string` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. This applies to Legacy Metering sites only — it has no effect on Maxio Metering sites. | | `body` | [`?(EBBEvent[])`](../../doc/models/ebb-event.md) | Body, Optional | - | ## Response Type diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md index 149929d9..cf79d4fc 100644 --- a/doc/controllers/subscription-groups.md +++ b/doc/controllers/subscription-groups.md @@ -186,7 +186,7 @@ try { # List Subscription Groups -Returns an array of subscription groups for the site. The response is paginated and will return a `meta` key with pagination information. +Lists subscription groups for the site. The response is paginated and will return a `meta` key with pagination information. #### Account Balance Information @@ -347,9 +347,9 @@ try { "current_billing_amount_in_cents": 11500, "customer": { "first_name": "Mark", - "last_name": "Wannabewahlberg", - "organization": "The Funky Bunch", - "email": "markymark@example.com", + "last_name": "Smith", + "organization": "Acme Inc.", + "email": "smith@example.com", "reference": "4c92223b-bc16-4d0d-87ff-b177a89a2655" }, "account_balances": { @@ -521,7 +521,7 @@ try { Finds the subscription group associated with a subscription. -If the subscription is not in a group, the endpoint will return a 404 code. +If the subscription is not in a group, this endpoint returns an error. ```php function findSubscriptionGroup(string $subscriptionId): FullSubscriptionGroupResponse @@ -578,9 +578,9 @@ try { "cancel_at_end_of_period": false, "customer": { "first_name": "Mark", - "last_name": "Wannabewahlberg", - "organization": "The Funky Bunch", - "email": "markymark@example.com", + "last_name": "Smith", + "organization": "Acme Inc.", + "email": "smith@example.com", "reference": "4c92223b-bc16-4d0d-87ff-b177a89a2655" }, "account_balances": { @@ -609,7 +609,7 @@ try { # Add Subscription to Group -For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to add existing subscriptions to subscription groups. +Adds an existing subscription to a subscription group. For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to add existing subscriptions to subscription groups. Passing `group` parameters with a `target` containing a `type` and optional `id` is all that's needed. When the `target` parameter specifies a `"customer"` or `"subscription"` that is already part of a hierarchy, the subscription will become a member of the customer's subscription group. If the target customer or subscription is not part of a subscription group, a new group will be created and the subscription will become part of the group with the specified target customer set as the responsible payer for the group's subscriptions. @@ -712,7 +712,7 @@ try { # Remove Subscription from Group -For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to remove an existing subscription from a subscription group. +Removes an existing subscription from a subscription group. For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to remove an existing subscription from a subscription group. ```php function removeSubscriptionFromGroup(int $subscriptionId): void diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md index 6cd425a8..20112a71 100644 --- a/doc/controllers/subscription-notes.md +++ b/doc/controllers/subscription-notes.md @@ -21,13 +21,11 @@ $subscriptionNotesController = $client->getSubscriptionNotesController(); Creates a note for a subscription. -## How to Use Subscription Notes - Notes allow you to record information about a particular Subscription in a free text format. -If you have structured data such as birth date, color, etc., consider using Metadata instead. +If you have structured data such as birth date, color, etc., consider using [Metadata](../../doc/controllers/custom-fields.md#create-metadata) instead. -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). +For more information, see [Adding Notes](https://docs.maxio.com/hc/en-us/articles/24251654953997-Understanding-the-Subscription-Summary-Page#billing-portal-status:~:text=documentation%20for%20more.-,Adding%20Notes,-Notes%20are%20optional) in the product documentation. ```php function createSubscriptionNote( diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md index cf5ef18a..971dc520 100644 --- a/doc/controllers/subscription-products.md +++ b/doc/controllers/subscription-products.md @@ -18,17 +18,15 @@ $subscriptionProductsController = $client->getSubscriptionProductsController(); Migrates a subscription to a different product. -In order to create a migration, you must pass the `product_id` or `product_handle` in the object when you send a POST request. You may also pass either a `product_price_point_id` or `product_price_point_handle` to choose which price point the subscription is moved to. If no price point identifier is passed the subscription will be moved to the products default price point. The response will be the updated subscription. +To create a migration, you must pass the `product_id` or `product_handle` in the object when you send a POST request. You can also pass either a `product_price_point_id` or `product_price_point_handle` to choose which price point the subscription is moved to. If no price point identifier is passed, the subscription is moved to the product's default price point. The response is the updated subscription. ## Valid Subscriptions -Subscriptions should be in the `active` or `trialing` state in order to be migrated. +Subscriptions should be in the `active` or `trialing` state to be migrated. (For backwards compatibility reasons, it is possible to migrate a subscription that is in the `trial_ended` state via the API, however this is not recommended. Since `trial_ended` is an end-of-life state, the subscription should be canceled, the product changed, and then the subscription can be reactivated.) -## Migrations Documentation - -Full documentation on how to record Migrations in the Advanced Billing UI can be located [here](https://maxio.zendesk.com/hc/en-us/articles/24181589372429-Data-Migration-to-Advanced-Billing). +For more information, see [Product Changes and Migrations](https://docs.maxio.com/hc/en-us/articles/24252069837581-Product-Changes-and-Migrations). ## Failed Migrations diff --git a/doc/controllers/subscription-renewals.md b/doc/controllers/subscription-renewals.md index 5cdc14cd..7e5dc2a9 100644 --- a/doc/controllers/subscription-renewals.md +++ b/doc/controllers/subscription-renewals.md @@ -630,7 +630,7 @@ try { # Unpublish Scheduled Renewal Configuration -Returns a scheduled renewal configuration to an editable state. +Restores a scheduled renewal configuration to an editable state. ```php function unpublishScheduledRenewalConfiguration( @@ -816,6 +816,8 @@ try { Adds product and component line items to the scheduled renewal. +If your site has list vs sales pricing enabled, accepts renewal_configuration_item.custom_price.list_price_point_id, validates and persists it; omitted value follows existing/default behavior; with list vs sales pricing disabled, parameter is ignored (no validation/behavioral impact). This functionality is supported in the API, but is not currently supported in SDKs. + ```php function createScheduledRenewalConfigurationItem( int $subscriptionId, @@ -919,6 +921,8 @@ try { Updates an existing configuration item’s pricing and quantity. +If you site has list vs sales pricing enabled, accepts renewal_configuration_item.custom_price.list_price_point_id, validates and persists it; omitted value follows existing/default behavior; with list vs sales pricing disabled, parameter is ignored (no validation/behavioral impact). This functionality is supported in the API, but is not currently supported in SDKs. + ```php function updateScheduledRenewalConfigurationItem( int $subscriptionId, diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 6142d420..701a328d 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -582,7 +582,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | -| `body` | [`?PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | +| `body` | [`?PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows you to pause a Subscription. | ## Response Type @@ -761,7 +761,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription. | -| `body` | [`?PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows to pause a Subscription | +| `body` | [`?PauseRequest`](../../doc/models/pause-request.md) | Body, Optional | Allows you to pause a Subscription. | ## Response Type @@ -1435,26 +1435,26 @@ try { Previews a subscription’s next renewal assessment. Renewal Preview is an object representing a subscription’s next assessment. You can retrieve it to see a snapshot of how much your customer will be charged on their next renewal. -The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). +The "Next Billing" amount and "Next Billing" date are already represented in the UI on each Subscriber's Summary. For more information, see [Subscriber Interface Overview](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). ## Optional Component Fields -This endpoint is particularly useful due to the fact that it will return the computed billing amount for the base product and the components which are in use by a subscriber. +This endpoint is particularly useful because it returns the computed billing amount for the base product and the components which are in use by a subscriber. -By default, the preview will include billing details for all components _at their **current** quantities_. This means: +By default, the preview includes billing details for all components _at their **current** quantities_. This means: * Current `allocated_quantity` for quantity-based components * Current enabled/disabled status for on/off components * Current metered usage `unit_balance` for metered components * Current metric quantity value for events recorded thus far for events-based components -In the above statements, "current" means the quantity or value as of the call to the renewal preview endpoint. We do not predict end-of-period values for components, so metered or events-based usage may be less than it will eventually be at the end of the period. +In the above statements, "current" means the quantity or value as of the call to the renewal preview endpoint. End-of-period values for components are not predicted, so metered or events-based usage may be less than it will eventually be at the end of the period. -Optionally, **you may provide your own custom quantities** for any component to see a billing preview for non-current quantities. This is accomplished by sending a request body with data under the `components` key. See the request body documentation below. +Optionally, **you can provide your own custom quantities** for any component to see a billing preview for non-current quantities. This is accomplished by sending a request body with data under the `components` key. See the request body documentation below. -## Subscription Side Effects +## Preview Behavior -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. +Sending a `POST` request to this endpoint returns preview data without modifying the subscription. This method previews data, but does not log any changes against a subscription. ```php function previewRenewal(int $subscriptionId, ?RenewalPreviewRequest $body = null): RenewalPreviewResponse diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md index a355660b..80eff184 100644 --- a/doc/controllers/subscriptions.md +++ b/doc/controllers/subscriptions.md @@ -34,6 +34,48 @@ Identify an existing customer with `customer_id` or `customer_reference`. Option Select an option from the **Request Examples** drop-down on the right side of the portal to see examples of common scenarios for creating subscriptions. +## List vs Sales Pricing + +When a subscription uses custom pricing as the sales price, you can optionally provide a list price for any item. If omitted, the list price defaults to the sales price. The difference between the list price and sales price is used to calculate implicit discounts, which appear on Invoices and in reporting. List price can also support revenue allocations in [Advanced Revenue](https://docs.maxio.com/hc/en-us/articles/24177001342861-Create-and-Configure-RevenueBooks). + +If your site has list pricing enabled, the API accepts `custom_price.list_price_point_id` for custom pricing, validates and persists it, and returns list price metadata in subscription responses. If list pricing is disabled, this input is ignored and related response fields are omitted. + +When list pricing is enabled: + +- Subscription → Product `product_price_point_list_price_point_id` (integer) +- `product_price_point_list_price_point_handle` (string) +- Subscription Components (when components are included in the response, such as with subscriptions built from components or component serialization paths) `component_id` (integer) +- `price_point_id` (integer) +- `list_price_point_id` (integer) + +When list pricing is disabled: + +- Subscription → Product `product_price_point_list_price_point_id`: omitted +- `product_price_point_list_price_point_handle`: omitted +- Subscription Components `list_price_point_id`: omitted + +This functionality is supported in the API, but is not currently supported in SDKs. + +## Subscriptions can now work independently from the catalog + +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, you can create subscriptions without a `product_id` or `product_handle` using POST /subscriptions, building them entirely from components. + +A valid subscription must include at least one active component with: + +- a positive `allocated_quantity`, +- a positive `unit_balance`, or +- 'enabled: true' (for on/off components) +- a configured metered component + +`component_id` can be provided as a numeric ID or in handle: format. If `trial_interval` and `trial_interval_unit` are included, they are applied at creation. + +In the response, product and product price point fields are null, and component details are returned instead. + +This functionality is supported in the API, but is not currently supported in SDKs. + +## Payment information + +Payment information may be required to create a subscription, depending on the options for the Product being subscribed. See [product options](https://docs.maxio.com/hc/en-us/articles/24261076617869-Edit-Products) for more information. See the [Payments Profile](../../doc/controllers/payment-profiles.md#create-payment-profile) endpoint for details on payment parameters. See the [Subscription Signups](page:introduction/basic-concepts/subscription-signup) article for more information on working with subscriptions in Advanced Billing. ## Payment information @@ -257,7 +299,9 @@ try { # List Subscriptions -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. +Lists subscriptions for a site. Use the query string filters and pagination to control responses from the server. + +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, some subscriptions may not have an associated product. For subscriptions without an associated product, 'product', 'product_price_point_id', and 'product_price_point_type' are returned as 'null'. ## Search for a subscription @@ -281,19 +325,28 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | --- | --- | --- | --- | | `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` | +| `sort` | [`?string(SubscriptionSort)`](../../doc/models/subscription-sort.md) | Query, Optional | The attribute by which to sort

**Default**: `SubscriptionSort::SIGNUP_DATE` | +| `direction` | [`?string(SortingDirection)`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | | `state` | [`?string(SubscriptionStateFilter)`](../../doc/models/subscription-state-filter.md) | Query, Optional | The current state of the subscription | -| `product` | `?int` | Query, Optional | The product id of the subscription. (Note that the product handle cannot be used.) | -| `productPricePointId` | `?int` | Query, Optional | The ID of the product price point. If supplied, product is required | +| `product` | int\|string\|null | Query, Optional | This is a container for one-of cases. | +| `q` | `?string` | Query, Optional | Search string. | +| `qScope` | [`?string(QScope)`](../../doc/models/q-scope.md) | Query, Optional | Scope of fields used by the q search. | +| `customerId` | `?int` | Query, Optional | The Advanced Billing id of the customer. | +| `productPricePointId` | `?int` | Query, Optional | The ID of the product price point. If supplied, product is required. | | `coupon` | `?int` | Query, Optional | The numeric id of the coupon currently applied to the subscription. (This can be found in the URL when editing a coupon. Note that the coupon code cannot be used.) | | `couponCode` | `?string` | Query, Optional | The coupon code currently applied to the subscription | +| `collectionMethod` | [`?string(CollectionMethod1)`](../../doc/models/collection-method-1.md) | Query, Optional | The collection method for the subscription. | +| `brandingThemeId` | `?int` | Query, Optional | Filter subscriptions by the ID of an assigned Branding Theme. Branding Themes is a beta feature. See [Understand Branding Themes](https://docs.maxio.com/hc/en-us/articles/43796895662093-Understand-Branding-Themes#understand-branding-themes-0-0) for more information. | | `dateField` | [`?string(SubscriptionDateField)`](../../doc/models/subscription-date-field.md) | Query, Optional | The type of filter you'd like to apply to your search. Allowed Values: , current_period_ends_at, current_period_starts_at, created_at, activated_at, canceled_at, expires_at, trial_started_at, trial_ended_at, updated_at | | `startDate` | `?DateTime` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns subscriptions with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. Use in query `start_date=2022-07-01`. | | `endDate` | `?DateTime` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns subscriptions with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. Use in query `end_date=2022-08-01`. | | `startDatetime` | `?DateTime` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns subscriptions with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. Use in query `start_datetime=2022-07-01 09:00:05`. | | `endDatetime` | `?DateTime` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns subscriptions with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. Use in query `end_datetime=2022-08-01 10:00:05`. | | `metadata` | `?array` | Query, Optional | The value of the metadata field specified in the parameter. Use in query `metadata[my-field]=value&metadata[other-field]=another_value`. | -| `direction` | [`?string(SortingDirection)`](../../doc/models/sorting-direction.md) | Query, Optional | Controls the order in which results are returned.
Use in query `direction=asc`. | -| `sort` | [`?string(SubscriptionSort)`](../../doc/models/subscription-sort.md) | Query, Optional | The attribute by which to sort

**Default**: `SubscriptionSort::SIGNUP_DATE` | +| `groupStatus` | [`?string(GroupStatus)`](../../doc/models/group-status.md) | Query, Optional | Filter by whether a subscription is in a group. | +| `dunningExemption` | `?bool` | Query, Optional | Filter by dunning exemption status. | +| `paymentGateways` | `?string` | Query, Optional | Comma-separated payment gateway identifiers. | +| `currencies` | `?string` | Query, Optional | Comma-separated currency codes. | | `mInclude` | [`?(string(SubscriptionListInclude)[])`](../../doc/models/subscription-list-include.md) | Query, Optional | Allows including additional data in the response. Use in query: `include[]=self_service_page_token`. | ## Response Type @@ -308,10 +361,6 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) $collect = [ 'page' => 1, 'perPage' => 50, - 'startDate' => DateTimeHelper::fromSimpleDate('2022-07-01'), - 'endDate' => DateTimeHelper::fromSimpleDate('2022-08-01'), - 'startDatetime' => DateTimeHelper::fromRfc3339DateTime('2022-07-01 09:00:05'), - 'endDatetime' => DateTimeHelper::fromRfc3339DateTime('2022-08-01 10:00:05'), 'sort' => SubscriptionSort::SIGNUP_DATE, 'mInclude' => [ SubscriptionListInclude::SELF_SERVICE_PAGE_TOKEN @@ -380,7 +429,9 @@ The server response will not return data under the key/value pair of `next_billi For a subscription using Calendar Billing, setting the next billing date is a bit different. Send the `snap_day` attribute to change the calendar billing date for **a subscription using a product eligible for calendar billing**. -> Note: If you change the product associated with a subscription that contains a `snap_day` and immediately `READ/GET` the subscription data, it will still contain original `snap_day`. The `snap_day` will reset to null on the next billing cycle. This is because a product change is instantaneous and only affects the product associated with a subscription. +> Note: If you change the product associated with a subscription that contains a `snap_day` and immediately READ/GET the subscription data, it will still contain the original `snap_day`. The `snap_day` will be reset to `null` on the next billing cycle. This is because a product change is instantaneous and only affects the product associated with a subscription. + +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, some subscriptions may not have an associated product. For subscriptions without an associated product, `product`, `product_price_point_id`, and `product_price_point_type` are returned as `null`. ```php function updateSubscription(int $subscriptionId, ?UpdateSubscriptionRequest $body = null): SubscriptionResponse @@ -552,6 +603,8 @@ try { Retrieves subscription details. +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, some subscriptions may not have an associated product. For subscriptions without an associated product, 'product', 'product_price_point_id', and 'product_price_point_type' are returned as 'null'. + ## 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. @@ -868,7 +921,7 @@ try { Purges an individual subscription for sites in test mode. -Provide the subscription ID in the url. To confirm, supply the customer ID in the query string `ack` parameter. You may also delete the customer record and/or payment profiles by passing `cascade` parameters. For example, to delete just the customer record, the query params would be: `?ack={customer_id}&cascade[]=customer` +Provide the subscription ID in the URL. To confirm, supply the customer ID in the query string `ack` parameter. You may also delete the customer record and/or payment profiles by passing `cascade` parameters. For example, to delete just the customer record, the query params would be: `?ack={customer_id}&cascade[]=customer` If you need to remove subscriptions from a live site, contact support to discuss your use case. @@ -1017,27 +1070,43 @@ Previews a subscription by POSTing the same JSON or XML as for a subscription cr The "Next Billing" amount and "Next Billing" date are represented in each Subscriber's Summary. -A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction. +This endpoint does not create a subscription; it is meant to serve as a prediction. -For more information, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). +For more information, see [Subscriber Interface Overview](https://maxio.zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). + +## Subscriptions can now work independently from the catalog + +If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog-experience-and-terminology) enabled, you can create subscriptions without a `product_id` or `product_handle` using POST /subscriptions, building them entirely from components. + +A valid subscription must include at least one active component with: + +- a positive `allocated_quantity`, +- a positive `unit_balance`, or +- 'enabled: true' (for on/off components) + +`component_id` can be provided as a numeric ID or in handle: format. If `trial_interval` and `trial_interval_unit` are included, they are applied at creation. + +In the response, product and product price point fields are null, and component details are returned instead. + +This functionality is supported in the API, but is not currently supported in SDKs. ## Taxable Subscriptions -This endpoint will preview taxes applicable to a purchase. In order for taxes to be previewed, the following conditions must be met: +This endpoint previews taxes applicable to a purchase. For taxes to be previewed, the following conditions must be met: + Taxes must be configured on the subscription + The preview must be for the purchase of a taxable product or component, or combination of the two. -+ The subscription payload must contain a full billing or shipping address in order to calculate tax ++ The subscription payload must contain a full billing or shipping address to calculate tax -For more information about creating taxable previews, see our documentation guide on how to create [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes) +For more information about creating taxable previews, see [Taxes](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes). -You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored in Advanced Billing. The billing address and the credit card information are stored together within the payment profile object. Also, you may not send a billing address to Advanced Billing without payment profile information, as the address is stored on the card. +You do **not** need to include a card number to generate tax information when you are previewing a subscription. However, when you actually want to create the subscription, you must include the credit card information if you want the billing address to be stored. The billing address and the credit card information are stored together within the payment profile object. Also, you cannot send a billing address without payment profile information, as the address is stored on the card. You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, pass `skip_billing_manifest_taxes: true` attribute. ## Non-taxable Subscriptions -If you'd like to calculate subscriptions that do not include tax you may leave off the billing information. +If you'd like to calculate subscriptions that do not include tax, you can leave off the billing information. ```php function previewSubscription(?CreateSubscriptionRequest $body = null): SubscriptionPreviewResponse @@ -1430,7 +1499,7 @@ try { Removes a coupon from an existing subscription. -For more information on the expected behavior of removing a coupon from a subscription, see our documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon) +For more information on the expected behavior of removing a coupon from a subscription, see [Coupons and Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions#removing-a-coupon). ```php function removeCouponFromSubscription(int $subscriptionId, ?string $couponCode = null): string @@ -1486,16 +1555,14 @@ try { # Activate Subscription -Activates awaiting signup and trialing subscriptions. This feature is only available on the Relationship Invoicing architecture. Subscriptions in a group may not be activated immediately. - -For details on how the activation works, and how to activate subscriptions through the application, see [activation](#). +Activates awaiting signup and trialing subscriptions. This feature is only available on the Relationship Invoicing architecture. Subscriptions in a group cannot be activated immediately. The `revert_on_failure` parameter controls the behavior upon activation failure. -- If set to `true` and something goes wrong i.e. payment fails, then Advanced Billing will not change the subscription's state. The subscription’s billing period will also remain the same. -- If set to `false` and something goes wrong i.e. payment fails, then Advanced Billing will continue through with the activation and enter an end of life state. For trialing subscriptions, that will either be trial ended (if the trial is no obligation), past due (if the trial has an obligation), or canceled (if the site has no dunning strategy, or has a strategy that says to cancel immediately). For awaiting signup subscriptions, that will always be canceled. +- If set to `true` and something goes wrong i.e. payment fails, the subscription's state does not change. The subscription’s billing period also remains the same. +- If set to `false` and something goes wrong i.e. payment fails, the activation continues and enters an end of life state. For trialing subscriptions, that is either trial ended (if the trial is no obligation), past due (if the trial has an obligation), or canceled (if the site has no dunning strategy, or has a strategy that says to cancel immediately). For awaiting signup subscriptions, that is always canceled. -The default activation failure behavior can be configured per activation attempt, or you may set a default value under Config > Settings > Subscription Activation Settings. +The default activation failure behavior can be configured per activation attempt, or you can set a default value under Config > Settings > Subscription Activation Settings. ## Activation Scenarios @@ -1527,8 +1594,8 @@ The default activation failure behavior can be configured per activation attempt ### Activate Trialing subscription -You can read more about the behavior of trialing subscriptions [here](https://maxio.zendesk.com/hc/en-us/articles/24252155721869-Trialing-Subscriptions). -When the `revert_on_failure` parameter is set to `true`, the subscription's state will remain as Trialing, we will void the invoice from activation and return any prepayments and credits applied to the invoice back to the subscription. +For more information about the behavior of trialing subscriptions, see [Trialing Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24252155721869-Trialing-Subscriptions). +When the `revert_on_failure` parameter is set to `true`, the subscription's state remains Trialing; the invoice from activation is voided, and any prepayments and credits applied to the invoice are returned to the subscription. ```php function activateSubscription( diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md index 31fbaabc..8a77b6c8 100644 --- a/doc/controllers/webhooks.md +++ b/doc/controllers/webhooks.md @@ -82,7 +82,7 @@ try { "last_sent_at": "2016-11-08T16:43:54-05:00", "last_sent_url": "http://requestb.in/11u45x71", "successful": false, - "body": "id=141765032&event=statement_settled&payload[site][id]=31615&payload[site][subdomain]=general-goods&payload[subscription][id]=15100141&payload[subscription][state]=active&payload[subscription][balance_in_cents]=0&payload[customer][id]=14585695&payload[customer][first_name]=Pookie&payload[customer][last_name]=Test&payload[customer][reference]=&payload[customer][organization]=&payload[customer][address]=&payload[customer][address_2]=&payload[customer][city]=&payload[customer][state]=&payload[customer][zip]=&payload[customer][country]=&payload[customer][email]=pookie999%40example.com&payload[customer][phone]=&payload[statement][closed_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][created_at]=2016-11-08%2016%3A22%3A18%20-0500&payload[statement][id]=80168049&payload[statement][opened_at]=2016-11-07%2016%3A22%3A15%20-0500&payload[statement][settled_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][subscription_id]=15100141&payload[statement][updated_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][starting_balance_in_cents]=0&payload[statement][ending_balance_in_cents]=0&payload[statement][total_in_cents]=6400&payload[statement][memo]=We%20thank%20you%20for%20your%20continued%20business!&payload[statement][events][0][id]=346956565&payload[statement][events][0][key]=renewal_success&payload[statement][events][0][message]=Successful%20renewal%20for%20Pookie%20Test's%20subscription%20to%20%2410%20Basic%20Plan&payload[statement][events][1][id]=346956579&payload[statement][events][1][key]=payment_success&payload[statement][events][1][message]=Successful%20payment%20of%20%2464.00%20for%20Pookie%20Test's%20subscription%20to%20%2410%20Basic%20Plan&payload[statement][events][2][id]=347299359&payload[statement][events][2][key]=renewal_success&payload[statement][events][2][message]=Successful%20renewal%20for%20Pookie%20Test's%20subscription%20to%20%2410%20Basic%20Plan&payload[statement][transactions][0][id]=161537343&payload[statement][transactions][0][subscription_id]=15100141&payload[statement][transactions][0][type]=Charge&payload[statement][transactions][0][kind]=baseline&payload[statement][transactions][0][transaction_type]=charge&payload[statement][transactions][0][success]=true&payload[statement][transactions][0][amount_in_cents]=1000&payload[statement][transactions][0][memo]=%2410%20Basic%20Plan%20(11%2F08%2F2016%20-%2011%2F09%2F2016)&payload[statement][transactions][0][created_at]=2016-11-08%2016%3A22%3A18%20-0500&payload[statement][transactions][0][starting_balance_in_cents]=0&payload[statement][transactions][0][ending_balance_in_cents]=1000&payload[statement][transactions][0][gateway_used]=&payload[statement][transactions][0][gateway_transaction_id]=&payload[statement][transactions][0][gateway_order_id]=&payload[statement][transactions][0][payment_id]=161537369&payload[statement][transactions][0][product_id]=3792003&payload[statement][transactions][0][tax_id]=&payload[statement][transactions][0][component_id]=&payload[statement][transactions][0][statement_id]=80168049&payload[statement][transactions][0][customer_id]=14585695&payload[statement][transactions][0][original_amount_in_cents]=&payload[statement][transactions][0][discount_amount_in_cents]=&payload[statement][transactions][0][taxable_amount_in_cents]=&payload[statement][transactions][1][id]=161537344&payload[statement][transactions][1][subscription_id]=15100141&payload[statement][transactions][1][type]=Charge&payload[statement][transactions][1][kind]=quantity_based_component&payload[statement][transactions][1][transaction_type]=charge&payload[statement][transactions][1][success]=true&payload[statement][transactions][1][amount_in_cents]=5400&payload[statement][transactions][1][memo]=Timesheet%20Users%3A%2018%20Timesheet%20Users&payload[statement][transactions][1][created_at]=2016-11-08%2016%3A22%3A18%20-0500&payload[statement][transactions][1][starting_balance_in_cents]=1000&payload[statement][transactions][1][ending_balance_in_cents]=6400&payload[statement][transactions][1][gateway_used]=&payload[statement][transactions][1][gateway_transaction_id]=&payload[statement][transactions][1][gateway_order_id]=&payload[statement][transactions][1][payment_id]=161537369&payload[statement][transactions][1][product_id]=3792003&payload[statement][transactions][1][tax_id]=&payload[statement][transactions][1][component_id]=277221&payload[statement][transactions][1][statement_id]=80168049&payload[statement][transactions][1][customer_id]=14585695&payload[statement][transactions][1][original_amount_in_cents]=&payload[statement][transactions][1][discount_amount_in_cents]=&payload[statement][transactions][1][taxable_amount_in_cents]=&payload[statement][transactions][2][id]=161537369&payload[statement][transactions][2][subscription_id]=15100141&payload[statement][transactions][2][type]=Payment&payload[statement][transactions][2][kind]=&payload[statement][transactions][2][transaction_type]=payment&payload[statement][transactions][2][success]=true&payload[statement][transactions][2][amount_in_cents]=6400&payload[statement][transactions][2][memo]=Pookie%20Test%20-%20%2410%20Basic%20Plan%3A%20Renewal%20payment&payload[statement][transactions][2][created_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][transactions][2][starting_balance_in_cents]=6400&payload[statement][transactions][2][ending_balance_in_cents]=0&payload[statement][transactions][2][gateway_used]=bogus&payload[statement][transactions][2][gateway_transaction_id]=53433&payload[statement][transactions][2][gateway_order_id]=&payload[statement][transactions][2][payment_id]=&payload[statement][transactions][2][product_id]=3792003&payload[statement][transactions][2][tax_id]=&payload[statement][transactions][2][component_id]=&payload[statement][transactions][2][statement_id]=80168049&payload[statement][transactions][2][customer_id]=14585695&payload[statement][transactions][2][card_number]=XXXX-XXXX-XXXX-1&payload[statement][transactions][2][card_expiration]=10%2F2020&payload[statement][transactions][2][card_type]=bogus&payload[statement][transactions][2][refunded_amount_in_cents]=0&payload[product][id]=3792003&payload[product][name]=%2410%20Basic%20Plan&payload[product_family][id]=527890&payload[product_family][name]=Acme%20Projects&payload[payment_profile][id]=10102821&payload[payment_profile][first_name]=Pookie&payload[payment_profile][last_name]=Test&payload[payment_profile][billing_address]=&payload[payment_profile][billing_address_2]=&payload[payment_profile][billing_city]=&payload[payment_profile][billing_country]=&payload[payment_profile][billing_state]=&payload[payment_profile][billing_zip]=&payload[event_id]=347299384", + "body": "id=141765032&event=statement_settled&payload[site][id]=31615&payload[site][subdomain]=general-goods&payload[subscription][id]=15100141&payload[subscription][state]=active&payload[subscription][balance_in_cents]=0&payload[customer][id]=14585695&payload[customer][first_name]=Alan&payload[customer][last_name]=Test&payload[customer][reference]=&payload[customer][organization]=&payload[customer][address]=&payload[customer][address_2]=&payload[customer][city]=&payload[customer][state]=&payload[customer][zip]=&payload[customer][country]=&payload[customer][email]=alan999%40example.com&payload[customer][phone]=&payload[statement][closed_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][created_at]=2016-11-08%2016%3A22%3A18%20-0500&payload[statement][id]=80168049&payload[statement][opened_at]=2016-11-07%2016%3A22%3A15%20-0500&payload[statement][settled_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][subscription_id]=15100141&payload[statement][updated_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][starting_balance_in_cents]=0&payload[statement][ending_balance_in_cents]=0&payload[statement][total_in_cents]=6400&payload[statement][memo]=We%20thank%20you%20for%20your%20continued%20business!&payload[statement][events][0][id]=346956565&payload[statement][events][0][key]=renewal_success&payload[statement][events][0][message]=Successful%20renewal%20for%20Alan%20Test's%20subscription%20to%20%2410%20Basic%20Plan&payload[statement][events][1][id]=346956579&payload[statement][events][1][key]=payment_success&payload[statement][events][1][message]=Successful%20payment%20of%20%2464.00%20for%20Alan%20Test's%20subscription%20to%20%2410%20Basic%20Plan&payload[statement][events][2][id]=347299359&payload[statement][events][2][key]=renewal_success&payload[statement][events][2][message]=Successful%20renewal%20for%20Alan%20Test's%20subscription%20to%20%2410%20Basic%20Plan&payload[statement][transactions][0][id]=161537343&payload[statement][transactions][0][subscription_id]=15100141&payload[statement][transactions][0][type]=Charge&payload[statement][transactions][0][kind]=baseline&payload[statement][transactions][0][transaction_type]=charge&payload[statement][transactions][0][success]=true&payload[statement][transactions][0][amount_in_cents]=1000&payload[statement][transactions][0][memo]=%2410%20Basic%20Plan%20(11%2F08%2F2016%20-%2011%2F09%2F2016)&payload[statement][transactions][0][created_at]=2016-11-08%2016%3A22%3A18%20-0500&payload[statement][transactions][0][starting_balance_in_cents]=0&payload[statement][transactions][0][ending_balance_in_cents]=1000&payload[statement][transactions][0][gateway_used]=&payload[statement][transactions][0][gateway_transaction_id]=&payload[statement][transactions][0][gateway_order_id]=&payload[statement][transactions][0][payment_id]=161537369&payload[statement][transactions][0][product_id]=3792003&payload[statement][transactions][0][tax_id]=&payload[statement][transactions][0][component_id]=&payload[statement][transactions][0][statement_id]=80168049&payload[statement][transactions][0][customer_id]=14585695&payload[statement][transactions][0][original_amount_in_cents]=&payload[statement][transactions][0][discount_amount_in_cents]=&payload[statement][transactions][0][taxable_amount_in_cents]=&payload[statement][transactions][1][id]=161537344&payload[statement][transactions][1][subscription_id]=15100141&payload[statement][transactions][1][type]=Charge&payload[statement][transactions][1][kind]=quantity_based_component&payload[statement][transactions][1][transaction_type]=charge&payload[statement][transactions][1][success]=true&payload[statement][transactions][1][amount_in_cents]=5400&payload[statement][transactions][1][memo]=Timesheet%20Users%3A%2018%20Timesheet%20Users&payload[statement][transactions][1][created_at]=2016-11-08%2016%3A22%3A18%20-0500&payload[statement][transactions][1][starting_balance_in_cents]=1000&payload[statement][transactions][1][ending_balance_in_cents]=6400&payload[statement][transactions][1][gateway_used]=&payload[statement][transactions][1][gateway_transaction_id]=&payload[statement][transactions][1][gateway_order_id]=&payload[statement][transactions][1][payment_id]=161537369&payload[statement][transactions][1][product_id]=3792003&payload[statement][transactions][1][tax_id]=&payload[statement][transactions][1][component_id]=277221&payload[statement][transactions][1][statement_id]=80168049&payload[statement][transactions][1][customer_id]=14585695&payload[statement][transactions][1][original_amount_in_cents]=&payload[statement][transactions][1][discount_amount_in_cents]=&payload[statement][transactions][1][taxable_amount_in_cents]=&payload[statement][transactions][2][id]=161537369&payload[statement][transactions][2][subscription_id]=15100141&payload[statement][transactions][2][type]=Payment&payload[statement][transactions][2][kind]=&payload[statement][transactions][2][transaction_type]=payment&payload[statement][transactions][2][success]=true&payload[statement][transactions][2][amount_in_cents]=6400&payload[statement][transactions][2][memo]=Alan%20Test%20-%20%2410%20Basic%20Plan%3A%20Renewal%20payment&payload[statement][transactions][2][created_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[statement][transactions][2][starting_balance_in_cents]=6400&payload[statement][transactions][2][ending_balance_in_cents]=0&payload[statement][transactions][2][gateway_used]=bogus&payload[statement][transactions][2][gateway_transaction_id]=53433&payload[statement][transactions][2][gateway_order_id]=&payload[statement][transactions][2][payment_id]=&payload[statement][transactions][2][product_id]=3792003&payload[statement][transactions][2][tax_id]=&payload[statement][transactions][2][component_id]=&payload[statement][transactions][2][statement_id]=80168049&payload[statement][transactions][2][customer_id]=14585695&payload[statement][transactions][2][card_number]=XXXX-XXXX-XXXX-1&payload[statement][transactions][2][card_expiration]=10%2F2020&payload[statement][transactions][2][card_type]=bogus&payload[statement][transactions][2][refunded_amount_in_cents]=0&payload[product][id]=3792003&payload[product][name]=%2410%20Basic%20Plan&payload[product_family][id]=527890&payload[product_family][name]=Acme%20Projects&payload[payment_profile][id]=10102821&payload[payment_profile][first_name]=Alan&payload[payment_profile][last_name]=Test&payload[payment_profile][billing_address]=&payload[payment_profile][billing_address_2]=&payload[payment_profile][billing_city]=&payload[payment_profile][billing_country]=&payload[payment_profile][billing_state]=&payload[payment_profile][billing_zip]=&payload[event_id]=347299384", "signature": "7c606ec4628ce75ec46e284097ce163a", "signature_hmac_sha_256": "40f25e83dd324508bb2149e3e525821922fb210535ebfbfa81e7ab951996b41d" } @@ -98,7 +98,7 @@ try { "last_sent_at": "2016-11-08T16:43:54-05:00", "last_sent_url": "http://requestb.in/11u45x71", "successful": false, - "body": "id=141765008&event=payment_success&payload[site][id]=31615&payload[site][subdomain]=general-goods&payload[subscription][id]=15100141&payload[subscription][state]=active&payload[subscription][trial_started_at]=&payload[subscription][trial_ended_at]=&payload[subscription][activated_at]=2016-11-04%2017%3A06%3A43%20-0400&payload[subscription][created_at]=2016-11-04%2017%3A06%3A42%20-0400&payload[subscription][updated_at]=2016-11-08%2016%3A22%3A22%20-0500&payload[subscription][expires_at]=&payload[subscription][balance_in_cents]=0&payload[subscription][current_period_ends_at]=2016-11-09%2016%3A06%3A42%20-0500&payload[subscription][next_assessment_at]=2016-11-09%2016%3A06%3A42%20-0500&payload[subscription][canceled_at]=&payload[subscription][cancellation_message]=&payload[subscription][next_product_id]=&payload[subscription][cancel_at_end_of_period]=false&payload[subscription][payment_collection_method]=automatic&payload[subscription][snap_day]=&payload[subscription][cancellation_method]=&payload[subscription][current_period_started_at]=2016-11-08%2016%3A06%3A42%20-0500&payload[subscription][previous_state]=active&payload[subscription][signup_payment_id]=161034048&payload[subscription][signup_revenue]=64.00&payload[subscription][delayed_cancel_at]=&payload[subscription][coupon_code]=&payload[subscription][total_revenue_in_cents]=32000&payload[subscription][product_price_in_cents]=1000&payload[subscription][product_version_number]=7&payload[subscription][payment_type]=credit_card&payload[subscription][referral_code]=pggn84&payload[subscription][coupon_use_count]=&payload[subscription][coupon_uses_allowed]=&payload[subscription][customer][id]=14585695&payload[subscription][customer][first_name]=Test&payload[subscription][customer][last_name]=Test&payload[subscription][customer][organization]=&payload[subscription][customer][email]=pookie999%40example.com&payload[subscription][customer][created_at]=2016-11-04%2017%3A06%3A42%20-0400&payload[subscription][customer][updated_at]=2016-11-04%2017%3A06%3A45%20-0400&payload[subscription][customer][reference]=&payload[subscription][customer][address]=&payload[subscription][customer][address_2]=&payload[subscription][customer][city]=&payload[subscription][customer][state]=&payload[subscription][customer][zip]=&payload[subscription][customer][country]=&payload[subscription][customer][phone]=&payload[subscription][customer][portal_invite_last_sent_at]=2016-11-04%2017%3A06%3A45%20-0400&payload[subscription][customer][portal_invite_last_accepted_at]=&payload[subscription][customer][verified]=false&payload[subscription][customer][portal_customer_created_at]=2016-11-04%2017%3A06%3A45%20-0400&payload[subscription][customer][cc_emails]=&payload[subscription][product][id]=3792003&payload[subscription][product][name]=%2410%20Basic%20Plan&payload[subscription][product][handle]=basic&payload[subscription][product][description]=lorem%20ipsum&payload[subscription][product][accounting_code]=basic&payload[subscription][product][request_credit_card]=false&payload[subscription][product][expiration_interval]=&payload[subscription][product][expiration_interval_unit]=never&payload[subscription][product][created_at]=2016-03-24%2013%3A38%3A39%20-0400&payload[subscription][product][updated_at]=2016-11-03%2013%3A03%3A05%20-0400&payload[subscription][product][price_in_cents]=1000&payload[subscription][product][interval]=1&payload[subscription][product][interval_unit]=day&payload[subscription][product][initial_charge_in_cents]=&payload[subscription][product][trial_price_in_cents]=&payload[subscription][product][trial_interval]=&payload[subscription][product][trial_interval_unit]=month&payload[subscription][product][archived_at]=&payload[subscription][product][require_credit_card]=false&payload[subscription][product][return_params]=&payload[subscription][product][taxable]=false&payload[subscription][product][update_return_url]=&payload[subscription][product][initial_charge_after_trial]=false&payload[subscription][product][version_number]=7&payload[subscription][product][update_return_params]=&payload[subscription][product][product_family][id]=527890&payload[subscription][product][product_family][name]=Acme%20Projects&payload[subscription][product][product_family][description]=&payload[subscription][product][product_family][handle]=billing-plans&payload[subscription][product][product_family][accounting_code]=&payload[subscription][product][public_signup_pages][id]=281054&payload[subscription][product][public_signup_pages][return_url]=http%3A%2F%2Fwww.example.com%3Fsuccessfulsignup&payload[subscription][product][public_signup_pages][return_params]=&payload[subscription][product][public_signup_pages][url]=https%3A%2F%2Fgeneral-goods.chargify.com%2Fsubscribe%2Fkqvmfrbgd89q%2Fbasic&payload[subscription][product][public_signup_pages][id]=281240&payload[subscription][product][public_signup_pages][return_url]=&payload[subscription][product][public_signup_pages][return_params]=&payload[subscription][product][public_signup_pages][url]=https%3A%2F%2Fgeneral-goods.chargify.com%2Fsubscribe%2Fdkffht5dxfd8%2Fbasic&payload[subscription][product][public_signup_pages][id]=282694&payload[subscription][product][public_signup_pages][return_url]=&payload[subscription][product][public_signup_pages][return_params]=&payload[subscription][product][public_signup_pages][url]=https%3A%2F%2Fgeneral-goods.chargify.com%2Fsubscribe%2Fjwffwgdd95s8%2Fbasic&payload[subscription][credit_card][id]=10102821&payload[subscription][credit_card][first_name]=Pookie&payload[subscription][credit_card][last_name]=Test&payload[subscription][credit_card][masked_card_number]=XXXX-XXXX-XXXX-1&payload[subscription][credit_card][card_type]=bogus&payload[subscription][credit_card][expiration_month]=10&payload[subscription][credit_card][expiration_year]=2020&payload[subscription][credit_card][customer_id]=14585695&payload[subscription][credit_card][current_vault]=bogus&payload[subscription][credit_card][vault_token]=1&payload[subscription][credit_card][billing_address]=&payload[subscription][credit_card][billing_city]=&payload[subscription][credit_card][billing_state]=&payload[subscription][credit_card][billing_zip]=&payload[subscription][credit_card][billing_country]=&payload[subscription][credit_card][customer_vault_token]=&payload[subscription][credit_card][billing_address_2]=&payload[subscription][credit_card][payment_type]=credit_card&payload[subscription][credit_card][site_gateway_setting_id]=&payload[subscription][credit_card][gateway_handle]=&payload[transaction][id]=161537369&payload[transaction][subscription_id]=15100141&payload[transaction][type]=Payment&payload[transaction][kind]=&payload[transaction][transaction_type]=payment&payload[transaction][success]=true&payload[transaction][amount_in_cents]=6400&payload[transaction][memo]=Pookie%20Test%20-%20%2410%20Basic%20Plan%3A%20Renewal%20payment&payload[transaction][created_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[transaction][starting_balance_in_cents]=6400&payload[transaction][ending_balance_in_cents]=0&payload[transaction][gateway_used]=bogus&payload[transaction][gateway_transaction_id]=53433&payload[transaction][gateway_response_code]=&payload[transaction][gateway_order_id]=&payload[transaction][payment_id]=&payload[transaction][product_id]=3792003&payload[transaction][tax_id]=&payload[transaction][component_id]=&payload[transaction][statement_id]=80168049&payload[transaction][customer_id]=14585695&payload[transaction][card_number]=XXXX-XXXX-XXXX-1&payload[transaction][card_expiration]=10%2F2020&payload[transaction][card_type]=bogus&payload[transaction][refunded_amount_in_cents]=0&payload[transaction][invoice_id]=&payload[event_id]=347299364", + "body": "id=141765008&event=payment_success&payload[site][id]=31615&payload[site][subdomain]=general-goods&payload[subscription][id]=15100141&payload[subscription][state]=active&payload[subscription][trial_started_at]=&payload[subscription][trial_ended_at]=&payload[subscription][activated_at]=2016-11-04%2017%3A06%3A43%20-0400&payload[subscription][created_at]=2016-11-04%2017%3A06%3A42%20-0400&payload[subscription][updated_at]=2016-11-08%2016%3A22%3A22%20-0500&payload[subscription][expires_at]=&payload[subscription][balance_in_cents]=0&payload[subscription][current_period_ends_at]=2016-11-09%2016%3A06%3A42%20-0500&payload[subscription][next_assessment_at]=2016-11-09%2016%3A06%3A42%20-0500&payload[subscription][canceled_at]=&payload[subscription][cancellation_message]=&payload[subscription][next_product_id]=&payload[subscription][cancel_at_end_of_period]=false&payload[subscription][payment_collection_method]=automatic&payload[subscription][snap_day]=&payload[subscription][cancellation_method]=&payload[subscription][current_period_started_at]=2016-11-08%2016%3A06%3A42%20-0500&payload[subscription][previous_state]=active&payload[subscription][signup_payment_id]=161034048&payload[subscription][signup_revenue]=64.00&payload[subscription][delayed_cancel_at]=&payload[subscription][coupon_code]=&payload[subscription][total_revenue_in_cents]=32000&payload[subscription][product_price_in_cents]=1000&payload[subscription][product_version_number]=7&payload[subscription][payment_type]=credit_card&payload[subscription][referral_code]=pggn84&payload[subscription][coupon_use_count]=&payload[subscription][coupon_uses_allowed]=&payload[subscription][customer][id]=14585695&payload[subscription][customer][first_name]=Test&payload[subscription][customer][last_name]=Test&payload[subscription][customer][organization]=&payload[subscription][customer][email]=alan999%40example.com&payload[subscription][customer][created_at]=2016-11-04%2017%3A06%3A42%20-0400&payload[subscription][customer][updated_at]=2016-11-04%2017%3A06%3A45%20-0400&payload[subscription][customer][reference]=&payload[subscription][customer][address]=&payload[subscription][customer][address_2]=&payload[subscription][customer][city]=&payload[subscription][customer][state]=&payload[subscription][customer][zip]=&payload[subscription][customer][country]=&payload[subscription][customer][phone]=&payload[subscription][customer][portal_invite_last_sent_at]=2016-11-04%2017%3A06%3A45%20-0400&payload[subscription][customer][portal_invite_last_accepted_at]=&payload[subscription][customer][verified]=false&payload[subscription][customer][portal_customer_created_at]=2016-11-04%2017%3A06%3A45%20-0400&payload[subscription][customer][cc_emails]=&payload[subscription][product][id]=3792003&payload[subscription][product][name]=%2410%20Basic%20Plan&payload[subscription][product][handle]=basic&payload[subscription][product][description]=lorem%20ipsum&payload[subscription][product][accounting_code]=basic&payload[subscription][product][request_credit_card]=false&payload[subscription][product][expiration_interval]=&payload[subscription][product][expiration_interval_unit]=never&payload[subscription][product][created_at]=2016-03-24%2013%3A38%3A39%20-0400&payload[subscription][product][updated_at]=2016-11-03%2013%3A03%3A05%20-0400&payload[subscription][product][price_in_cents]=1000&payload[subscription][product][interval]=1&payload[subscription][product][interval_unit]=day&payload[subscription][product][initial_charge_in_cents]=&payload[subscription][product][trial_price_in_cents]=&payload[subscription][product][trial_interval]=&payload[subscription][product][trial_interval_unit]=month&payload[subscription][product][archived_at]=&payload[subscription][product][require_credit_card]=false&payload[subscription][product][return_params]=&payload[subscription][product][taxable]=false&payload[subscription][product][update_return_url]=&payload[subscription][product][initial_charge_after_trial]=false&payload[subscription][product][version_number]=7&payload[subscription][product][update_return_params]=&payload[subscription][product][product_family][id]=527890&payload[subscription][product][product_family][name]=Acme%20Projects&payload[subscription][product][product_family][description]=&payload[subscription][product][product_family][handle]=billing-plans&payload[subscription][product][product_family][accounting_code]=&payload[subscription][product][public_signup_pages][id]=281054&payload[subscription][product][public_signup_pages][return_url]=http%3A%2F%2Fwww.example.com%3Fsuccessfulsignup&payload[subscription][product][public_signup_pages][return_params]=&payload[subscription][product][public_signup_pages][url]=https%3A%2F%2Fgeneral-goods.chargify.com%2Fsubscribe%2Fkqvmfrbgd89q%2Fbasic&payload[subscription][product][public_signup_pages][id]=281240&payload[subscription][product][public_signup_pages][return_url]=&payload[subscription][product][public_signup_pages][return_params]=&payload[subscription][product][public_signup_pages][url]=https%3A%2F%2Fgeneral-goods.chargify.com%2Fsubscribe%2Fdkffht5dxfd8%2Fbasic&payload[subscription][product][public_signup_pages][id]=282694&payload[subscription][product][public_signup_pages][return_url]=&payload[subscription][product][public_signup_pages][return_params]=&payload[subscription][product][public_signup_pages][url]=https%3A%2F%2Fgeneral-goods.chargify.com%2Fsubscribe%2Fjwffwgdd95s8%2Fbasic&payload[subscription][credit_card][id]=10102821&payload[subscription][credit_card][first_name]=Alan&payload[subscription][credit_card][last_name]=Test&payload[subscription][credit_card][masked_card_number]=XXXX-XXXX-XXXX-1&payload[subscription][credit_card][card_type]=bogus&payload[subscription][credit_card][expiration_month]=10&payload[subscription][credit_card][expiration_year]=2020&payload[subscription][credit_card][customer_id]=14585695&payload[subscription][credit_card][current_vault]=bogus&payload[subscription][credit_card][vault_token]=1&payload[subscription][credit_card][billing_address]=&payload[subscription][credit_card][billing_city]=&payload[subscription][credit_card][billing_state]=&payload[subscription][credit_card][billing_zip]=&payload[subscription][credit_card][billing_country]=&payload[subscription][credit_card][customer_vault_token]=&payload[subscription][credit_card][billing_address_2]=&payload[subscription][credit_card][payment_type]=credit_card&payload[subscription][credit_card][site_gateway_setting_id]=&payload[subscription][credit_card][gateway_handle]=&payload[transaction][id]=161537369&payload[transaction][subscription_id]=15100141&payload[transaction][type]=Payment&payload[transaction][kind]=&payload[transaction][transaction_type]=payment&payload[transaction][success]=true&payload[transaction][amount_in_cents]=6400&payload[transaction][memo]=Alan%20Test%20-%20%2410%20Basic%20Plan%3A%20Renewal%20payment&payload[transaction][created_at]=2016-11-08%2016%3A22%3A20%20-0500&payload[transaction][starting_balance_in_cents]=6400&payload[transaction][ending_balance_in_cents]=0&payload[transaction][gateway_used]=bogus&payload[transaction][gateway_transaction_id]=53433&payload[transaction][gateway_response_code]=&payload[transaction][gateway_order_id]=&payload[transaction][payment_id]=&payload[transaction][product_id]=3792003&payload[transaction][tax_id]=&payload[transaction][component_id]=&payload[transaction][statement_id]=80168049&payload[transaction][customer_id]=14585695&payload[transaction][card_number]=XXXX-XXXX-XXXX-1&payload[transaction][card_expiration]=10%2F2020&payload[transaction][card_type]=bogus&payload[transaction][refunded_amount_in_cents]=0&payload[transaction][invoice_id]=&payload[event_id]=347299364", "signature": "fbcf2f6be579f9658cff90c4373e0ca2", "signature_hmac_sha_256": "db96654f5456c5460062feb944ac8bb1418f9d181ae04a8ed982fe9ffdca8de1" } @@ -229,7 +229,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | -| `body` | [`?CreateOrUpdateEndpointRequest`](../../doc/models/create-or-update-endpoint-request.md) | Body, Optional | Used to Create or Update Endpoint | +| `body` | [`?CreateOrUpdateEndpointRequest`](../../doc/models/create-or-update-endpoint-request.md) | Body, Optional | Used to Create or Update Endpoint. | ## Response Type @@ -291,7 +291,7 @@ try { # List Endpoints -Returns created endpoints for a site. +Lists endpoints configured for a site. ```php function listEndpoints(): array @@ -372,7 +372,7 @@ This endpoint requires [BasicAuth](../../doc/auth/basic-authentication.md) | Parameter | Type | Tags | Description | | --- | --- | --- | --- | | `endpointId` | `int` | Template, Required | The Advanced Billing id for the endpoint that should be updated | -| `body` | [`?CreateOrUpdateEndpointRequest`](../../doc/models/create-or-update-endpoint-request.md) | Body, Optional | Used to Create or Update Endpoint | +| `body` | [`?CreateOrUpdateEndpointRequest`](../../doc/models/create-or-update-endpoint-request.md) | Body, Optional | Used to Create or Update Endpoint. | ## Response Type diff --git a/doc/models/account-balance.md b/doc/models/account-balance.md index a2027d20..92211c02 100644 --- a/doc/models/account-balance.md +++ b/doc/models/account-balance.md @@ -13,13 +13,15 @@ | `automaticBalanceInCents` | `?int` | Optional | The automatic balance in cents. | getAutomaticBalanceInCents(): ?int | setAutomaticBalanceInCents(?int automaticBalanceInCents): void | | `remittanceBalanceInCents` | `?int` | Optional | The remittance balance in cents. | getRemittanceBalanceInCents(): ?int | setRemittanceBalanceInCents(?int remittanceBalanceInCents): void | -## Example (as JSON) - -```json -{ - "balance_in_cents": 16, - "automatic_balance_in_cents": 226, - "remittance_balance_in_cents": 62 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AccountBalanceBuilder; + +$accountBalance = AccountBalanceBuilder::init() + ->balanceInCents(242) + ->automaticBalanceInCents(0) + ->remittanceBalanceInCents(32) + ->build(); ``` diff --git a/doc/models/account-balances.md b/doc/models/account-balances.md index 261eb954..65fd1436 100644 --- a/doc/models/account-balances.md +++ b/doc/models/account-balances.md @@ -9,41 +9,54 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `openInvoices` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the sum of the subscription's open, payable invoices. | getOpenInvoices(): ?AccountBalance | setOpenInvoices(?AccountBalance openInvoices): void | -| `pendingInvoices` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the sum of the subscription's pending, payable invoices. | getPendingInvoices(): ?AccountBalance | setPendingInvoices(?AccountBalance pendingInvoices): void | +| `openInvoices` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the sum of the subscription's open, payable invoices. | getOpenInvoices(): ?AccountBalance | setOpenInvoices(?AccountBalance openInvoices): void | +| `pendingInvoices` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the sum of the subscription's pending, payable invoices. | getPendingInvoices(): ?AccountBalance | setPendingInvoices(?AccountBalance pendingInvoices): void | | `pendingDiscounts` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the subscription's Pending Discount account. | getPendingDiscounts(): ?AccountBalance | setPendingDiscounts(?AccountBalance pendingDiscounts): void | | `serviceCredits` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the subscription's Service Credit account. | getServiceCredits(): ?AccountBalance | setServiceCredits(?AccountBalance serviceCredits): void | | `prepayments` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | The balance, in cents, of the subscription's Prepayment account. | getPrepayments(): ?AccountBalance | setPrepayments(?AccountBalance prepayments): void | -## Example (as JSON) - -```json -{ - "open_invoices": { - "balance_in_cents": 40, - "automatic_balance_in_cents": 202, - "remittance_balance_in_cents": 170 - }, - "pending_invoices": { - "balance_in_cents": 0, - "automatic_balance_in_cents": 242, - "remittance_balance_in_cents": 46 - }, - "pending_discounts": { - "balance_in_cents": 88, - "automatic_balance_in_cents": 154, - "remittance_balance_in_cents": 134 - }, - "service_credits": { - "balance_in_cents": 84, - "automatic_balance_in_cents": 70, - "remittance_balance_in_cents": 38 - }, - "prepayments": { - "balance_in_cents": 192, - "automatic_balance_in_cents": 178, - "remittance_balance_in_cents": 146 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AccountBalancesBuilder; +use AdvancedBillingLib\Models\Builders\AccountBalanceBuilder; + +$accountBalances = AccountBalancesBuilder::init() + ->openInvoices( + AccountBalanceBuilder::init() + ->balanceInCents(40) + ->automaticBalanceInCents(202) + ->remittanceBalanceInCents(170) + ->build() + ) + ->pendingInvoices( + AccountBalanceBuilder::init() + ->balanceInCents(0) + ->automaticBalanceInCents(242) + ->remittanceBalanceInCents(46) + ->build() + ) + ->pendingDiscounts( + AccountBalanceBuilder::init() + ->balanceInCents(88) + ->automaticBalanceInCents(154) + ->remittanceBalanceInCents(134) + ->build() + ) + ->serviceCredits( + AccountBalanceBuilder::init() + ->balanceInCents(84) + ->automaticBalanceInCents(70) + ->remittanceBalanceInCents(38) + ->build() + ) + ->prepayments( + AccountBalanceBuilder::init() + ->balanceInCents(192) + ->automaticBalanceInCents(178) + ->remittanceBalanceInCents(146) + ->build() + ) + ->build(); ``` diff --git a/doc/models/ach-agreement.md b/doc/models/ach-agreement.md index e7d6abae..fb97b6e6 100644 --- a/doc/models/ach-agreement.md +++ b/doc/models/ach-agreement.md @@ -16,14 +16,16 @@ | `authorizerLastName` | `?string` | Optional | (Required when providing ACH agreement params) The last name of the person authorizing the ACH agreement. | getAuthorizerLastName(): ?string | setAuthorizerLastName(?string authorizerLastName): void | | `ipAddress` | `?string` | Optional | (Required when providing ACH agreement params) The IP address of the person authorizing the ACH agreement. | getIpAddress(): ?string | setIpAddress(?string ipAddress): void | -## Example (as JSON) - -```json -{ - "agreement_terms": "agreement_terms4", - "authorizer_first_name": "authorizer_first_name2", - "authorizer_last_name": "authorizer_last_name2", - "ip_address": "ip_address2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ACHAgreementBuilder; + +$aCHAgreement = ACHAgreementBuilder::init() + ->agreementTerms('agreement_terms4') + ->authorizerFirstName('authorizer_first_name2') + ->authorizerLastName('authorizer_last_name2') + ->ipAddress('ip_address2') + ->build(); ``` diff --git a/doc/models/activate-event-based-component.md b/doc/models/activate-event-based-component.md index e9e68f80..b307b78e 100644 --- a/doc/models/activate-event-based-component.md +++ b/doc/models/activate-event-based-component.md @@ -13,33 +13,52 @@ | `billingSchedule` | [`?BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | Billing schedule settings for component allocations or usages on multi-frequency subscriptions. Use this to start a component's billing period on a custom date instead of aligning with the product charge schedule. | 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 -{ - "price_point_id": 44, - "billing_schedule": { - "initial_billing_at": "2016-03-13" - }, - "custom_price": { - "tax_included": false, - "pricing_scheme": "stairstep", - "interval": 66, - "interval_unit": "day", - "list_price_point_id": 174, - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ActivateEventBasedComponentBuilder; +use AdvancedBillingLib\Models\Builders\BillingScheduleBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\IntervalUnit; + +$activateEventBasedComponent = ActivateEventBasedComponentBuilder::init() + ->pricePointId(68) + ->billingSchedule( + BillingScheduleBuilder::init() + ->initialBillingAt(DateTimeHelper::fromSimpleDate('2016-03-13')) + ->build() + ) + ->customPrice( + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(66) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(174) + ->build() + ) + ->build(); ``` diff --git a/doc/models/activate-subscription-request.md b/doc/models/activate-subscription-request.md index d6543ce7..8c960b35 100644 --- a/doc/models/activate-subscription-request.md +++ b/doc/models/activate-subscription-request.md @@ -9,13 +9,15 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `revertOnFailure` | `?bool` | Optional | You may choose how to handle the activation failure. `true` means do not change the subscription’s state and billing period. `false` means to continue through with the activation and enter an end of life state. If this parameter is omitted or `null` is passed it will default to value set in the site settings (default: `true`) | getRevertOnFailure(): ?bool | setRevertOnFailure(?bool revertOnFailure): void | +| `revertOnFailure` | `?bool` | Optional | You may choose how to handle the activation failure. `true` means do not change the subscription’s state and billing period. `false` means to continue through with the activation and enter an end-of-life state. If this parameter is omitted or `null` is passed it will default to the value set in the site settings (default: `true`). | getRevertOnFailure(): ?bool | setRevertOnFailure(?bool revertOnFailure): void | -## Example (as JSON) +## Example -```json -{ - "revert_on_failure": false -} +```php +use AdvancedBillingLib\Models\Builders\ActivateSubscriptionRequestBuilder; + +$activateSubscriptionRequest = ActivateSubscriptionRequestBuilder::init() + ->revertOnFailure(false) + ->build(); ``` diff --git a/doc/models/add-coupons-request.md b/doc/models/add-coupons-request.md index bb1b2b17..5392dd22 100644 --- a/doc/models/add-coupons-request.md +++ b/doc/models/add-coupons-request.md @@ -11,14 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `codes` | `?(string[])` | Optional | - | getCodes(): ?array | setCodes(?array codes): void | -## Example (as JSON) - -```json -{ - "codes": [ - "codes0", - "codes1" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AddCouponsRequestBuilder; + +$addCouponsRequest = AddCouponsRequestBuilder::init() + ->codes( + [ + 'codes6', + 'codes7' + ] + ) + ->build(); ``` diff --git a/doc/models/add-subscription-to-a-group.md b/doc/models/add-subscription-to-a-group.md index 1afd04fb..343a7fc2 100644 --- a/doc/models/add-subscription-to-a-group.md +++ b/doc/models/add-subscription-to-a-group.md @@ -11,21 +11,33 @@ | --- | --- | --- | --- | --- | --- | | `group` | [`?GroupSettings`](../../doc/models/group-settings.md) | Optional | - | getGroup(): ?GroupSettings | setGroup(?GroupSettings group): void | -## Example (as JSON) - -```json -{ - "group": { - "target": { - "type": "parent", - "id": 236 - }, - "billing": { - "accrue": false, - "align_date": false, - "prorate": false - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AddSubscriptionToAGroupBuilder; +use AdvancedBillingLib\Models\Builders\GroupSettingsBuilder; +use AdvancedBillingLib\Models\Builders\GroupTargetBuilder; +use AdvancedBillingLib\Models\GroupTargetType; +use AdvancedBillingLib\Models\Builders\GroupBillingBuilder; + +$addSubscriptionToAGroup = AddSubscriptionToAGroupBuilder::init() + ->group( + GroupSettingsBuilder::init( + GroupTargetBuilder::init( + GroupTargetType::PARENT_ + ) + ->id(236) + ->build() + ) + ->billing( + GroupBillingBuilder::init() + ->accrue(false) + ->alignDate(false) + ->prorate(false) + ->build() + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/address-change.md b/doc/models/address-change.md index f7be7370..46fcfabe 100644 --- a/doc/models/address-change.md +++ b/doc/models/address-change.md @@ -12,24 +12,27 @@ | `before` | [`InvoiceAddress`](../../doc/models/invoice-address.md) | Required | - | getBefore(): InvoiceAddress | setBefore(InvoiceAddress before): void | | `after` | [`InvoiceAddress`](../../doc/models/invoice-address.md) | Required | - | getAfter(): InvoiceAddress | setAfter(InvoiceAddress after): void | -## Example (as JSON) - -```json -{ - "before": { - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state6", - "zip": "zip4" - }, - "after": { - "street": "street2", - "line2": "line26", - "city": "city8", - "state": "state2", - "zip": "zip4" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AddressChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceAddressBuilder; + +$addressChange = AddressChangeBuilder::init( + InvoiceAddressBuilder::init() + ->street('street0') + ->line2('line24') + ->city('city0') + ->state('state6') + ->zip('zip4') + ->build(), + InvoiceAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city8') + ->state('state2') + ->zip('zip4') + ->build() +)->build(); ``` diff --git a/doc/models/agreement-acceptance.md b/doc/models/agreement-acceptance.md index 7f69640b..55ef38b6 100644 --- a/doc/models/agreement-acceptance.md +++ b/doc/models/agreement-acceptance.md @@ -12,21 +12,23 @@ Required when creating a subscription with Maxio Payments. | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `ipAddress` | `?string` | Optional | Required when providing agreement acceptance params. | getIpAddress(): ?string | setIpAddress(?string ipAddress): void | -| `termsUrl` | `?string` | Optional | Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params. | getTermsUrl(): ?string | setTermsUrl(?string termsUrl): void | +| `termsUrl` | `?string` | Optional | Required when creating a subscription with Maxio Payments. Either terms_url or privacy_policy_url is required when providing agreement_acceptance params. | getTermsUrl(): ?string | setTermsUrl(?string termsUrl): void | | `privacyPolicyUrl` | `?string` | Optional | - | getPrivacyPolicyUrl(): ?string | setPrivacyPolicyUrl(?string privacyPolicyUrl): void | | `returnRefundPolicyUrl` | `?string` | Optional | - | getReturnRefundPolicyUrl(): ?string | setReturnRefundPolicyUrl(?string returnRefundPolicyUrl): void | | `deliveryPolicyUrl` | `?string` | Optional | - | getDeliveryPolicyUrl(): ?string | setDeliveryPolicyUrl(?string deliveryPolicyUrl): void | | `secureCheckoutPolicyUrl` | `?string` | Optional | - | getSecureCheckoutPolicyUrl(): ?string | setSecureCheckoutPolicyUrl(?string secureCheckoutPolicyUrl): void | -## Example (as JSON) +## Example -```json -{ - "ip_address": "ip_address2", - "terms_url": "terms_url0", - "privacy_policy_url": "privacy_policy_url0", - "return_refund_policy_url": "return_refund_policy_url4", - "delivery_policy_url": "delivery_policy_url8" -} +```php +use AdvancedBillingLib\Models\Builders\AgreementAcceptanceBuilder; + +$agreementAcceptance = AgreementAcceptanceBuilder::init() + ->ipAddress('ip_address8') + ->termsUrl('terms_url6') + ->privacyPolicyUrl('privacy_policy_url4') + ->returnRefundPolicyUrl('return_refund_policy_url0') + ->deliveryPolicyUrl('delivery_policy_url4') + ->build(); ``` diff --git a/doc/models/all-vaults.md b/doc/models/all-vaults.md index 5e5e19d0..8f0ab661 100644 --- a/doc/models/all-vaults.md +++ b/doc/models/all-vaults.md @@ -46,3 +46,11 @@ The vault that stores the payment profile with the provided `vault_token`. Use ` | `UNIPAAS` | | `WIRECARD` | +## Example + +```php +use AdvancedBillingLib\Models\AllVaults; + +$allVaults = AllVaults::EWAY_RAPID_STD; +``` + diff --git a/doc/models/allocate-components.md b/doc/models/allocate-components.md index 8f561510..d7ec3c75 100644 --- a/doc/models/allocate-components.md +++ b/doc/models/allocate-components.md @@ -15,35 +15,52 @@ | `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. | 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 | +| `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 | -## Example (as JSON) - -```json -{ - "proration_upgrade_scheme": "proration_upgrade_scheme2", - "proration_downgrade_scheme": "proration_downgrade_scheme0", - "allocations": [ - { - "quantity": 26.48, - "decimal_quantity": "decimal_quantity8", - "previous_quantity": 55.5, - "decimal_previous_quantity": "decimal_previous_quantity2", - "component_id": 242, - "memo": "memo6" - }, - { - "quantity": 26.48, - "decimal_quantity": "decimal_quantity8", - "previous_quantity": 55.5, - "decimal_previous_quantity": "decimal_previous_quantity2", - "component_id": 242, - "memo": "memo6" - } - ], - "accrue_charge": false, - "upgrade_charge": "full" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocateComponentsBuilder; +use AdvancedBillingLib\Models\Builders\CreateAllocationBuilder; +use AdvancedBillingLib\Models\CreditType; + +$allocateComponents = AllocateComponentsBuilder::init() + ->prorationUpgradeScheme('proration_upgrade_scheme8') + ->prorationDowngradeScheme('proration_downgrade_scheme6') + ->allocations( + [ + CreateAllocationBuilder::init( + 26.48 + ) + ->decimalQuantity('decimal_quantity8') + ->previousQuantity(55.5) + ->decimalPreviousQuantity('decimal_previous_quantity2') + ->componentId(242) + ->memo('memo6') + ->build(), + CreateAllocationBuilder::init( + 26.48 + ) + ->decimalQuantity('decimal_quantity8') + ->previousQuantity(55.5) + ->decimalPreviousQuantity('decimal_previous_quantity2') + ->componentId(242) + ->memo('memo6') + ->build(), + CreateAllocationBuilder::init( + 26.48 + ) + ->decimalQuantity('decimal_quantity8') + ->previousQuantity(55.5) + ->decimalPreviousQuantity('decimal_previous_quantity2') + ->componentId(242) + ->memo('memo6') + ->build() + ] + ) + ->accrueCharge(false) + ->upgradeCharge(CreditType::PRORATED) + ->build(); ``` diff --git a/doc/models/allocation-expiration-date.md b/doc/models/allocation-expiration-date.md index 472f7630..558cdfe7 100644 --- a/doc/models/allocation-expiration-date.md +++ b/doc/models/allocation-expiration-date.md @@ -11,11 +11,14 @@ | --- | --- | --- | --- | --- | --- | | `expiresAt` | `?DateTime` | Optional | - | getExpiresAt(): ?\DateTime | setExpiresAt(?\DateTime expiresAt): void | -## Example (as JSON) +## Example -```json -{ - "expires_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\AllocationExpirationDateBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$allocationExpirationDate = AllocationExpirationDateBuilder::init() + ->expiresAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/allocation-preview-direction.md b/doc/models/allocation-preview-direction.md index 2e124430..8adee0f9 100644 --- a/doc/models/allocation-preview-direction.md +++ b/doc/models/allocation-preview-direction.md @@ -12,3 +12,11 @@ | `UPGRADE` | | `DOWNGRADE` | +## Example + +```php +use AdvancedBillingLib\Models\AllocationPreviewDirection; + +$allocationPreviewDirection = AllocationPreviewDirection::UPGRADE; +``` + diff --git a/doc/models/allocation-preview-item.md b/doc/models/allocation-preview-item.md index f4a80de8..9ab50a55 100644 --- a/doc/models/allocation-preview-item.md +++ b/doc/models/allocation-preview-item.md @@ -21,22 +21,28 @@ | `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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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 | | `previousPricePointId` | `?int` | Optional | - | getPreviousPricePointId(): ?int | setPreviousPricePointId(?int previousPricePointId): void | | `pricePointHandle` | `?string` | Optional | - | getPricePointHandle(): ?string | setPricePointHandle(?string pricePointHandle): void | | `pricePointName` | `?string` | Optional | - | getPricePointName(): ?string | setPricePointName(?string pricePointName): void | | `componentHandle` | `?string` | Optional | - | getComponentHandle(): ?string | setComponentHandle(?string componentHandle): void | -## Example (as JSON) - -```json -{ - "component_id": 54, - "subscription_id": 54, - "quantity": 78, - "previous_quantity": 192, - "memo": "memo6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocationPreviewItemBuilder; + +$allocationPreviewItem = AllocationPreviewItemBuilder::init() + ->componentId(176) + ->subscriptionId(176) + ->quantity( + 200 + ) + ->previousQuantity( + 30 + ) + ->memo('memo8') + ->build(); ``` diff --git a/doc/models/allocation-preview-line-item-kind.md b/doc/models/allocation-preview-line-item-kind.md index cc67eef1..0dc2ce07 100644 --- a/doc/models/allocation-preview-line-item-kind.md +++ b/doc/models/allocation-preview-line-item-kind.md @@ -16,3 +16,11 @@ A handle for the line item kind for allocation preview | `COUPON` | | `TAX` | +## Example + +```php +use AdvancedBillingLib\Models\AllocationPreviewLineItemKind; + +$allocationPreviewLineItemKind = AllocationPreviewLineItemKind::COUPON; +``` + diff --git a/doc/models/allocation-preview-line-item.md b/doc/models/allocation-preview-line-item.md index eaba6163..dbe73496 100644 --- a/doc/models/allocation-preview-line-item.md +++ b/doc/models/allocation-preview-line-item.md @@ -17,17 +17,21 @@ | `taxableAmountInCents` | `?int` | Optional | - | getTaxableAmountInCents(): ?int | setTaxableAmountInCents(?int taxableAmountInCents): void | | `componentId` | `?int` | Optional | - | getComponentId(): ?int | setComponentId(?int componentId): void | | `componentHandle` | `?string` | Optional | - | getComponentHandle(): ?string | setComponentHandle(?string componentHandle): void | -| `direction` | [`?string(AllocationPreviewDirection)`](../../doc/models/allocation-preview-direction.md) | Optional | Visible when using Fine-grained Component Control | getDirection(): ?string | setDirection(?string direction): void | - -## Example (as JSON) - -```json -{ - "transaction_type": "credit", - "kind": "quantity_based_component", - "amount_in_cents": 24, - "memo": "memo6", - "discount_amount_in_cents": 172 -} +| `direction` | [`?string(AllocationPreviewDirection)`](../../doc/models/allocation-preview-direction.md) | Optional | Visible when using Fine-grained Component Control. | getDirection(): ?string | setDirection(?string direction): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocationPreviewLineItemBuilder; +use AdvancedBillingLib\Models\LineItemTransactionType; +use AdvancedBillingLib\Models\AllocationPreviewLineItemKind; + +$allocationPreviewLineItem = AllocationPreviewLineItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(AllocationPreviewLineItemKind::QUANTITY_BASED_COMPONENT) + ->amountInCents(236) + ->memo('memo6') + ->discountAmountInCents(40) + ->build(); ``` diff --git a/doc/models/allocation-preview-response.md b/doc/models/allocation-preview-response.md index 7fd18468..7088e5be 100644 --- a/doc/models/allocation-preview-response.md +++ b/doc/models/allocation-preview-response.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `allocationPreview` | [`AllocationPreview`](../../doc/models/allocation-preview.md) | Required | - | getAllocationPreview(): AllocationPreview | setAllocationPreview(AllocationPreview allocationPreview): void | -## Example (as JSON) - -```json -{ - "allocation_preview": { - "start_date": "2016-03-13T12:52:32.123Z", - "end_date": "2016-03-13T12:52:32.123Z", - "subtotal_in_cents": 240, - "total_tax_in_cents": 108, - "total_discount_in_cents": 142 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocationPreviewResponseBuilder; +use AdvancedBillingLib\Models\Builders\AllocationPreviewBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$allocationPreviewResponse = AllocationPreviewResponseBuilder::init( + AllocationPreviewBuilder::init() + ->startDate(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endDate(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->subtotalInCents(240) + ->totalTaxInCents(108) + ->totalDiscountInCents(142) + ->build() +)->build(); ``` diff --git a/doc/models/allocation-preview.md b/doc/models/allocation-preview.md index 01410c4b..7aed698e 100644 --- a/doc/models/allocation-preview.md +++ b/doc/models/allocation-preview.md @@ -23,15 +23,18 @@ | `periodType` | `?string` | Optional | - | getPeriodType(): ?string | setPeriodType(?string periodType): void | | `existingBalanceInCents` | `?int` | Optional | An integer representing the amount of the subscription's current balance | getExistingBalanceInCents(): ?int | setExistingBalanceInCents(?int existingBalanceInCents): void | -## Example (as JSON) - -```json -{ - "start_date": "2016-03-13T12:52:32.123Z", - "end_date": "2016-03-13T12:52:32.123Z", - "subtotal_in_cents": 4, - "total_tax_in_cents": 128, - "total_discount_in_cents": 122 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocationPreviewBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$allocationPreview = AllocationPreviewBuilder::init() + ->startDate(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endDate(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->subtotalInCents(140) + ->totalTaxInCents(8) + ->totalDiscountInCents(242) + ->build(); ``` diff --git a/doc/models/allocation-response.md b/doc/models/allocation-response.md index 9bef4a39..5370b2b1 100644 --- a/doc/models/allocation-response.md +++ b/doc/models/allocation-response.md @@ -11,17 +11,24 @@ | --- | --- | --- | --- | --- | --- | | `allocation` | [`?Allocation`](../../doc/models/allocation.md) | Optional | - | getAllocation(): ?Allocation | setAllocation(?Allocation allocation): void | -## Example (as JSON) - -```json -{ - "allocation": { - "allocation_id": 238, - "component_id": 8, - "component_handle": "component_handle8", - "subscription_id": 8, - "quantity": 32 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocationResponseBuilder; +use AdvancedBillingLib\Models\Builders\AllocationBuilder; + +$allocationResponse = AllocationResponseBuilder::init() + ->allocation( + AllocationBuilder::init() + ->allocationId(238) + ->componentId(8) + ->componentHandle('component_handle8') + ->subscriptionId(8) + ->quantity( + 32 + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/allocation-settings.md b/doc/models/allocation-settings.md index af3b2ccb..4e813819 100644 --- a/doc/models/allocation-settings.md +++ b/doc/models/allocation-settings.md @@ -13,13 +13,16 @@ | `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) - -```json -{ - "upgrade_charge": "none", - "downgrade_credit": "prorated", - "accrue_charge": "accrue_charge0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AllocationSettingsBuilder; +use AdvancedBillingLib\Models\CreditType; + +$allocationSettings = AllocationSettingsBuilder::init() + ->upgradeCharge(CreditType::PRORATED) + ->downgradeCredit(CreditType::PRORATED) + ->accrueCharge('accrue_charge2') + ->build(); ``` diff --git a/doc/models/allocation.md b/doc/models/allocation.md index 94091fd0..f2fce72e 100644 --- a/doc/models/allocation.md +++ b/doc/models/allocation.md @@ -9,21 +9,21 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `allocationId` | `?int` | Optional | The allocation unique id | getAllocationId(): ?int | setAllocationId(?int allocationId): void | -| `componentId` | `?int` | Optional | The integer component ID for the allocation. This references a component that you have created in your Product setup | getComponentId(): ?int | setComponentId(?int componentId): void | -| `componentHandle` | `?string` | Optional | The handle of the component. This references a component that you have created in your Product setup | getComponentHandle(): ?string | setComponentHandle(?string componentHandle): void | -| `subscriptionId` | `?int` | Optional | The integer subscription ID for the allocation. This references a unique subscription in your Site | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | +| `allocationId` | `?int` | Optional | The allocation unique ID | getAllocationId(): ?int | setAllocationId(?int allocationId): void | +| `componentId` | `?int` | Optional | The integer component ID for the allocation. This references a component that you have created in your Product setup. | getComponentId(): ?int | setComponentId(?int componentId): void | +| `componentHandle` | `?string` | Optional | The handle of the component. This references a component that you have created in your Product setup. | getComponentHandle(): ?string | setComponentHandle(?string componentHandle): void | +| `subscriptionId` | `?int` | Optional | The integer subscription ID for the allocation. This references a unique subscription in your Site. | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `quantity` | int\|string\|null | Optional | This is a container for one-of cases. | getQuantity(): | setQuantity( quantity): void | | `previousQuantity` | int\|string\|null | Optional | This is a container for one-of cases. | getPreviousQuantity(): | setPreviousQuantity( previousQuantity): void | | `memo` | `?string` | Optional | The memo passed when the allocation was created | getMemo(): ?string | setMemo(?string memo): void | -| `timestamp` | `?DateTime` | Optional | The time that the allocation was recorded, in format and UTC timezone, i.e. 2012-11-20T22:00:37Z | getTimestamp(): ?\DateTime | setTimestamp(?\DateTime timestamp): void | +| `timestamp` | `?DateTime` | Optional | The time that the allocation was recorded, in ISO 8601 format and UTC timezone, e.g., 2012-11-20T22:00:37Z | getTimestamp(): ?\DateTime | setTimestamp(?\DateTime timestamp): void | | `createdAt` | `?DateTime` | Optional | Timestamp indicating when this allocation was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `prorationUpgradeScheme` | `?string` | Optional | The scheme used if the proration was an upgrade. This is only present when the allocation was created mid-period. | getProrationUpgradeScheme(): ?string | setProrationUpgradeScheme(?string prorationUpgradeScheme): void | | `prorationDowngradeScheme` | `?string` | Optional | The scheme used if the proration was a downgrade. This is only present when the allocation was created mid-period. | getProrationDowngradeScheme(): ?string | setProrationDowngradeScheme(?string prorationDowngradeScheme): void | | `pricePointId` | `?int` | Optional | - | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | | `pricePointName` | `?string` | Optional | - | getPricePointName(): ?string | setPricePointName(?string pricePointName): void | | `pricePointHandle` | `?string` | Optional | - | getPricePointHandle(): ?string | setPricePointHandle(?string pricePointHandle): 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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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 | | `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 | @@ -35,15 +35,19 @@ | `usedQuantity` | `?int` | Optional | - | getUsedQuantity(): ?int | setUsedQuantity(?int usedQuantity): void | | `chargeId` | `?int` | Optional | - | getChargeId(): ?int | setChargeId(?int chargeId): void | -## Example (as JSON) +## Example -```json -{ - "allocation_id": 102, - "component_id": 144, - "component_handle": "component_handle0", - "subscription_id": 144, - "quantity": 168 -} +```php +use AdvancedBillingLib\Models\Builders\AllocationBuilder; + +$allocation = AllocationBuilder::init() + ->allocationId(238) + ->componentId(8) + ->componentHandle('component_handle8') + ->subscriptionId(8) + ->quantity( + 32 + ) + ->build(); ``` diff --git a/doc/models/apple-pay-payment-profile.md b/doc/models/apple-pay-payment-profile.md index 61820fb0..ad92319b 100644 --- a/doc/models/apple-pay-payment-profile.md +++ b/doc/models/apple-pay-payment-profile.md @@ -12,7 +12,7 @@ | `id` | `?int` | Optional | The Chargify-assigned ID of the Apple Pay payment profile. | getId(): ?int | setId(?int id): void | | `firstName` | `?string` | Optional | The first name of the Apple Pay account holder | getFirstName(): ?string | setFirstName(?string firstName): void | | `lastName` | `?string` | Optional | The last name of the Apple Pay account holder | getLastName(): ?string | setLastName(?string lastName): void | -| `customerId` | `?int` | Optional | The Chargify-assigned id for the customer record to which the Apple Pay account belongs | getCustomerId(): ?int | setCustomerId(?int customerId): void | +| `customerId` | `?int` | Optional | The Chargify-assigned ID for the customer record to which the Apple Pay account belongs | getCustomerId(): ?int | setCustomerId(?int customerId): void | | `currentVault` | [`?string(ApplePayVault)`](../../doc/models/apple-pay-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `vaultToken` | `?string` | Optional | The “token” provided by your vault storage for an already stored payment profile | getVaultToken(): ?string | setVaultToken(?string vaultToken): void | | `billingAddress` | `?string` | Optional | The current billing street address for the Apple Pay account | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | @@ -28,16 +28,21 @@ | `createdAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was last updated | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -## Example (as JSON) - -```json -{ - "payment_type": "apple_pay", - "id": 60, - "first_name": "first_name2", - "last_name": "last_name0", - "customer_id": 98, - "current_vault": "braintree_blue" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplePayPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\ApplePayVault; + +$applePayPaymentProfile = ApplePayPaymentProfileBuilder::init( + PaymentType::APPLE_PAY +) + ->id(252) + ->firstName('first_name0') + ->lastName('last_name8') + ->customerId(34) + ->currentVault(ApplePayVault::BRAINTREE_BLUE) + ->build(); ``` diff --git a/doc/models/apple-pay-vault.md b/doc/models/apple-pay-vault.md index 9e66d7b5..78e022d6 100644 --- a/doc/models/apple-pay-vault.md +++ b/doc/models/apple-pay-vault.md @@ -13,3 +13,11 @@ The vault that stores the payment profile with the provided vault_token. | --- | | `BRAINTREE_BLUE` | +## Example + +```php +use AdvancedBillingLib\Models\ApplePayVault; + +$applePayVault = ApplePayVault::BRAINTREE_BLUE; +``` + diff --git a/doc/models/applied-credit-note-data.md b/doc/models/applied-credit-note-data.md index aa2a8ff4..8e83c027 100644 --- a/doc/models/applied-credit-note-data.md +++ b/doc/models/applied-credit-note-data.md @@ -12,12 +12,14 @@ | `uid` | `?string` | Optional | The UID of the credit note | getUid(): ?string | setUid(?string uid): void | | `number` | `?string` | Optional | The number of the credit note | getNumber(): ?string | setNumber(?string number): void | -## Example (as JSON) +## Example -```json -{ - "uid": "uid2", - "number": "number0" -} +```php +use AdvancedBillingLib\Models\Builders\AppliedCreditNoteDataBuilder; + +$appliedCreditNoteData = AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number2') + ->build(); ``` diff --git a/doc/models/apply-credit-note-event-data.md b/doc/models/apply-credit-note-event-data.md index 07d2544a..41b13ce4 100644 --- a/doc/models/apply-credit-note-event-data.md +++ b/doc/models/apply-credit-note-event-data.md @@ -19,32 +19,43 @@ Example schema for an `apply_credit_note` event | `transactionTime` | `?DateTime` | Optional | The time the credit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" | getTransactionTime(): ?\DateTime | setTransactionTime(?\DateTime transactionTime): void | | `memo` | `?string` | Optional | The credit note memo. | getMemo(): ?string | setMemo(?string memo): void | | `role` | `?string` | Optional | The role of the credit note (e.g. 'general') | getRole(): ?string | setRole(?string role): void | -| `consolidatedInvoice` | `?bool` | Optional | Shows whether it was applied to consolidated invoice or not | getConsolidatedInvoice(): ?bool | setConsolidatedInvoice(?bool consolidatedInvoice): void | +| `consolidatedInvoice` | `?bool` | Optional | Shows whether it was applied to consolidated invoice or not. | getConsolidatedInvoice(): ?bool | setConsolidatedInvoice(?bool consolidatedInvoice): void | | `appliedCreditNotes` | [`?(AppliedCreditNoteData[])`](../../doc/models/applied-credit-note-data.md) | Optional | List of credit notes applied to children invoices (if consolidated invoice) | getAppliedCreditNotes(): ?array | setAppliedCreditNotes(?array appliedCreditNotes): void | -## Example (as JSON) - -```json -{ - "uid": "uid2", - "credit_note_number": "credit_note_number4", - "credit_note_uid": "credit_note_uid4", - "original_amount": "original_amount6", - "applied_amount": "applied_amount6", - "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo6", - "role": "role4", - "consolidated_invoice": false, - "applied_credit_notes": [ - { - "uid": "uid4", - "number": "number8" - }, - { - "uid": "uid4", - "number": "number8" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplyCreditNoteEventDataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\AppliedCreditNoteDataBuilder; + +$applyCreditNoteEventData = ApplyCreditNoteEventDataBuilder::init( + 'uid0', + 'credit_note_number6', + 'credit_note_uid4', + 'original_amount4', + 'applied_amount8' +) + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo4') + ->role('role4') + ->consolidatedInvoice(false) + ->appliedCreditNotes( + [ + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/apply-credit-note-event.md b/doc/models/apply-credit-note-event.md index 2015e9c1..fe3a53e8 100644 --- a/doc/models/apply-credit-note-event.md +++ b/doc/models/apply-credit-note-event.md @@ -15,49 +15,59 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::APPLY_CREDIT_NOTE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`ApplyCreditNoteEventData`](../../doc/models/apply-credit-note-event-data.md) | Required | Example schema for an `apply_credit_note` event | getEventData(): ApplyCreditNoteEventData | setEventData(ApplyCreditNoteEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 214, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "apply_credit_note", - "event_data": { - "uid": "uid6", - "credit_note_number": "credit_note_number0", - "credit_note_uid": "credit_note_uid0", - "original_amount": "original_amount0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo0", - "role": "role0", - "consolidated_invoice": false, - "applied_credit_notes": [ - { - "uid": "uid4", - "number": "number8" - }, - { - "uid": "uid4", - "number": "number8" - }, - { - "uid": "uid4", - "number": "number8" - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplyCreditNoteEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ApplyCreditNoteEventDataBuilder; +use AdvancedBillingLib\Models\Builders\AppliedCreditNoteDataBuilder; + +$applyCreditNoteEvent = ApplyCreditNoteEventBuilder::init( + 86, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::APPLY_CREDIT_NOTE, + ApplyCreditNoteEventDataBuilder::init( + 'uid6', + 'credit_note_number0', + 'credit_note_uid0', + 'original_amount0', + 'applied_amount2' + ) + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo0') + ->role('role0') + ->consolidatedInvoice(false) + ->appliedCreditNotes( + [ + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build() + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/apply-debit-note-event-data.md b/doc/models/apply-debit-note-event-data.md index a2ea19f8..e1fa9b0f 100644 --- a/doc/models/apply-debit-note-event-data.md +++ b/doc/models/apply-debit-note-event-data.md @@ -18,16 +18,20 @@ Example schema for an `apply_debit_note` event | `memo` | `?string` | Optional | The debit note memo. | getMemo(): ?string | setMemo(?string memo): void | | `transactionTime` | `?DateTime` | Optional | The time the debit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" | getTransactionTime(): ?\DateTime | setTransactionTime(?\DateTime transactionTime): void | -## Example (as JSON) - -```json -{ - "debit_note_number": "debit_note_number0", - "debit_note_uid": "debit_note_uid6", - "original_amount": "original_amount4", - "applied_amount": "applied_amount8", - "memo": "memo4", - "transaction_time": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplyDebitNoteEventDataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$applyDebitNoteEventData = ApplyDebitNoteEventDataBuilder::init( + 'debit_note_number8', + 'debit_note_uid4', + 'original_amount2', + 'applied_amount0' +) + ->memo('memo2') + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/apply-debit-note-event.md b/doc/models/apply-debit-note-event.md index b51879ba..fdddc8f8 100644 --- a/doc/models/apply-debit-note-event.md +++ b/doc/models/apply-debit-note-event.md @@ -15,32 +15,39 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::APPLY_DEBIT_NOTE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`ApplyDebitNoteEventData`](../../doc/models/apply-debit-note-event-data.md) | Required | Example schema for an `apply_debit_note` event | getEventData(): ApplyDebitNoteEventData | setEventData(ApplyDebitNoteEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 164, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "apply_debit_note", - "event_data": { - "debit_note_number": "debit_note_number6", - "debit_note_uid": "debit_note_uid2", - "original_amount": "original_amount0", - "applied_amount": "applied_amount2", - "memo": "memo0", - "transaction_time": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplyDebitNoteEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ApplyDebitNoteEventDataBuilder; + +$applyDebitNoteEvent = ApplyDebitNoteEventBuilder::init( + 180, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::APPLY_DEBIT_NOTE, + ApplyDebitNoteEventDataBuilder::init( + 'debit_note_number6', + 'debit_note_uid2', + 'original_amount0', + 'applied_amount2' + ) + ->memo('memo0') + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() +)->build(); ``` diff --git a/doc/models/apply-payment-event-data.md b/doc/models/apply-payment-event-data.md index 7eac8237..9e3ff369 100644 --- a/doc/models/apply-payment-event-data.md +++ b/doc/models/apply-payment-event-data.md @@ -23,23 +23,30 @@ Example schema for an `apply_payment` event | `prepayment` | `?bool` | Optional | - | getPrepayment(): ?bool | setPrepayment(?bool prepayment): void | | `external` | `?bool` | Optional | - | getExternal(): ?bool | setExternal(?bool external): void | -## Example (as JSON) - -```json -{ - "consolidation_level": "child", - "memo": "memo8", - "original_amount": "original_amount8", - "applied_amount": "applied_amount4", - "transaction_time": "2016-03-13T12:52:32.123Z", - "payment_method": { - "type": "apple_pay" - }, - "transaction_id": 196, - "parent_invoice_number": 174, - "remaining_prepayment_amount": "remaining_prepayment_amount6", - "prepayment": false, - "external": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplyPaymentEventDataBuilder; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\PaymentMethodApplePayBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$applyPaymentEventData = ApplyPaymentEventDataBuilder::init( + InvoiceConsolidationLevel::CHILD, + 'memo0', + 'original_amount0', + 'applied_amount2', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + PaymentMethodApplePayBuilder::init( + InvoiceEventPaymentMethod::APPLE_PAY + )->build() +) + ->transactionId(142) + ->parentInvoiceNumber(228) + ->remainingPrepaymentAmount('remaining_prepayment_amount4') + ->prepayment(false) + ->external(false) + ->build(); ``` diff --git a/doc/models/apply-payment-event.md b/doc/models/apply-payment-event.md index e0e33500..68988f8a 100644 --- a/doc/models/apply-payment-event.md +++ b/doc/models/apply-payment-event.md @@ -15,39 +15,49 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::APPLY_PAYMENT` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`ApplyPaymentEventData`](../../doc/models/apply-payment-event-data.md) | Required | Example schema for an `apply_payment` event | getEventData(): ApplyPaymentEventData | setEventData(ApplyPaymentEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 234, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "apply_payment", - "event_data": { - "consolidation_level": "child", - "memo": "memo0", - "original_amount": "original_amount0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z", - "payment_method": { - "type": "apple_pay" - }, - "transaction_id": 78, - "parent_invoice_number": 36, - "remaining_prepayment_amount": "remaining_prepayment_amount6", - "prepayment": false, - "external": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ApplyPaymentEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ApplyPaymentEventDataBuilder; +use AdvancedBillingLib\Models\Builders\PaymentMethodApplePayBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$applyPaymentEvent = ApplyPaymentEventBuilder::init( + 112, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::APPLY_PAYMENT, + ApplyPaymentEventDataBuilder::init( + InvoiceConsolidationLevel::CHILD, + 'memo0', + 'original_amount0', + 'applied_amount2', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + PaymentMethodApplePayBuilder::init( + InvoiceEventPaymentMethod::APPLE_PAY + )->build() + ) + ->transactionId(78) + ->parentInvoiceNumber(36) + ->remainingPrepaymentAmount('remaining_prepayment_amount6') + ->prepayment(false) + ->external(false) + ->build() +)->build(); ``` diff --git a/doc/models/attribute-error.md b/doc/models/attribute-error.md index 53bd15c2..43b83d36 100644 --- a/doc/models/attribute-error.md +++ b/doc/models/attribute-error.md @@ -11,14 +11,16 @@ | --- | --- | --- | --- | --- | --- | | `attribute` | `string[]` | Required | - | getAttribute(): array | setAttribute(array attribute): void | -## Example (as JSON) - -```json -{ - "attribute": [ - "attribute6", - "attribute7" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AttributeErrorBuilder; + +$attributeError = AttributeErrorBuilder::init( + [ + 'attribute8', + 'attribute7' + ] +)->build(); ``` diff --git a/doc/models/auto-invite.md b/doc/models/auto-invite.md index c467ad11..4d20d9e4 100644 --- a/doc/models/auto-invite.md +++ b/doc/models/auto-invite.md @@ -12,3 +12,11 @@ | `NO` | Do not send the invitation email. | | `YES` | Automatically send the invitation email. | +## Example + +```php +use AdvancedBillingLib\Models\AutoInvite; + +$autoInvite = AutoInvite::NO; +``` + diff --git a/doc/models/auto-resume.md b/doc/models/auto-resume.md index a1e568c3..e053f9dd 100644 --- a/doc/models/auto-resume.md +++ b/doc/models/auto-resume.md @@ -11,11 +11,14 @@ | --- | --- | --- | --- | --- | --- | | `automaticallyResumeAt` | `?DateTime` | Optional | - | getAutomaticallyResumeAt(): ?\DateTime | setAutomaticallyResumeAt(?\DateTime automaticallyResumeAt): void | -## Example (as JSON) +## Example -```json -{ - "automatically_resume_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\AutoResumeBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$autoResume = AutoResumeBuilder::init() + ->automaticallyResumeAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/available-actions.md b/doc/models/available-actions.md index 3439f024..4f35b0a7 100644 --- a/doc/models/available-actions.md +++ b/doc/models/available-actions.md @@ -11,14 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `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" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\AvailableActionsBuilder; +use AdvancedBillingLib\Models\Builders\SendEmailBuilder; + +$availableActions = AvailableActionsBuilder::init() + ->sendEmail( + SendEmailBuilder::init( + false, + 'url0' + )->build() + )->build(); ``` diff --git a/doc/models/backport-invoice-event.md b/doc/models/backport-invoice-event.md index 69fc8741..61add2e2 100644 --- a/doc/models/backport-invoice-event.md +++ b/doc/models/backport-invoice-event.md @@ -15,35 +15,40 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::BACKPORT_INVOICE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`Invoice`](../../doc/models/invoice.md) | Required | Example schema for an `backport_invoice` event | getEventData(): Invoice | setEventData(Invoice eventData): void | -## Example (as JSON) - -```json -{ - "id": 78, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "backport_invoice", - "event_data": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 206, - "uid": "uid6", - "site_id": 132, - "customer_id": 244, - "subscription_id": 60 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BackportInvoiceEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; + +$backportInvoiceEvent = BackportInvoiceEventBuilder::init( + 210, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::BACKPORT_INVOICE, + InvoiceBuilder::init() + ->id(206) + ->uid('uid6') + ->siteId(132) + ->customerId(244) + ->subscriptionId(60) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build() +)->build(); ``` diff --git a/doc/models/bank-account-attributes.md b/doc/models/bank-account-attributes.md index 7c02c407..d1ef2505 100644 --- a/doc/models/bank-account-attributes.md +++ b/doc/models/bank-account-attributes.md @@ -11,26 +11,29 @@ | --- | --- | --- | --- | --- | --- | | `chargifyToken` | `?string` | Optional | - | getChargifyToken(): ?string | setChargifyToken(?string chargifyToken): void | | `bankName` | `?string` | Optional | (Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides | getBankName(): ?string | setBankName(?string bankName): void | -| `bankRoutingNumber` | `?string` | Optional | (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API | getBankRoutingNumber(): ?string | setBankRoutingNumber(?string bankRoutingNumber): void | +| `bankRoutingNumber` | `?string` | Optional | (Required when creating a subscription with ACH; optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API. | getBankRoutingNumber(): ?string | setBankRoutingNumber(?string bankRoutingNumber): void | | `bankAccountNumber` | `?string` | Optional | (Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number | getBankAccountNumber(): ?string | setBankAccountNumber(?string bankAccountNumber): void | | `bankAccountType` | [`?string(BankAccountType)`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking | getBankAccountType(): ?string | setBankAccountType(?string bankAccountType): void | -| `bankBranchCode` | `?string` | Optional | (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided | getBankBranchCode(): ?string | setBankBranchCode(?string bankBranchCode): void | -| `bankIban` | `?string` | Optional | (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided | getBankIban(): ?string | setBankIban(?string bankIban): void | +| `bankBranchCode` | `?string` | Optional | (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided. | getBankBranchCode(): ?string | setBankBranchCode(?string bankBranchCode): void | +| `bankIban` | `?string` | Optional | (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided. | getBankIban(): ?string | setBankIban(?string bankIban): void | | `bankAccountHolderType` | [`?string(BankAccountHolderType)`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal | getBankAccountHolderType(): ?string | setBankAccountHolderType(?string bankAccountHolderType): void | | `paymentType` | [`?string(PaymentType)`](../../doc/models/payment-type.md) | Optional | - | getPaymentType(): ?string | setPaymentType(?string paymentType): void | | `currentVault` | [`?string(BankAccountVault)`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `vaultToken` | `?string` | Optional | - | getVaultToken(): ?string | setVaultToken(?string vaultToken): void | | `customerVaultToken` | `?string` | Optional | (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | -## Example (as JSON) +## Example -```json -{ - "chargify_token": "chargify_token0", - "bank_name": "bank_name2", - "bank_routing_number": "bank_routing_number8", - "bank_account_number": "bank_account_number4", - "bank_account_type": "checking" -} +```php +use AdvancedBillingLib\Models\Builders\BankAccountAttributesBuilder; +use AdvancedBillingLib\Models\BankAccountType; + +$bankAccountAttributes = BankAccountAttributesBuilder::init() + ->chargifyToken('chargify_token0') + ->bankName('bank_name2') + ->bankRoutingNumber('bank_routing_number8') + ->bankAccountNumber('bank_account_number4') + ->bankAccountType(BankAccountType::CHECKING) + ->build(); ``` diff --git a/doc/models/bank-account-holder-type.md b/doc/models/bank-account-holder-type.md index 129dc3bc..2ae9a277 100644 --- a/doc/models/bank-account-holder-type.md +++ b/doc/models/bank-account-holder-type.md @@ -14,3 +14,11 @@ Defaults to personal | `PERSONAL` | | `BUSINESS` | +## Example + +```php +use AdvancedBillingLib\Models\BankAccountHolderType; + +$bankAccountHolderType = BankAccountHolderType::PERSONAL; +``` + diff --git a/doc/models/bank-account-payment-profile.md b/doc/models/bank-account-payment-profile.md index f4b09bdf..a75e2c7d 100644 --- a/doc/models/bank-account-payment-profile.md +++ b/doc/models/bank-account-payment-profile.md @@ -9,10 +9,10 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `id` | `?int` | Optional | The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer | getId(): ?int | setId(?int id): void | +| `id` | `?int` | Optional | The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer. | getId(): ?int | setId(?int id): void | | `firstName` | `?string` | Optional | The first name of the bank account holder | getFirstName(): ?string | setFirstName(?string firstName): void | | `lastName` | `?string` | Optional | The last name of the bank account holder | getLastName(): ?string | setLastName(?string lastName): void | -| `customerId` | `?int` | Optional | The Chargify-assigned id for the customer record to which the bank account belongs | getCustomerId(): ?int | setCustomerId(?int customerId): void | +| `customerId` | `?int` | Optional | The Chargify-assigned ID for the customer record to which the bank account belongs | getCustomerId(): ?int | setCustomerId(?int customerId): void | | `currentVault` | [`?string(BankAccountVault)`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `vaultToken` | `?string` | Optional | The "token" provided by your vault storage for an already stored payment profile | getVaultToken(): ?string | setVaultToken(?string vaultToken): void | | `billingAddress` | `?string` | Optional | The current billing street address for the bank account | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | @@ -23,28 +23,33 @@ | `customerVaultToken` | `?string` | Optional | (only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token. | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | | `billingAddress2` | `?string` | Optional | The current billing street address, second line, for the bank account | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | | `bankName` | `?string` | Optional | The bank where the account resides | getBankName(): ?string | setBankName(?string bankName): void | -| `maskedBankRoutingNumber` | `?string` | Optional | A string representation of the stored bank routing number with all but the last 4 digits marked with X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account | getMaskedBankRoutingNumber(): ?string | setMaskedBankRoutingNumber(?string maskedBankRoutingNumber): void | -| `maskedBankAccountNumber` | `?string` | Optional | A string representation of the stored bank account number with all but the last 4 digits marked with X's (i.e. 'XXXXXXX1111') | getMaskedBankAccountNumber(): ?string | setMaskedBankAccountNumber(?string maskedBankAccountNumber): void | +| `maskedBankRoutingNumber` | `?string` | Optional | A string representation of the stored bank routing number with all but the last 4 digits marked with X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account. | getMaskedBankRoutingNumber(): ?string | setMaskedBankRoutingNumber(?string maskedBankRoutingNumber): void | +| `maskedBankAccountNumber` | `?string` | Optional | A string representation of the stored bank account number with all but the last 4 digits marked with X's (i.e. 'XXXXXXX1111'). | getMaskedBankAccountNumber(): ?string | setMaskedBankAccountNumber(?string maskedBankAccountNumber): void | | `bankAccountType` | [`?string(BankAccountType)`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking | getBankAccountType(): ?string | setBankAccountType(?string bankAccountType): void | | `bankAccountHolderType` | [`?string(BankAccountHolderType)`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal | getBankAccountHolderType(): ?string | setBankAccountHolderType(?string bankAccountHolderType): void | | `paymentType` | [`string(PaymentType)`](../../doc/models/payment-type.md) | Required | **Default**: `PaymentType::BANK_ACCOUNT` | getPaymentType(): string | setPaymentType(string paymentType): void | -| `verified` | `?bool` | Optional | denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account

**Default**: `false` | getVerified(): ?bool | setVerified(?bool verified): void | +| `verified` | `?bool` | Optional | Denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account.

**Default**: `false` | getVerified(): ?bool | setVerified(?bool verified): void | | `siteGatewaySettingId` | `?int` | Optional | - | getSiteGatewaySettingId(): ?int | setSiteGatewaySettingId(?int siteGatewaySettingId): void | | `gatewayHandle` | `?string` | Optional | - | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | | `createdAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was last updated | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -## Example (as JSON) - -```json -{ - "payment_type": "bank_account", - "verified": false, - "id": 188, - "first_name": "first_name6", - "last_name": "last_name4", - "customer_id": 226, - "current_vault": "authorizenet" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BankAccountPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\BankAccountVault; + +$bankAccountPaymentProfile = BankAccountPaymentProfileBuilder::init( + PaymentType::BANK_ACCOUNT +) + ->id(16) + ->firstName('first_name0') + ->lastName('last_name8') + ->customerId(54) + ->currentVault(BankAccountVault::GOCARDLESS) + ->verified(false) + ->build(); ``` diff --git a/doc/models/bank-account-response.md b/doc/models/bank-account-response.md index d62b421d..14562432 100644 --- a/doc/models/bank-account-response.md +++ b/doc/models/bank-account-response.md @@ -11,19 +11,25 @@ | --- | --- | --- | --- | --- | --- | | `paymentProfile` | [`BankAccountPaymentProfile`](../../doc/models/bank-account-payment-profile.md) | Required | - | getPaymentProfile(): BankAccountPaymentProfile | setPaymentProfile(BankAccountPaymentProfile paymentProfile): void | -## Example (as JSON) - -```json -{ - "payment_profile": { - "payment_type": "bank_account", - "verified": false, - "id": 44, - "first_name": "first_name4", - "last_name": "last_name2", - "customer_id": 82, - "current_vault": "authorizenet" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BankAccountResponseBuilder; +use AdvancedBillingLib\Models\Builders\BankAccountPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\BankAccountVault; + +$bankAccountResponse = BankAccountResponseBuilder::init( + BankAccountPaymentProfileBuilder::init( + PaymentType::BANK_ACCOUNT + ) + ->id(44) + ->firstName('first_name4') + ->lastName('last_name2') + ->customerId(82) + ->currentVault(BankAccountVault::AUTHORIZENET) + ->verified(false) + ->build() +)->build(); ``` diff --git a/doc/models/bank-account-type.md b/doc/models/bank-account-type.md index 86a4b637..d77c3304 100644 --- a/doc/models/bank-account-type.md +++ b/doc/models/bank-account-type.md @@ -14,3 +14,11 @@ Defaults to checking | `CHECKING` | | `SAVINGS` | +## Example + +```php +use AdvancedBillingLib\Models\BankAccountType; + +$bankAccountType = BankAccountType::CHECKING; +``` + diff --git a/doc/models/bank-account-vault.md b/doc/models/bank-account-vault.md index 9ff1b83a..547a1f26 100644 --- a/doc/models/bank-account-vault.md +++ b/doc/models/bank-account-vault.md @@ -20,3 +20,11 @@ The vault that stores the payment profile with the provided vault_token. Use `bo | `MAXP` | | `STRIPE_CONNECT` | +## Example + +```php +use AdvancedBillingLib\Models\BankAccountVault; + +$bankAccountVault = BankAccountVault::MAXP; +``` + diff --git a/doc/models/bank-account-verification-request.md b/doc/models/bank-account-verification-request.md index e5119102..ddbc020b 100644 --- a/doc/models/bank-account-verification-request.md +++ b/doc/models/bank-account-verification-request.md @@ -11,14 +11,17 @@ | --- | --- | --- | --- | --- | --- | | `bankAccountVerification` | [`BankAccountVerification`](../../doc/models/bank-account-verification.md) | Required | - | getBankAccountVerification(): BankAccountVerification | setBankAccountVerification(BankAccountVerification bankAccountVerification): void | -## Example (as JSON) - -```json -{ - "bank_account_verification": { - "deposit_1_in_cents": 244, - "deposit_2_in_cents": 6 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BankAccountVerificationRequestBuilder; +use AdvancedBillingLib\Models\Builders\BankAccountVerificationBuilder; + +$bankAccountVerificationRequest = BankAccountVerificationRequestBuilder::init( + BankAccountVerificationBuilder::init() + ->deposit1InCents(244) + ->deposit2InCents(6) + ->build() +)->build(); ``` diff --git a/doc/models/bank-account-verification.md b/doc/models/bank-account-verification.md index fdc410ec..74729f9c 100644 --- a/doc/models/bank-account-verification.md +++ b/doc/models/bank-account-verification.md @@ -12,12 +12,14 @@ | `deposit1InCents` | `?int` | Optional | - | getDeposit1InCents(): ?int | setDeposit1InCents(?int deposit1InCents): void | | `deposit2InCents` | `?int` | Optional | - | getDeposit2InCents(): ?int | setDeposit2InCents(?int deposit2InCents): void | -## Example (as JSON) +## Example -```json -{ - "deposit_1_in_cents": 142, - "deposit_2_in_cents": 132 -} +```php +use AdvancedBillingLib\Models\Builders\BankAccountVerificationBuilder; + +$bankAccountVerification = BankAccountVerificationBuilder::init() + ->deposit1InCents(248) + ->deposit2InCents(10) + ->build(); ``` diff --git a/doc/models/base-refund-error.md b/doc/models/base-refund-error.md index f44a8e24..d6e4a082 100644 --- a/doc/models/base-refund-error.md +++ b/doc/models/base-refund-error.md @@ -11,24 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `base` | `?(array[])` | Optional | - | getBase(): ?array | setBase(?array base): void | -## Example (as JSON) - -```json -{ - "base": [ - { - "key1": "val1", - "key2": "val2" - }, - { - "key1": "val1", - "key2": "val2" - }, - { - "key1": "val1", - "key2": "val2" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BaseRefundErrorBuilder; +use AdvancedBillingLib\ApiHelper; + +$baseRefundError = BaseRefundErrorBuilder::init() + ->base( + [ + ApiHelper::deserialize('{"key1":"val1","key2":"val2"}'), + ApiHelper::deserialize('{"key1":"val1","key2":"val2"}') + ] + ) + ->build(); ``` diff --git a/doc/models/base-string-error.md b/doc/models/base-string-error.md index 24215643..28d0ca4f 100644 --- a/doc/models/base-string-error.md +++ b/doc/models/base-string-error.md @@ -13,13 +13,18 @@ The error is base if it is not directly associated with a single attribute. | --- | --- | --- | --- | --- | --- | | `base` | `?(string[])` | Optional | - | getBase(): ?array | setBase(?array base): void | -## Example (as JSON) - -```json -{ - "base": [ - "base3" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BaseStringErrorBuilder; + +$baseStringError = BaseStringErrorBuilder::init() + ->base( + [ + 'base5', + 'base6' + ] + ) + ->build(); ``` diff --git a/doc/models/basic-date-field.md b/doc/models/basic-date-field.md index 8bb95917..865cbb12 100644 --- a/doc/models/basic-date-field.md +++ b/doc/models/basic-date-field.md @@ -16,7 +16,9 @@ Allows to filter by `created_at` or `updated_at`. ## Example -``` -updated_at +```php +use AdvancedBillingLib\Models\BasicDateField; + +$basicDateField = BasicDateField::UPDATED_AT; ``` diff --git a/doc/models/batch-job-response.md b/doc/models/batch-job-response.md index 3c9df63e..affcccf0 100644 --- a/doc/models/batch-job-response.md +++ b/doc/models/batch-job-response.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `batchjob` | [`BatchJob`](../../doc/models/batch-job.md) | Required | - | getBatchjob(): BatchJob | setBatchjob(BatchJob batchjob): void | -## Example (as JSON) - -```json -{ - "batchjob": { - "id": 54, - "finished_at": "2016-03-13T12:52:32.123Z", - "row_count": 62, - "created_at": "2016-03-13T12:52:32.123Z", - "completed": "completed4" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BatchJobResponseBuilder; +use AdvancedBillingLib\Models\Builders\BatchJobBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$batchJobResponse = BatchJobResponseBuilder::init( + BatchJobBuilder::init() + ->id(54) + ->finishedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->rowCount(62) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->completed('completed4') + ->build() +)->build(); ``` diff --git a/doc/models/batch-job.md b/doc/models/batch-job.md index c4044043..54502b67 100644 --- a/doc/models/batch-job.md +++ b/doc/models/batch-job.md @@ -15,15 +15,18 @@ | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `completed` | `?string` | Optional | - | getCompleted(): ?string | setCompleted(?string completed): void | -## Example (as JSON) - -```json -{ - "id": 246, - "finished_at": "2016-03-13T12:52:32.123Z", - "row_count": 254, - "created_at": "2016-03-13T12:52:32.123Z", - "completed": "completed0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BatchJobBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$batchJob = BatchJobBuilder::init() + ->id(60) + ->finishedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->rowCount(68) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->completed('completed6') + ->build(); ``` diff --git a/doc/models/billing-manifest-item.md b/doc/models/billing-manifest-item.md index cf01e98c..1735105b 100644 --- a/doc/models/billing-manifest-item.md +++ b/doc/models/billing-manifest-item.md @@ -24,15 +24,19 @@ | `periodRangeStart` | `?string` | Optional | - | getPeriodRangeStart(): ?string | setPeriodRangeStart(?string periodRangeStart): void | | `periodRangeEnd` | `?string` | Optional | - | getPeriodRangeEnd(): ?string | setPeriodRangeEnd(?string periodRangeEnd): void | -## Example (as JSON) - -```json -{ - "transaction_type": "info_transaction", - "kind": "baseline", - "amount_in_cents": 216, - "memo": "memo4", - "discount_amount_in_cents": 236 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BillingManifestItemBuilder; +use AdvancedBillingLib\Models\LineItemTransactionType; +use AdvancedBillingLib\Models\BillingManifestLineItemKind; + +$billingManifestItem = BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::PAYMENT) + ->kind(BillingManifestLineItemKind::TRIAL) + ->amountInCents(148) + ->memo('memo0') + ->discountAmountInCents(88) + ->build(); ``` diff --git a/doc/models/billing-manifest-line-item-kind.md b/doc/models/billing-manifest-line-item-kind.md index 1f99b4e3..8172ab44 100644 --- a/doc/models/billing-manifest-line-item-kind.md +++ b/doc/models/billing-manifest-line-item-kind.md @@ -18,3 +18,11 @@ A handle for the billing manifest line item kind | `COMPONENT` | | `TAX` | +## Example + +```php +use AdvancedBillingLib\Models\BillingManifestLineItemKind; + +$billingManifestLineItemKind = BillingManifestLineItemKind::COMPONENT; +``` + diff --git a/doc/models/billing-manifest.md b/doc/models/billing-manifest.md index 220a1f53..ae50562c 100644 --- a/doc/models/billing-manifest.md +++ b/doc/models/billing-manifest.md @@ -19,37 +19,30 @@ | `periodType` | `?string` | Optional | - | getPeriodType(): ?string | setPeriodType(?string periodType): void | | `existingBalanceInCents` | `?int` | Optional | - | getExistingBalanceInCents(): ?int | setExistingBalanceInCents(?int existingBalanceInCents): void | -## Example (as JSON) - -```json -{ - "line_items": [ - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - }, - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - }, - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - } - ], - "total_in_cents": 192, - "total_discount_in_cents": 178, - "total_tax_in_cents": 172, - "subtotal_in_cents": 48 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BillingManifestBuilder; +use AdvancedBillingLib\Models\Builders\BillingManifestItemBuilder; +use AdvancedBillingLib\Models\LineItemTransactionType; +use AdvancedBillingLib\Models\BillingManifestLineItemKind; + +$billingManifest = BillingManifestBuilder::init() + ->lineItems( + [ + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build() + ] + ) + ->totalInCents(96) + ->totalDiscountInCents(174) + ->totalTaxInCents(76) + ->subtotalInCents(208) + ->build(); ``` diff --git a/doc/models/billing-schedule.md b/doc/models/billing-schedule.md index 8a57fefa..66d4f549 100644 --- a/doc/models/billing-schedule.md +++ b/doc/models/billing-schedule.md @@ -13,11 +13,14 @@ Billing schedule settings for component allocations or usages on multi-frequency | --- | --- | --- | --- | --- | --- | | `initialBillingAt` | `?DateTime` | Optional | Custom start date (ISO 8601 date, YYYY-MM-DD) for the component's first billing period. If omitted or null, billing aligns with the product schedule. If provided, date must be on or after the minimum allowed date for the subscription or component. | getInitialBillingAt(): ?\DateTime | setInitialBillingAt(?\DateTime initialBillingAt): void | -## Example (as JSON) +## Example -```json -{ - "initial_billing_at": "2026-01-01" -} +```php +use AdvancedBillingLib\Models\Builders\BillingScheduleBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$billingSchedule = BillingScheduleBuilder::init() + ->initialBillingAt(DateTimeHelper::fromSimpleDate('2026-01-01')) + ->build(); ``` diff --git a/doc/models/breakouts.md b/doc/models/breakouts.md index e0047380..9ff21fbc 100644 --- a/doc/models/breakouts.md +++ b/doc/models/breakouts.md @@ -14,14 +14,16 @@ | `usageAmountInCents` | `?int` | Optional | - | getUsageAmountInCents(): ?int | setUsageAmountInCents(?int usageAmountInCents): void | | `usageAmountFormatted` | `?string` | Optional | - | getUsageAmountFormatted(): ?string | setUsageAmountFormatted(?string usageAmountFormatted): void | -## Example (as JSON) - -```json -{ - "plan_amount_in_cents": 68, - "plan_amount_formatted": "plan_amount_formatted2", - "usage_amount_in_cents": 176, - "usage_amount_formatted": "usage_amount_formatted0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BreakoutsBuilder; + +$breakouts = BreakoutsBuilder::init() + ->planAmountInCents(254) + ->planAmountFormatted('plan_amount_formatted0') + ->usageAmountInCents(106) + ->usageAmountFormatted('usage_amount_formatted8') + ->build(); ``` diff --git a/doc/models/bulk-components-price-point-assignment.md b/doc/models/bulk-components-price-point-assignment.md index bc95984b..001c41a4 100644 --- a/doc/models/bulk-components-price-point-assignment.md +++ b/doc/models/bulk-components-price-point-assignment.md @@ -11,16 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `components` | [`?(ComponentPricePointAssignment[])`](../../doc/models/component-price-point-assignment.md) | Optional | - | getComponents(): ?array | setComponents(?array components): void | -## Example (as JSON) - -```json -{ - "components": [ - { - "component_id": 108, - "price_point": "String5" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BulkComponentsPricePointAssignmentBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointAssignmentBuilder; + +$bulkComponentsPricePointAssignment = BulkComponentsPricePointAssignmentBuilder::init() + ->components( + [ + ComponentPricePointAssignmentBuilder::init() + ->componentId(108) + ->pricePoint( + 'String5' + ) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/bulk-create-product-price-points-request.md b/doc/models/bulk-create-product-price-points-request.md index fc0092d5..783d7ece 100644 --- a/doc/models/bulk-create-product-price-points-request.md +++ b/doc/models/bulk-create-product-price-points-request.md @@ -11,24 +11,30 @@ | --- | --- | --- | --- | --- | --- | | `pricePoints` | [`CreateProductPricePoint[]`](../../doc/models/create-product-price-point.md) | Required | - | getPricePoints(): array | setPricePoints(array pricePoints): void | -## Example (as JSON) - -```json -{ - "price_points": [ - { - "name": "name2", - "price_in_cents": 108, - "interval": 92, - "interval_unit": "day", - "use_site_exchange_rate": true, - "handle": "handle8", - "trial_price_in_cents": 196, - "trial_interval": 250, - "trial_interval_unit": "day", - "trial_type": "no_obligation" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BulkCreateProductPricePointsRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateProductPricePointBuilder; +use AdvancedBillingLib\Models\IntervalUnit; +use AdvancedBillingLib\Models\TrialType; + +$bulkCreateProductPricePointsRequest = BulkCreateProductPricePointsRequestBuilder::init( + [ + CreateProductPricePointBuilder::init( + 'name2', + 108, + 92, + IntervalUnit::DAY + ) + ->handle('handle8') + ->trialPriceInCents(196) + ->trialInterval(250) + ->trialIntervalUnit(IntervalUnit::DAY) + ->trialType(TrialType::NO_OBLIGATION) + ->useSiteExchangeRate(true) + ->build() + ] +)->build(); ``` diff --git a/doc/models/bulk-create-product-price-points-response.md b/doc/models/bulk-create-product-price-points-response.md index 88730f86..5f762247 100644 --- a/doc/models/bulk-create-product-price-points-response.md +++ b/doc/models/bulk-create-product-price-points-response.md @@ -11,19 +11,38 @@ | --- | --- | --- | --- | --- | --- | | `pricePoints` | [`?(ProductPricePoint[])`](../../doc/models/product-price-point.md) | Optional | - | getPricePoints(): ?array | setPricePoints(?array pricePoints): void | -## Example (as JSON) - -```json -{ - "price_points": [ - { - "id": 40, - "name": "name2", - "handle": "handle8", - "price_in_cents": 108, - "interval": 92 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BulkCreateProductPricePointsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ProductPricePointBuilder; + +$bulkCreateProductPricePointsResponse = BulkCreateProductPricePointsResponseBuilder::init() + ->pricePoints( + [ + ProductPricePointBuilder::init() + ->id(40) + ->name('name2') + ->handle('handle8') + ->priceInCents(108) + ->interval(92) + ->build(), + ProductPricePointBuilder::init() + ->id(40) + ->name('name2') + ->handle('handle8') + ->priceInCents(108) + ->interval(92) + ->build(), + ProductPricePointBuilder::init() + ->id(40) + ->name('name2') + ->handle('handle8') + ->priceInCents(108) + ->interval(92) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/bulk-create-segments.md b/doc/models/bulk-create-segments.md index 29f670e1..d69ec172 100644 --- a/doc/models/bulk-create-segments.md +++ b/doc/models/bulk-create-segments.md @@ -11,36 +11,57 @@ | --- | --- | --- | --- | --- | --- | | `segments` | [`?(CreateSegment[])`](../../doc/models/create-segment.md) | Optional | **Constraints**: *Maximum Items*: `2000` | getSegments(): ?array | setSegments(?array segments): void | -## Example (as JSON) - -```json -{ - "segments": [ - { - "segment_property_1_value": "String3", - "segment_property_2_value": "String5", - "segment_property_3_value": "String3", - "segment_property_4_value": "String7", - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BulkCreateSegmentsBuilder; +use AdvancedBillingLib\Models\Builders\CreateSegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$bulkCreateSegments = BulkCreateSegmentsBuilder::init() + ->segments( + [ + CreateSegmentBuilder::init( + PricingScheme::STAIRSTEP + ) + ->segmentProperty1Value( + 'String3' + ) + ->segmentProperty2Value( + 'String5' + ) + ->segmentProperty3Value( + 'String3' + ) + ->segmentProperty4Value( + 'String7' + ) + ->prices( + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + ) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/bulk-update-segments-item.md b/doc/models/bulk-update-segments-item.md index b6f06990..7106d5fc 100644 --- a/doc/models/bulk-update-segments-item.md +++ b/doc/models/bulk-update-segments-item.md @@ -13,19 +13,24 @@ | `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` | [`CreateOrUpdateSegmentPrice[]`](../../doc/models/create-or-update-segment-price.md) | Required | - | getPrices(): array | setPrices(array prices): void | -## Example (as JSON) - -```json -{ - "id": 180, - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\BulkUpdateSegmentsItemBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$bulkUpdateSegmentsItem = BulkUpdateSegmentsItemBuilder::init( + 220, + PricingScheme::PER_UNIT, + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] +)->build(); ``` diff --git a/doc/models/bulk-update-segments.md b/doc/models/bulk-update-segments.md index 295e853a..22bc9b3d 100644 --- a/doc/models/bulk-update-segments.md +++ b/doc/models/bulk-update-segments.md @@ -11,54 +11,66 @@ | --- | --- | --- | --- | --- | --- | | `segments` | [`?(BulkUpdateSegmentsItem[])`](../../doc/models/bulk-update-segments-item.md) | Optional | **Constraints**: *Maximum Items*: `1000` | getSegments(): ?array | setSegments(?array segments): void | -## Example (as JSON) +## Example -```json -{ - "segments": [ - { - "id": 50, - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] - }, - { - "id": 50, - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] - } - ] -} +```php +use AdvancedBillingLib\Models\Builders\BulkUpdateSegmentsBuilder; +use AdvancedBillingLib\Models\Builders\BulkUpdateSegmentsItemBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$bulkUpdateSegments = BulkUpdateSegmentsBuilder::init() + ->segments( + [ + BulkUpdateSegmentsItemBuilder::init( + 50, + PricingScheme::STAIRSTEP, + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + )->build(), + BulkUpdateSegmentsItemBuilder::init( + 50, + PricingScheme::STAIRSTEP, + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + )->build() + ] + )->build(); ``` diff --git a/doc/models/calendar-billing.md b/doc/models/calendar-billing.md index 3d54c611..6d6f7cb0 100644 --- a/doc/models/calendar-billing.md +++ b/doc/models/calendar-billing.md @@ -1,7 +1,7 @@ # Calendar Billing -(Optional). Cannot be used when also specifying next_billing_at +(Optional). Cannot be used when also specifying next_billing_at. ## Structure @@ -14,12 +14,17 @@ | `snapDay` | int\|string\|null | Optional | This is a container for one-of cases. | getSnapDay(): | setSnapDay( snapDay): void | | `calendarBillingFirstCharge` | [`?string(FirstChargeType)`](../../doc/models/first-charge-type.md) | Optional | - | getCalendarBillingFirstCharge(): ?string | setCalendarBillingFirstCharge(?string calendarBillingFirstCharge): void | -## Example (as JSON) +## Example -```json -{ - "snap_day": 210, - "calendar_billing_first_charge": "prorated" -} +```php +use AdvancedBillingLib\Models\Builders\CalendarBillingBuilder; +use AdvancedBillingLib\Models\FirstChargeType; + +$calendarBilling = CalendarBillingBuilder::init() + ->snapDay( + 200 + ) + ->calendarBillingFirstCharge(FirstChargeType::DELAYED) + ->build(); ``` diff --git a/doc/models/cancel-grouped-subscriptions-request.md b/doc/models/cancel-grouped-subscriptions-request.md index 1b3ccee3..767157ae 100644 --- a/doc/models/cancel-grouped-subscriptions-request.md +++ b/doc/models/cancel-grouped-subscriptions-request.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `chargeUnbilledUsage` | `?bool` | Optional | - | getChargeUnbilledUsage(): ?bool | setChargeUnbilledUsage(?bool chargeUnbilledUsage): void | -## Example (as JSON) +## Example -```json -{ - "charge_unbilled_usage": false -} +```php +use AdvancedBillingLib\Models\Builders\CancelGroupedSubscriptionsRequestBuilder; + +$cancelGroupedSubscriptionsRequest = CancelGroupedSubscriptionsRequestBuilder::init() + ->chargeUnbilledUsage(false) + ->build(); ``` diff --git a/doc/models/cancellation-method.md b/doc/models/cancellation-method.md index b0b7765a..2930803f 100644 --- a/doc/models/cancellation-method.md +++ b/doc/models/cancellation-method.md @@ -18,3 +18,11 @@ The process used to cancel the subscription, if the subscription has been cancel | `UNKNOWN` | | `IMPORTED` | +## Example + +```php +use AdvancedBillingLib\Models\CancellationMethod; + +$cancellationMethod = CancellationMethod::MERCHANT_UI; +``` + diff --git a/doc/models/cancellation-options.md b/doc/models/cancellation-options.md index 265d5c5a..b1e604c5 100644 --- a/doc/models/cancellation-options.md +++ b/doc/models/cancellation-options.md @@ -12,18 +12,21 @@ | `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 | +| `scheduledCancellationAt` | `?DateTime` | Optional | Schedules the cancellation on the provided date. This 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) +## Example -```json -{ - "cancellation_message": "cancellation_message0", - "reason_code": "reason_code6", - "cancel_at_end_of_period": false, - "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", - "refund_prepayment_account_balance": false -} +```php +use AdvancedBillingLib\Models\Builders\CancellationOptionsBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$cancellationOptions = CancellationOptionsBuilder::init() + ->cancellationMessage('cancellation_message0') + ->reasonCode('reason_code6') + ->cancelAtEndOfPeriod(false) + ->scheduledCancellationAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->refundPrepaymentAccountBalance(false) + ->build(); ``` diff --git a/doc/models/cancellation-request.md b/doc/models/cancellation-request.md index 2ef48315..62bce996 100644 --- a/doc/models/cancellation-request.md +++ b/doc/models/cancellation-request.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`CancellationOptions`](../../doc/models/cancellation-options.md) | Required | - | getSubscription(): CancellationOptions | setSubscription(CancellationOptions subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "cancellation_message": "cancellation_message2", - "reason_code": "reason_code8", - "cancel_at_end_of_period": false, - "scheduled_cancellation_at": "2016-03-13T12:52:32.123Z", - "refund_prepayment_account_balance": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CancellationRequestBuilder; +use AdvancedBillingLib\Models\Builders\CancellationOptionsBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$cancellationRequest = CancellationRequestBuilder::init( + CancellationOptionsBuilder::init() + ->cancellationMessage('cancellation_message2') + ->reasonCode('reason_code8') + ->cancelAtEndOfPeriod(false) + ->scheduledCancellationAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->refundPrepaymentAccountBalance(false) + ->build() +)->build(); ``` diff --git a/doc/models/card-type.md b/doc/models/card-type.md index 2cc781b6..6ea04098 100644 --- a/doc/models/card-type.md +++ b/doc/models/card-type.md @@ -48,3 +48,11 @@ The type of card used. | `SOLO` | | `LASER` | +## Example + +```php +use AdvancedBillingLib\Models\CardType; + +$cardType = CardType::SOLO; +``` + diff --git a/doc/models/change-chargeback-status-event-data.md b/doc/models/change-chargeback-status-event-data.md index 607b3465..6c97a6a4 100644 --- a/doc/models/change-chargeback-status-event-data.md +++ b/doc/models/change-chargeback-status-event-data.md @@ -13,11 +13,14 @@ Example schema for an `change_chargeback_status` event | --- | --- | --- | --- | --- | --- | | `chargebackStatus` | [`string(ChargebackStatus)`](../../doc/models/chargeback-status.md) | Required | - | getChargebackStatus(): string | setChargebackStatus(string chargebackStatus): void | -## Example (as JSON) +## Example -```json -{ - "chargeback_status": "open" -} +```php +use AdvancedBillingLib\Models\Builders\ChangeChargebackStatusEventDataBuilder; +use AdvancedBillingLib\Models\ChargebackStatus; + +$changeChargebackStatusEventData = ChangeChargebackStatusEventDataBuilder::init( + ChargebackStatus::WON +)->build(); ``` diff --git a/doc/models/change-chargeback-status-event.md b/doc/models/change-chargeback-status-event.md index 2b336abc..10e70e72 100644 --- a/doc/models/change-chargeback-status-event.md +++ b/doc/models/change-chargeback-status-event.md @@ -15,27 +15,34 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::CHANGE_CHARGEBACK_STATUS` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`ChangeChargebackStatusEventData`](../../doc/models/change-chargeback-status-event-data.md) | Required | Example schema for an `change_chargeback_status` event | getEventData(): ChangeChargebackStatusEventData | setEventData(ChangeChargebackStatusEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 214, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "change_chargeback_status", - "event_data": { - "chargeback_status": "won" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChangeChargebackStatusEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ChangeChargebackStatusEventDataBuilder; +use AdvancedBillingLib\Models\ChargebackStatus; + +$changeChargebackStatusEvent = ChangeChargebackStatusEventBuilder::init( + 136, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::CHANGE_CHARGEBACK_STATUS, + ChangeChargebackStatusEventDataBuilder::init( + ChargebackStatus::WON + )->build() +)->build(); ``` diff --git a/doc/models/change-invoice-collection-method-event-data.md b/doc/models/change-invoice-collection-method-event-data.md index 8846894a..d7e78510 100644 --- a/doc/models/change-invoice-collection-method-event-data.md +++ b/doc/models/change-invoice-collection-method-event-data.md @@ -14,12 +14,14 @@ Example schema for an `change_invoice_collection_method` event | `fromCollectionMethod` | `string` | Required | The previous collection method of the invoice. | getFromCollectionMethod(): string | setFromCollectionMethod(string fromCollectionMethod): void | | `toCollectionMethod` | `string` | Required | The new collection method of the invoice. | getToCollectionMethod(): string | setToCollectionMethod(string toCollectionMethod): void | -## Example (as JSON) +## Example -```json -{ - "from_collection_method": "from_collection_method4", - "to_collection_method": "to_collection_method2" -} +```php +use AdvancedBillingLib\Models\Builders\ChangeInvoiceCollectionMethodEventDataBuilder; + +$changeInvoiceCollectionMethodEventData = ChangeInvoiceCollectionMethodEventDataBuilder::init( + 'from_collection_method8', + 'to_collection_method4' +)->build(); ``` diff --git a/doc/models/change-invoice-collection-method-event.md b/doc/models/change-invoice-collection-method-event.md index a79cb739..62e1887e 100644 --- a/doc/models/change-invoice-collection-method-event.md +++ b/doc/models/change-invoice-collection-method-event.md @@ -15,28 +15,34 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`ChangeInvoiceCollectionMethodEventData`](../../doc/models/change-invoice-collection-method-event-data.md) | Required | Example schema for an `change_invoice_collection_method` event | getEventData(): ChangeInvoiceCollectionMethodEventData | setEventData(ChangeInvoiceCollectionMethodEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 246, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "change_invoice_collection_method", - "event_data": { - "from_collection_method": "from_collection_method4", - "to_collection_method": "to_collection_method8" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChangeInvoiceCollectionMethodEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ChangeInvoiceCollectionMethodEventDataBuilder; + +$changeInvoiceCollectionMethodEvent = ChangeInvoiceCollectionMethodEventBuilder::init( + 110, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::CHANGE_INVOICE_COLLECTION_METHOD, + ChangeInvoiceCollectionMethodEventDataBuilder::init( + 'from_collection_method4', + 'to_collection_method8' + )->build() +)->build(); ``` diff --git a/doc/models/change-invoice-status-event-data.md b/doc/models/change-invoice-status-event-data.md index 459f2e38..2e058f45 100644 --- a/doc/models/change-invoice-status-event-data.md +++ b/doc/models/change-invoice-status-event-data.md @@ -17,15 +17,20 @@ Example schema for an `change_invoice_status` event | `toStatus` | [`string(InvoiceStatus)`](../../doc/models/invoice-status.md) | Required | The updated status of the invoice after changes have been made. See [Invoice Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview#invoice-statuses) for more. | getToStatus(): string | setToStatus(string toStatus): void | | `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | - | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | -## Example (as JSON) - -```json -{ - "gateway_trans_id": "gateway_trans_id2", - "amount": "amount2", - "from_status": "draft", - "to_status": "pending", - "consolidation_level": "none" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChangeInvoiceStatusEventDataBuilder; +use AdvancedBillingLib\Models\InvoiceStatus; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; + +$changeInvoiceStatusEventData = ChangeInvoiceStatusEventDataBuilder::init( + InvoiceStatus::CANCELED, + InvoiceStatus::PROCESSING +) + ->gatewayTransId('gateway_trans_id4') + ->amount('amount6') + ->consolidationLevel(InvoiceConsolidationLevel::PARENT_) + ->build(); ``` diff --git a/doc/models/change-invoice-status-event.md b/doc/models/change-invoice-status-event.md index 8e65553c..eed404b7 100644 --- a/doc/models/change-invoice-status-event.md +++ b/doc/models/change-invoice-status-event.md @@ -15,31 +15,40 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::CHANGE_INVOICE_STATUS` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`ChangeInvoiceStatusEventData`](../../doc/models/change-invoice-status-event-data.md) | Required | Example schema for an `change_invoice_status` event | getEventData(): ChangeInvoiceStatusEventData | setEventData(ChangeInvoiceStatusEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 92, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "change_invoice_status", - "event_data": { - "gateway_trans_id": "gateway_trans_id2", - "amount": "amount8", - "from_status": "open", - "to_status": "pending", - "consolidation_level": "child" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChangeInvoiceStatusEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceStatus; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ChangeInvoiceStatusEventDataBuilder; + +$changeInvoiceStatusEvent = ChangeInvoiceStatusEventBuilder::init( + 148, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::CHANGE_INVOICE_STATUS, + ChangeInvoiceStatusEventDataBuilder::init( + InvoiceStatus::OPEN, + InvoiceStatus::PENDING + ) + ->gatewayTransId('gateway_trans_id2') + ->amount('amount8') + ->consolidationLevel(InvoiceConsolidationLevel::CHILD) + ->build() +)->build(); ``` diff --git a/doc/models/chargeback-status.md b/doc/models/chargeback-status.md index 5541f264..b6a2eee7 100644 --- a/doc/models/chargeback-status.md +++ b/doc/models/chargeback-status.md @@ -16,3 +16,11 @@ The current chargeback status. | `WON` | | `CLOSED` | +## Example + +```php +use AdvancedBillingLib\Models\ChargebackStatus; + +$chargebackStatus = ChargebackStatus::OPEN; +``` + diff --git a/doc/models/chargify-ebb.md b/doc/models/chargify-ebb.md index db4ed3e1..d66d1f00 100644 --- a/doc/models/chargify-ebb.md +++ b/doc/models/chargify-ebb.md @@ -16,15 +16,18 @@ | `subscriptionId` | `?int` | Optional | Id of Maxio Advanced Billing Subscription which is connected to this event.
Provide `subscription_id` if you configured `chargify.subscription_id` as Subscription Identifier in your Event Stream. | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `subscriptionReference` | `?string` | Optional | Reference of Maxio Advanced Billing Subscription which is connected to this event.
Provide `subscription_reference` if you configured `chargify.subscription_reference` as Subscription Identifier in your Event Stream. | getSubscriptionReference(): ?string | setSubscriptionReference(?string subscriptionReference): void | -## Example (as JSON) - -```json -{ - "timestamp": "2016-03-13T12:52:32.123Z", - "id": "id4", - "created_at": "2016-03-13T12:52:32.123Z", - "uniqueness_token": "uniqueness_token0", - "subscription_id": 200 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChargifyEBBBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$chargifyEBB = ChargifyEBBBuilder::init() + ->timestamp(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->id('id2') + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->uniquenessToken('uniqueness_token8') + ->subscriptionId(224) + ->build(); ``` diff --git a/doc/models/chjs-tokenization-failure.md b/doc/models/chjs-tokenization-failure.md index c4b4a632..d610cee7 100644 --- a/doc/models/chjs-tokenization-failure.md +++ b/doc/models/chjs-tokenization-failure.md @@ -12,16 +12,22 @@ | `errors` | `string` | Required | - | getErrors(): string | setErrors(string errors): void | | `paymentProfileParams` | [`?PaymentProfileParams`](../../doc/models/payment-profile-params.md) | Optional | PCI-safe cardholder fields only. Full card numbers, CVV, and billing address are never included. | getPaymentProfileParams(): ?PaymentProfileParams | setPaymentProfileParams(?PaymentProfileParams paymentProfileParams): void | -## Example (as JSON) - -```json -{ - "errors": "errors2", - "payment_profile_params": { - "first_name": "first_name2", - "last_name": "last_name0", - "card_type": "card_type2" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChjsTokenizationFailureBuilder; +use AdvancedBillingLib\Models\Builders\PaymentProfileParamsBuilder; + +$chjsTokenizationFailure = ChjsTokenizationFailureBuilder::init( + 'errors2' +) + ->paymentProfileParams( + PaymentProfileParamsBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->cardType('card_type2') + ->build() + ) + ->build(); ``` diff --git a/doc/models/chjs-tokenization-success.md b/doc/models/chjs-tokenization-success.md index 0f4f7241..35a0946c 100644 --- a/doc/models/chjs-tokenization-success.md +++ b/doc/models/chjs-tokenization-success.md @@ -12,17 +12,22 @@ | `paymentProfile` | [`TokenizedPaymentProfile`](../../doc/models/tokenized-payment-profile.md) | Required | - | getPaymentProfile(): TokenizedPaymentProfile | setPaymentProfile(TokenizedPaymentProfile paymentProfile): void | | `gatewayCustomerId` | `?int` | Optional | - | getGatewayCustomerId(): ?int | setGatewayCustomerId(?int gatewayCustomerId): void | -## Example (as JSON) - -```json -{ - "payment_profile": { - "id": 44, - "vault_token": "vault_token6", - "gateway_handle": "gateway_handle4", - "customer_vault_token": "customer_vault_token2" - }, - "gateway_customer_id": 44 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ChjsTokenizationSuccessBuilder; +use AdvancedBillingLib\Models\Builders\TokenizedPaymentProfileBuilder; + +$chjsTokenizationSuccess = ChjsTokenizationSuccessBuilder::init( + TokenizedPaymentProfileBuilder::init( + 44 + ) + ->vaultToken('vault_token6') + ->gatewayHandle('gateway_handle4') + ->customerVaultToken('customer_vault_token2') + ->build() +) + ->gatewayCustomerId(228) + ->build(); ``` diff --git a/doc/models/cleanup-scope.md b/doc/models/cleanup-scope.md index 234cc07c..5673d625 100644 --- a/doc/models/cleanup-scope.md +++ b/doc/models/cleanup-scope.md @@ -14,3 +14,11 @@ all: Will clear all products, customers, and related subscriptions from the site | `ALL` | | `CUSTOMERS` | +## Example + +```php +use AdvancedBillingLib\Models\CleanupScope; + +$cleanupScope = CleanupScope::ALL; +``` + diff --git a/doc/models/clone-component-price-point-request.md b/doc/models/clone-component-price-point-request.md index d418462e..82827f5e 100644 --- a/doc/models/clone-component-price-point-request.md +++ b/doc/models/clone-component-price-point-request.md @@ -11,14 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `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" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CloneComponentPricePointRequestBuilder; +use AdvancedBillingLib\Models\Builders\CloneComponentPricePointBuilder; + +$cloneComponentPricePointRequest = CloneComponentPricePointRequestBuilder::init( + CloneComponentPricePointBuilder::init( + 'name0' + ) + ->handle('handle6') + ->build() +)->build(); ``` diff --git a/doc/models/clone-component-price-point.md b/doc/models/clone-component-price-point.md index 25b3fd3b..2909eeb5 100644 --- a/doc/models/clone-component-price-point.md +++ b/doc/models/clone-component-price-point.md @@ -12,12 +12,15 @@ | `name` | `string` | Required | - | getName(): string | setName(string name): void | | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | -## Example (as JSON) +## Example -```json -{ - "name": "name2", - "handle": "handle8" -} +```php +use AdvancedBillingLib\Models\Builders\CloneComponentPricePointBuilder; + +$cloneComponentPricePoint = CloneComponentPricePointBuilder::init( + 'name4' +) + ->handle('handle0') + ->build(); ``` diff --git a/doc/models/collection-method-1.md b/doc/models/collection-method-1.md new file mode 100644 index 00000000..6122e91b --- /dev/null +++ b/doc/models/collection-method-1.md @@ -0,0 +1,23 @@ + +# Collection Method 1 + +## Enumeration + +`CollectionMethod1` + +## Fields + +| Name | +| --- | +| `AUTOMATIC` | +| `REMITTANCE` | +| `PREPAID` | + +## Example + +```php +use AdvancedBillingLib\Models\CollectionMethod1; + +$collectionMethod1 = CollectionMethod1::AUTOMATIC; +``` + diff --git a/doc/models/collection-method.md b/doc/models/collection-method.md index 50b7215d..bbd15d6c 100644 --- a/doc/models/collection-method.md +++ b/doc/models/collection-method.md @@ -16,3 +16,11 @@ The type of payment collection to be used in the subscription. For legacy Statem | `PREPAID` | | `INVOICE` | +## Example + +```php +use AdvancedBillingLib\Models\CollectionMethod; + +$collectionMethod = CollectionMethod::AUTOMATIC; +``` + diff --git a/doc/models/component-allocation-change.md b/doc/models/component-allocation-change.md index 1a618288..390cbcab 100644 --- a/doc/models/component-allocation-change.md +++ b/doc/models/component-allocation-change.md @@ -17,17 +17,22 @@ | `allocationId` | `int` | Required | - | getAllocationId(): int | setAllocationId(int allocationId): void | | `allocatedQuantity` | int\|string\|null | Optional | This is a container for one-of cases. | getAllocatedQuantity(): | setAllocatedQuantity( allocatedQuantity): void | -## Example (as JSON) - -```json -{ - "previous_allocation": 94, - "new_allocation": 102, - "component_id": 88, - "component_handle": "component_handle8", - "memo": "memo2", - "allocation_id": 158, - "allocated_quantity": 104 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentAllocationChangeBuilder; + +$componentAllocationChange = ComponentAllocationChangeBuilder::init( + 78, + 118, + 72, + 'component_handle8', + 'memo2', + 174 +) + ->allocatedQuantity( + 88 + ) + ->build(); ``` diff --git a/doc/models/component-allocation-error-exception.md b/doc/models/component-allocation-error-exception.md index 38389e89..0c7e0963 100644 --- a/doc/models/component-allocation-error-exception.md +++ b/doc/models/component-allocation-error-exception.md @@ -11,30 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?(ComponentAllocationErrorItem[])`](../../doc/models/component-allocation-error-item.md) | Optional | - | getErrors(): ?array | setErrors(?array errors): void | -## Example (as JSON) - -```json -{ - "errors": [ - { - "component_id": 236, - "message": "message0", - "kind": "kind8", - "on": "on0" - }, - { - "component_id": 236, - "message": "message0", - "kind": "kind8", - "on": "on0" - }, - { - "component_id": 236, - "message": "message0", - "kind": "kind8", - "on": "on0" - } - ] +## Example + +```php +try { + // make the API call +} catch (ComponentAllocationErrorException $exp) { + echo 'Caught ComponentAllocationErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/component-allocation-error-item.md b/doc/models/component-allocation-error-item.md index 945547b0..dc51de86 100644 --- a/doc/models/component-allocation-error-item.md +++ b/doc/models/component-allocation-error-item.md @@ -14,14 +14,16 @@ | `kind` | `?string` | Optional | - | getKind(): ?string | setKind(?string kind): void | | `on` | `?string` | Optional | - | getOn(): ?string | setOn(?string on): void | -## Example (as JSON) - -```json -{ - "component_id": 188, - "message": "message0", - "kind": "kind8", - "on": "on0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentAllocationErrorItemBuilder; + +$componentAllocationErrorItem = ComponentAllocationErrorItemBuilder::init() + ->componentId(122) + ->message('message8') + ->kind('kind6') + ->on('on8') + ->build(); ``` diff --git a/doc/models/component-cost-data-rate-tier.md b/doc/models/component-cost-data-rate-tier.md index 0512abfd..ab289261 100644 --- a/doc/models/component-cost-data-rate-tier.md +++ b/doc/models/component-cost-data-rate-tier.md @@ -15,15 +15,17 @@ | `unitPrice` | `?string` | Optional | - | getUnitPrice(): ?string | setUnitPrice(?string unitPrice): void | | `amount` | `?string` | Optional | - | getAmount(): ?string | setAmount(?string amount): void | -## Example (as JSON) - -```json -{ - "starting_quantity": 132, - "ending_quantity": 106, - "quantity": "quantity0", - "unit_price": "unit_price2", - "amount": "amount6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentCostDataRateTierBuilder; + +$componentCostDataRateTier = ComponentCostDataRateTierBuilder::init() + ->startingQuantity(204) + ->endingQuantity(178) + ->quantity('quantity4') + ->unitPrice('unit_price6') + ->amount('amount0') + ->build(); ``` diff --git a/doc/models/component-cost-data.md b/doc/models/component-cost-data.md index 24276946..6d7941ee 100644 --- a/doc/models/component-cost-data.md +++ b/doc/models/component-cost-data.md @@ -17,15 +17,17 @@ | `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 | | `tiers` | [`?(ComponentCostDataRateTier[])`](../../doc/models/component-cost-data-rate-tier.md) | Optional | - | getTiers(): ?array | setTiers(?array tiers): void | -## Example (as JSON) - -```json -{ - "component_code_id": 16, - "price_point_id": 186, - "product_id": 250, - "quantity": "quantity8", - "amount": "amount4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentCostDataBuilder; + +$componentCostData = ComponentCostDataBuilder::init() + ->componentCodeId(40) + ->pricePointId(210) + ->productId(18) + ->quantity('quantity4') + ->amount('amount0') + ->build(); ``` diff --git a/doc/models/component-currency-price.md b/doc/models/component-currency-price.md index 06815d96..e3063f94 100644 --- a/doc/models/component-currency-price.md +++ b/doc/models/component-currency-price.md @@ -16,15 +16,17 @@ | `priceId` | `?int` | Optional | - | getPriceId(): ?int | setPriceId(?int priceId): void | | `pricePointId` | `?int` | Optional | - | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | -## Example (as JSON) - -```json -{ - "id": 4, - "currency": "currency8", - "price": "price4", - "formatted_price": "formatted_price6", - "price_id": 162 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentCurrencyPriceBuilder; + +$componentCurrencyPrice = ComponentCurrencyPriceBuilder::init() + ->id(128) + ->currency('currency2') + ->price('price4') + ->formattedPrice('formatted_price6') + ->priceId(38) + ->build(); ``` diff --git a/doc/models/component-currency-prices-response.md b/doc/models/component-currency-prices-response.md index 50c7bf72..2d97f220 100644 --- a/doc/models/component-currency-prices-response.md +++ b/doc/models/component-currency-prices-response.md @@ -11,19 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`ComponentCurrencyPrice[]`](../../doc/models/component-currency-price.md) | Required | - | getCurrencyPrices(): array | setCurrencyPrices(array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "id": 50, - "currency": "currency8", - "price": "price4", - "formatted_price": "formatted_price6", - "price_id": 116 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentCurrencyPricesResponseBuilder; +use AdvancedBillingLib\Models\Builders\ComponentCurrencyPriceBuilder; + +$componentCurrencyPricesResponse = ComponentCurrencyPricesResponseBuilder::init( + [ + ComponentCurrencyPriceBuilder::init() + ->id(50) + ->currency('currency8') + ->price('price4') + ->formattedPrice('formatted_price6') + ->priceId(116) + ->build() + ] +)->build(); ``` diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index 1c152b69..3e4f229c 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -12,10 +12,10 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | 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) | 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 | +| `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. e.g., 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 | -| `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 | +| `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 | @@ -23,22 +23,31 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | `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 | | `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only when rollover is enabled. Interval unit for rollover expiration (month or day). | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | -## Example (as JSON) - -```json -{ - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "tax_included": false, - "pricing_scheme": "stairstep", - "interval": 162, - "interval_unit": "day", - "list_price_point_id": 146 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\IntervalUnit; + +$componentCustomPrice = ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] +) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(58) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(182) + ->build(); ``` diff --git a/doc/models/component-kind.md b/doc/models/component-kind.md index f8b65b77..3b007ef0 100644 --- a/doc/models/component-kind.md +++ b/doc/models/component-kind.md @@ -17,3 +17,11 @@ A handle for the component type | `PREPAID_USAGE_COMPONENT` | | `EVENT_BASED_COMPONENT` | +## Example + +```php +use AdvancedBillingLib\Models\ComponentKind; + +$componentKind = ComponentKind::PREPAID_USAGE_COMPONENT; +``` + diff --git a/doc/models/component-price-point-assignment.md b/doc/models/component-price-point-assignment.md index 4c5d1848..7a2e856a 100644 --- a/doc/models/component-price-point-assignment.md +++ b/doc/models/component-price-point-assignment.md @@ -12,12 +12,16 @@ | `componentId` | `?int` | Optional | - | getComponentId(): ?int | setComponentId(?int componentId): void | | `pricePoint` | string\|int\|null | Optional | This is a container for one-of cases. | getPricePoint(): | setPricePoint( pricePoint): void | -## Example (as JSON) +## Example -```json -{ - "component_id": 114, - "price_point": "String9" -} +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointAssignmentBuilder; + +$componentPricePointAssignment = ComponentPricePointAssignmentBuilder::init() + ->componentId(190) + ->pricePoint( + 'String7' + ) + ->build(); ``` diff --git a/doc/models/component-price-point-currency-overage-response.md b/doc/models/component-price-point-currency-overage-response.md index 836b0469..1e0c01b8 100644 --- a/doc/models/component-price-point-currency-overage-response.md +++ b/doc/models/component-price-point-currency-overage-response.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `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" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointCurrencyOverageResponseBuilder; +use AdvancedBillingLib\Models\Builders\CurrencyOveragePricesBuilder; +use AdvancedBillingLib\Models\PricePointType; +use AdvancedBillingLib\Models\PricingScheme; + +$componentPricePointCurrencyOverageResponse = ComponentPricePointCurrencyOverageResponseBuilder::init( + CurrencyOveragePricesBuilder::init() + ->id(248) + ->type(PricePointType::DEFAULT_) + ->default(false) + ->name('name0') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build() +)->build(); ``` diff --git a/doc/models/component-price-point-error-exception.md b/doc/models/component-price-point-error-exception.md index e3b352a1..f6b3fc80 100644 --- a/doc/models/component-price-point-error-exception.md +++ b/doc/models/component-price-point-error-exception.md @@ -11,22 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?(ComponentPricePointErrorItem[])`](../../doc/models/component-price-point-error-item.md) | Optional | - | getErrors(): ?array | setErrors(?array errors): void | -## Example (as JSON) - -```json -{ - "errors": [ - { - "component_id": 236, - "message": "message0", - "price_point": 122 - }, - { - "component_id": 236, - "message": "message0", - "price_point": 122 - } - ] +## Example + +```php +try { + // make the API call +} catch (ComponentPricePointErrorException $exp) { + echo 'Caught ComponentPricePointErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/component-price-point-error-item.md b/doc/models/component-price-point-error-item.md index a013a5f1..0f91d359 100644 --- a/doc/models/component-price-point-error-item.md +++ b/doc/models/component-price-point-error-item.md @@ -13,13 +13,15 @@ | `message` | `?string` | Optional | - | getMessage(): ?string | setMessage(?string message): void | | `pricePoint` | `?int` | Optional | - | getPricePoint(): ?int | setPricePoint(?int pricePoint): void | -## Example (as JSON) - -```json -{ - "component_id": 206, - "message": "message4", - "price_point": 152 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointErrorItemBuilder; + +$componentPricePointErrorItem = ComponentPricePointErrorItemBuilder::init() + ->componentId(174) + ->message('message2') + ->pricePoint(72) + ->build(); ``` diff --git a/doc/models/component-price-point-item.md b/doc/models/component-price-point-item.md index 3fecf658..97afb3c9 100644 --- a/doc/models/component-price-point-item.md +++ b/doc/models/component-price-point-item.md @@ -12,19 +12,23 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): 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 | -| `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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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) | Optional | - | getPrices(): ?array | setPrices(?array prices): void | -## Example (as JSON) +## Example -```json -{ - "name": "name6", - "handle": "handle2", - "pricing_scheme": "per_unit", - "interval": 196, - "interval_unit": "day" -} +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointItemBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\IntervalUnit; + +$componentPricePointItem = ComponentPricePointItemBuilder::init() + ->name('name8') + ->handle('handle4') + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(138) + ->intervalUnit(IntervalUnit::DAY) + ->build(); ``` diff --git a/doc/models/component-price-point-response.md b/doc/models/component-price-point-response.md index 80a4cc5a..6928feb8 100644 --- a/doc/models/component-price-point-response.md +++ b/doc/models/component-price-point-response.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `pricePoint` | [`ComponentPricePoint`](../../doc/models/component-price-point.md) | Required | - | getPricePoint(): ComponentPricePoint | setPricePoint(ComponentPricePoint pricePoint): void | -## Example (as JSON) - -```json -{ - "price_point": { - "id": 248, - "type": "default", - "default": false, - "name": "name0", - "pricing_scheme": "per_unit" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointResponseBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricePointType; +use AdvancedBillingLib\Models\PricingScheme; + +$componentPricePointResponse = ComponentPricePointResponseBuilder::init( + ComponentPricePointBuilder::init() + ->id(248) + ->type(PricePointType::DEFAULT_) + ->default(false) + ->name('name0') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build() +)->build(); ``` diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md index 425a420a..7740edd2 100644 --- a/doc/models/component-price-point.md +++ b/doc/models/component-price-point.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `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 | +| `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 | @@ -23,7 +23,7 @@ | `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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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 | @@ -33,15 +33,19 @@ | `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 | -## Example (as JSON) +## Example -```json -{ - "id": 190, - "type": "custom", - "default": false, - "name": "name2", - "pricing_scheme": "stairstep" -} +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricePointType; +use AdvancedBillingLib\Models\PricingScheme; + +$componentPricePoint = ComponentPricePointBuilder::init() + ->id(122) + ->type(PricePointType::CATALOG) + ->default(false) + ->name('name2') + ->pricingScheme(PricingScheme::STAIRSTEP) + ->build(); ``` diff --git a/doc/models/component-price-points-response.md b/doc/models/component-price-points-response.md index 0a0f2caf..81e99838 100644 --- a/doc/models/component-price-points-response.md +++ b/doc/models/component-price-points-response.md @@ -12,32 +12,49 @@ | `pricePoints` | [`?(ComponentPricePoint[])`](../../doc/models/component-price-point.md) | Optional | - | getPricePoints(): ?array | setPricePoints(?array pricePoints): void | | `meta` | [`?ListPublicKeysMeta`](../../doc/models/list-public-keys-meta.md) | Optional | - | getMeta(): ?ListPublicKeysMeta | setMeta(?ListPublicKeysMeta meta): void | -## Example (as JSON) - -```json -{ - "price_points": [ - { - "id": 40, - "type": "default", - "default": false, - "name": "name2", - "pricing_scheme": "per_unit" - }, - { - "id": 40, - "type": "default", - "default": false, - "name": "name2", - "pricing_scheme": "per_unit" - } - ], - "meta": { - "total_count": 150, - "current_page": 126, - "total_pages": 138, - "per_page": 152 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentPricePointsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricePointType; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\ListPublicKeysMetaBuilder; + +$componentPricePointsResponse = ComponentPricePointsResponseBuilder::init() + ->pricePoints( + [ + ComponentPricePointBuilder::init() + ->id(40) + ->type(PricePointType::DEFAULT_) + ->default(false) + ->name('name2') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build(), + ComponentPricePointBuilder::init() + ->id(40) + ->type(PricePointType::DEFAULT_) + ->default(false) + ->name('name2') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build(), + ComponentPricePointBuilder::init() + ->id(40) + ->type(PricePointType::DEFAULT_) + ->default(false) + ->name('name2') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build() + ] + ) + ->meta( + ListPublicKeysMetaBuilder::init() + ->totalCount(150) + ->currentPage(126) + ->totalPages(138) + ->perPage(152) + ->build() + ) + ->build(); ``` diff --git a/doc/models/component-price.md b/doc/models/component-price.md index dd2af440..ebd5aef6 100644 --- a/doc/models/component-price.md +++ b/doc/models/component-price.md @@ -18,15 +18,17 @@ | `formattedUnitPrice` | `?string` | Optional | - | getFormattedUnitPrice(): ?string | setFormattedUnitPrice(?string formattedUnitPrice): void | | `segmentId` | `?int` | Optional | - | getSegmentId(): ?int | setSegmentId(?int segmentId): void | -## Example (as JSON) - -```json -{ - "id": 234, - "component_id": 88, - "starting_quantity": 104, - "ending_quantity": 78, - "unit_price": "unit_price0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentPriceBuilder; + +$componentPrice = ComponentPriceBuilder::init() + ->id(18) + ->componentId(128) + ->startingQuantity(64) + ->endingQuantity(218) + ->unitPrice('unit_price4') + ->build(); ``` diff --git a/doc/models/component-response.md b/doc/models/component-response.md index 73170b3a..eb76cd31 100644 --- a/doc/models/component-response.md +++ b/doc/models/component-response.md @@ -11,18 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `component` | [`Component`](../../doc/models/component.md) | Required | - | getComponent(): Component | setComponent(Component component): void | -## Example (as JSON) - -```json -{ - "component": { - "item_category": "Business Software", - "id": 80, - "name": "name8", - "handle": "handle4", - "pricing_scheme": "per_unit", - "unit_name": "unit_name0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentResponseBuilder; +use AdvancedBillingLib\Models\Builders\ComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\ItemCategory; + +$componentResponse = ComponentResponseBuilder::init( + ComponentBuilder::init() + ->id(80) + ->name('name8') + ->handle('handle4') + ->pricingScheme(PricingScheme::PER_UNIT) + ->unitName('unit_name0') + ->itemCategory(ItemCategory::ENUM_BUSINESS_SOFTWARE) + ->build() +)->build(); ``` diff --git a/doc/models/component.md b/doc/models/component.md index 42e6d7fb..66d4557e 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -10,15 +10,15 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `id` | `?int` | Optional | The unique ID assigned to the component by Chargify. This ID can be used to fetch the component from the API. | getId(): ?int | setId(?int id): void | -| `name` | `?string` | Optional | The name of the Component, suitable for display on statements. i.e. Text Messages. | getName(): ?string | setName(?string name): void | +| `name` | `?string` | Optional | The name of the Component, suitable for display on statements. e.g., Text Messages. | getName(): ?string | setName(?string name): void | | `handle` | `?string` | Optional | The component API handle | getHandle(): ?string | setHandle(?string handle): void | | `pricingScheme` | [`?string(PricingScheme)`](../../doc/models/pricing-scheme.md) | Optional | - | getPricingScheme(): ?string | setPricingScheme(?string pricingScheme): void | -| `unitName` | `?string` | Optional | The name of the unit that the component’s usage is measured in. i.e. message | getUnitName(): ?string | setUnitName(?string unitName): void | +| `unitName` | `?string` | Optional | The name of the unit that the component’s usage is measured in. e.g., message | getUnitName(): ?string | setUnitName(?string unitName): void | | `unitPrice` | `?string` | Optional | The amount the customer will be charged per unit. This field is only populated for ‘per_unit’ pricing schemes, otherwise it may be null. | getUnitPrice(): ?string | setUnitPrice(?string unitPrice): void | | `productFamilyId` | `?int` | Optional | The id of the Product Family to which the Component belongs | getProductFamilyId(): ?int | setProductFamilyId(?int productFamilyId): void | | `productFamilyName` | `?string` | Optional | The name of the Product Family to which the Component belongs | getProductFamilyName(): ?string | setProductFamilyName(?string productFamilyName): void | | `productFamilyHandle` | `?string` | Optional | The handle of the Product Family to which the Component belongs | getProductFamilyHandle(): ?string | setProductFamilyHandle(?string productFamilyHandle): void | -| `pricePerUnitInCents` | `?int` | Optional | deprecated - use unit_price instead | getPricePerUnitInCents(): ?int | setPricePerUnitInCents(?int pricePerUnitInCents): void | +| `pricePerUnitInCents` | `?int` | Optional | deprecated - use unit_price instead. | getPricePerUnitInCents(): ?int | setPricePerUnitInCents(?int pricePerUnitInCents): void | | `kind` | [`?string(ComponentKind)`](../../doc/models/component-kind.md) | Optional | A handle for the component type | getKind(): ?string | setKind(?string kind): void | | `archived` | `?bool` | Optional | Boolean flag describing whether a component is archived or not. | getArchived(): ?bool | setArchived(?bool archived): void | | `description` | `?string` | Optional | The description of the component. | getDescription(): ?string | setDescription(?string description): void | @@ -42,19 +42,24 @@ | `useSiteExchangeRate` | `?bool` | Optional | - | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | | `accountingCode` | `?string` | Optional | E.g. Internal ID or SKU Number | getAccountingCode(): ?string | setAccountingCode(?string accountingCode): void | | `eventBasedBillingMetricId` | `?int` | Optional | (Only for Event Based Components) This is an ID of a metric attached to the component. This metric is used to bill upon collected events. | getEventBasedBillingMetricId(): ?int | setEventBasedBillingMetricId(?int eventBasedBillingMetricId): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this component’s default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | -## Example (as JSON) - -```json -{ - "item_category": "Business Software", - "id": 24, - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "unit_name": "unit_name4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\ItemCategory; + +$component = ComponentBuilder::init() + ->id(80) + ->name('name8') + ->handle('handle4') + ->pricingScheme(PricingScheme::PER_UNIT) + ->unitName('unit_name0') + ->itemCategory(ItemCategory::ENUM_BUSINESS_SOFTWARE) + ->build(); ``` diff --git a/doc/models/compounding-strategy.md b/doc/models/compounding-strategy.md index ec68b1f7..69d10f70 100644 --- a/doc/models/compounding-strategy.md +++ b/doc/models/compounding-strategy.md @@ -14,3 +14,11 @@ Applicable only to stackable coupons. For `compound`, Percentage-based discounts | `COMPOUND` | | `FULLPRICE` | +## Example + +```php +use AdvancedBillingLib\Models\CompoundingStrategy; + +$compoundingStrategy = CompoundingStrategy::COMPOUND; +``` + diff --git a/doc/models/consolidated-invoice.md b/doc/models/consolidated-invoice.md index a299859e..867ea384 100644 --- a/doc/models/consolidated-invoice.md +++ b/doc/models/consolidated-invoice.md @@ -11,26 +11,38 @@ | --- | --- | --- | --- | --- | --- | | `invoices` | [`?(Invoice[])`](../../doc/models/invoice.md) | Optional | - | getInvoices(): ?array | setInvoices(?array invoices): void | -## Example (as JSON) - -```json -{ - "invoices": [ - { - "id": 196, - "uid": "uid6", - "site_id": 122, - "customer_id": 234, - "subscription_id": 50 - }, - { - "id": 196, - "uid": "uid6", - "site_id": 122, - "customer_id": 234, - "subscription_id": 50 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ConsolidatedInvoiceBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; + +$consolidatedInvoice = ConsolidatedInvoiceBuilder::init() + ->invoices( + [ + InvoiceBuilder::init() + ->id(196) + ->uid('uid6') + ->siteId(122) + ->customerId(234) + ->subscriptionId(50) + ->build(), + InvoiceBuilder::init() + ->id(196) + ->uid('uid6') + ->siteId(122) + ->customerId(234) + ->subscriptionId(50) + ->build(), + InvoiceBuilder::init() + ->id(196) + ->uid('uid6') + ->siteId(122) + ->customerId(234) + ->subscriptionId(50) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/containers/create-subscription-component-unit-balance.md b/doc/models/containers/create-subscription-component-unit-balance.md new file mode 100644 index 00000000..3925bdeb --- /dev/null +++ b/doc/models/containers/create-subscription-component-unit-balance.md @@ -0,0 +1,34 @@ + +# Create Subscription Component Unit Balance + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/event-event-specific-data.md b/doc/models/containers/event-event-specific-data.md index f0864e61..493f2629 100644 --- a/doc/models/containers/event-event-specific-data.md +++ b/doc/models/containers/event-event-specific-data.md @@ -109,7 +109,7 @@ $value = ComponentAllocationChangeBuilder::init( ```php $value = MeteredUsageBuilder::init( 'previous_unit_balance6', - 80, + 2, 42, 4, 'component_handle8', @@ -127,8 +127,8 @@ $value = MeteredUsageBuilder::init( $value = PrepaidUsageBuilder::init( 'previous_unit_balance0', 'previous_overage_unit_balance4', - 252, - 224, + 174, + 146, 214, 106, 176, diff --git a/doc/models/containers/get-one-time-token-request-payment-profile.md b/doc/models/containers/get-one-time-token-request-payment-profile.md new file mode 100644 index 00000000..fc22c461 --- /dev/null +++ b/doc/models/containers/get-one-time-token-request-payment-profile.md @@ -0,0 +1,69 @@ + +# Get One Time Token Request Payment Profile + +## Data Type + +`GetOneTimeTokenPaymentProfile|GetOneTimeTokenBankAccountPaymentProfile` + +## Cases + +| Type | +| --- | +| [`GetOneTimeTokenPaymentProfile`](../../../doc/models/get-one-time-token-payment-profile.md) | +| [`GetOneTimeTokenBankAccountPaymentProfile`](../../../doc/models/get-one-time-token-bank-account-payment-profile.md) | + +## GetOneTimeTokenPaymentProfile + +### Initialization Code + +#### Example + +```php +$value = GetOneTimeTokenPaymentProfileBuilder::init( + 'first_name2', + 'last_name0', + 'masked_card_number0', + CardType::ROUTEX, + 187.78, + 164.44, + CreditCardVault::BRAINTREE_BLUE, + 'vault_token4', + 'billing_address4', + 'billing_city0', + 'billing_country6', + 'billing_state6', + 'billing_zip0', + 'payment_type2', + false, + 232 +)->build(); +``` + +## GetOneTimeTokenBankAccountPaymentProfile + +### Initialization Code + +#### Example + +```php +$value = GetOneTimeTokenBankAccountPaymentProfileBuilder::init( + 'first_name8', + 'last_name6', + BankAccountVault::MAXP, + 'vault_token0', + 'billing_address0', + 'billing_city4', + 'billing_country2', + 'billing_state8', + 'billing_zip6', + 'bank_name6', + 'masked_bank_routing_number6', + 'masked_bank_account_number0', + BankAccountType::CHECKING, + BankAccountHolderType::PERSONAL, + 'payment_type2', + false, + 254 +)->build(); +``` + diff --git a/doc/models/containers/list-subscriptions-input-product.md b/doc/models/containers/list-subscriptions-input-product.md new file mode 100644 index 00000000..cd460543 --- /dev/null +++ b/doc/models/containers/list-subscriptions-input-product.md @@ -0,0 +1,34 @@ + +# List Subscriptions Input Product + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/metered-usage-new-unit-balance.md b/doc/models/containers/metered-usage-new-unit-balance.md new file mode 100644 index 00000000..d5e272db --- /dev/null +++ b/doc/models/containers/metered-usage-new-unit-balance.md @@ -0,0 +1,34 @@ + +# Metered Usage New Unit Balance + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/prepaid-usage-new-overage-unit-balance.md b/doc/models/containers/prepaid-usage-new-overage-unit-balance.md new file mode 100644 index 00000000..b21054ab --- /dev/null +++ b/doc/models/containers/prepaid-usage-new-overage-unit-balance.md @@ -0,0 +1,34 @@ + +# Prepaid Usage New Overage Unit Balance + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/prepaid-usage-new-unit-balance.md b/doc/models/containers/prepaid-usage-new-unit-balance.md new file mode 100644 index 00000000..f8930dc2 --- /dev/null +++ b/doc/models/containers/prepaid-usage-new-unit-balance.md @@ -0,0 +1,34 @@ + +# Prepaid Usage New Unit Balance + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/subscription-component-unit-balance.md b/doc/models/containers/subscription-component-unit-balance.md new file mode 100644 index 00000000..97b5ae88 --- /dev/null +++ b/doc/models/containers/subscription-component-unit-balance.md @@ -0,0 +1,34 @@ + +# Subscription Component Unit Balance + +## Data Type + +`int|string` + +## Cases + +| Type | +| --- | +| `int` | +| `string` | + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/update-invoice-item-component-id.md b/doc/models/containers/update-invoice-item-component-id.md new file mode 100644 index 00000000..a28e383f --- /dev/null +++ b/doc/models/containers/update-invoice-item-component-id.md @@ -0,0 +1,34 @@ + +# Update Invoice Item Component Id + +## Data Type + +`string|int` + +## Cases + +| Type | +| --- | +| `string` | +| `int` | + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + diff --git a/doc/models/containers/update-invoice-item-price-point-id.md b/doc/models/containers/update-invoice-item-price-point-id.md new file mode 100644 index 00000000..2974e84e --- /dev/null +++ b/doc/models/containers/update-invoice-item-price-point-id.md @@ -0,0 +1,34 @@ + +# Update Invoice Item Price Point Id + +## Data Type + +`string|int` + +## Cases + +| Type | +| --- | +| `string` | +| `int` | + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + diff --git a/doc/models/containers/update-invoice-item-product-id.md b/doc/models/containers/update-invoice-item-product-id.md new file mode 100644 index 00000000..f64dcb4d --- /dev/null +++ b/doc/models/containers/update-invoice-item-product-id.md @@ -0,0 +1,34 @@ + +# Update Invoice Item Product Id + +## Data Type + +`string|int` + +## Cases + +| Type | +| --- | +| `string` | +| `int` | + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + diff --git a/doc/models/containers/update-invoice-item-product-price-point-id.md b/doc/models/containers/update-invoice-item-product-price-point-id.md new file mode 100644 index 00000000..82a1eba2 --- /dev/null +++ b/doc/models/containers/update-invoice-item-product-price-point-id.md @@ -0,0 +1,34 @@ + +# Update Invoice Item Product Price Point Id + +## Data Type + +`string|int` + +## Cases + +| Type | +| --- | +| `string` | +| `int` | + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + +## int + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + diff --git a/doc/models/containers/update-invoice-item-quantity.md b/doc/models/containers/update-invoice-item-quantity.md new file mode 100644 index 00000000..701dc953 --- /dev/null +++ b/doc/models/containers/update-invoice-item-quantity.md @@ -0,0 +1,34 @@ + +# Update Invoice Item Quantity + +## Data Type + +`float|string` + +## Cases + +| Type | +| --- | +| `float` | +| `string` | + +## float + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/containers/update-invoice-item-unit-price.md b/doc/models/containers/update-invoice-item-unit-price.md new file mode 100644 index 00000000..0e8933e9 --- /dev/null +++ b/doc/models/containers/update-invoice-item-unit-price.md @@ -0,0 +1,34 @@ + +# Update Invoice Item Unit Price + +## Data Type + +`float|string` + +## Cases + +| Type | +| --- | +| `float` | +| `string` | + +## float + +### Initialization Code + +#### Example + +```php +$value = 0; +``` + +## string + +### Initialization Code + +#### Example + +```php +$value = 'String0'; +``` + diff --git a/doc/models/contract.md b/doc/models/contract.md index 1eac20a6..41b0f26f 100644 --- a/doc/models/contract.md +++ b/doc/models/contract.md @@ -16,19 +16,24 @@ Contract linked to the scheduled renewal configuration. | `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" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ContractBuilder; +use AdvancedBillingLib\Models\Builders\RegisterBuilder; + +$contract = ContractBuilder::init() + ->id(112) + ->maxioId('maxio_id6') + ->number('number2') + ->register( + RegisterBuilder::init() + ->id(54) + ->maxioId('maxio_id4') + ->name('name2') + ->currencyCode('currency_code2') + ->build() + ) + ->build(); ``` diff --git a/doc/models/count-response.md b/doc/models/count-response.md index 41c70324..b395d374 100644 --- a/doc/models/count-response.md +++ b/doc/models/count-response.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `count` | `?int` | Optional | - | getCount(): ?int | setCount(?int count): void | -## Example (as JSON) +## Example -```json -{ - "count": 60 -} +```php +use AdvancedBillingLib\Models\Builders\CountResponseBuilder; + +$countResponse = CountResponseBuilder::init() + ->count(56) + ->build(); ``` diff --git a/doc/models/coupon-currency-request.md b/doc/models/coupon-currency-request.md index a2e00d9f..223666e1 100644 --- a/doc/models/coupon-currency-request.md +++ b/doc/models/coupon-currency-request.md @@ -11,16 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`UpdateCouponCurrency[]`](../../doc/models/update-coupon-currency.md) | Required | - | getCurrencyPrices(): array | setCurrencyPrices(array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "currency": "currency8", - "price": 78 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponCurrencyRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateCouponCurrencyBuilder; + +$couponCurrencyRequest = CouponCurrencyRequestBuilder::init( + [ + UpdateCouponCurrencyBuilder::init( + 'currency8', + 78 + )->build() + ] +)->build(); ``` diff --git a/doc/models/coupon-currency-response.md b/doc/models/coupon-currency-response.md index a86e6ec4..bc9095c4 100644 --- a/doc/models/coupon-currency-response.md +++ b/doc/models/coupon-currency-response.md @@ -11,30 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`?(CouponCurrency[])`](../../doc/models/coupon-currency.md) | Optional | - | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "id": 50, - "currency": "currency8", - "price": 233.74, - "coupon_id": 224 - }, - { - "id": 50, - "currency": "currency8", - "price": 233.74, - "coupon_id": 224 - }, - { - "id": 50, - "currency": "currency8", - "price": 233.74, - "coupon_id": 224 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponCurrencyResponseBuilder; +use AdvancedBillingLib\Models\Builders\CouponCurrencyBuilder; + +$couponCurrencyResponse = CouponCurrencyResponseBuilder::init() + ->currencyPrices( + [ + CouponCurrencyBuilder::init() + ->id(50) + ->currency('currency8') + ->price(233.74) + ->couponId(224) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/coupon-currency.md b/doc/models/coupon-currency.md index 1c55601a..41b38fdb 100644 --- a/doc/models/coupon-currency.md +++ b/doc/models/coupon-currency.md @@ -14,14 +14,16 @@ | `price` | `?float` | Optional | - | getPrice(): ?float | setPrice(?float price): void | | `couponId` | `?int` | Optional | - | getCouponId(): ?int | setCouponId(?int couponId): void | -## Example (as JSON) - -```json -{ - "id": 228, - "currency": "currency8", - "price": 169.96, - "coupon_id": 210 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponCurrencyBuilder; + +$couponCurrency = CouponCurrencyBuilder::init() + ->id(202) + ->currency('currency0') + ->price(14.62) + ->couponId(184) + ->build(); ``` diff --git a/doc/models/coupon-payload.md b/doc/models/coupon-payload.md index 7b5b43b4..911684e7 100644 --- a/doc/models/coupon-payload.md +++ b/doc/models/coupon-payload.md @@ -10,10 +10,10 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `name` | `?string` | Optional | Required when creating a new coupon. This name is not displayed to customers and is limited to 255 characters. | getName(): ?string | setName(?string name): void | -| `code` | `?string` | Optional | Required when creating a new coupon. The code is limited to 255 characters. May contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.” | getCode(): ?string | setCode(?string code): void | +| `code` | `?string` | Optional | Required when creating a new coupon. The code is limited to 255 characters. May contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”. | getCode(): ?string | setCode(?string code): void | | `description` | `?string` | Optional | Required when creating a new coupon. A description of the coupon that can be displayed to customers in transactions and on statements. The description is limited to 255 characters. | getDescription(): ?string | setDescription(?string description): void | | `percentage` | string\|float\|null | Optional | This is a container for one-of cases. | getPercentage(): | setPercentage( percentage): void | -| `amountInCents` | `?int` | Optional | Required when creating a new flat amount coupon. Can't be used together with percentage. Flat USD discount | getAmountInCents(): ?int | setAmountInCents(?int amountInCents): void | +| `amountInCents` | `?int` | Optional | Required when creating a new flat amount coupon. Can't be used together with percentage. Flat USD discount. | getAmountInCents(): ?int | setAmountInCents(?int amountInCents): void | | `allowNegativeBalance` | `?bool` | Optional | If set to true, discount is not limited (credits will carry forward to next billing). Can't be used together with restrictions. | getAllowNegativeBalance(): ?bool | setAllowNegativeBalance(?bool allowNegativeBalance): void | | `recurring` | `?bool` | Optional | - | getRecurring(): ?bool | setRecurring(?bool recurring): void | | `endDate` | `?DateTime` | Optional | After the end of the given day, this coupon code will be invalid for new signups. Recurring discounts started before this date will continue to recur even after this date. | getEndDate(): ?\DateTime | setEndDate(?\DateTime endDate): void | @@ -24,15 +24,19 @@ | `applyOnCancelAtEndOfPeriod` | `?bool` | Optional | - | getApplyOnCancelAtEndOfPeriod(): ?bool | setApplyOnCancelAtEndOfPeriod(?bool applyOnCancelAtEndOfPeriod): void | | `applyOnSubscriptionExpiration` | `?bool` | Optional | - | getApplyOnSubscriptionExpiration(): ?bool | setApplyOnSubscriptionExpiration(?bool applyOnSubscriptionExpiration): void | -## Example (as JSON) +## Example -```json -{ - "name": "name8", - "code": "code6", - "description": "description8", - "percentage": "String7", - "amount_in_cents": 110 -} +```php +use AdvancedBillingLib\Models\Builders\CouponPayloadBuilder; + +$couponPayload = CouponPayloadBuilder::init() + ->name('name8') + ->code('code6') + ->description('description2') + ->percentage( + 'String7' + ) + ->amountInCents(124) + ->build(); ``` diff --git a/doc/models/coupon-request.md b/doc/models/coupon-request.md index 4b293cc9..722c1c43 100644 --- a/doc/models/coupon-request.md +++ b/doc/models/coupon-request.md @@ -10,26 +10,39 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `coupon` | [`?CouponPayload`](../../doc/models/coupon-payload.md) | Optional | - | getCoupon(): ?CouponPayload | setCoupon(?CouponPayload coupon): void | -| `restrictedProducts` | `?array` | Optional | An object where the keys are product IDs or handles (prefixed with 'handle:'), and the values are booleans indicating if the coupon should be applicable to the product | getRestrictedProducts(): ?array | setRestrictedProducts(?array restrictedProducts): void | -| `restrictedComponents` | `?array` | Optional | An object where the keys are component IDs or handles (prefixed with 'handle:'), and the values are booleans indicating if the coupon should be applicable to the component | getRestrictedComponents(): ?array | setRestrictedComponents(?array restrictedComponents): void | - -## Example (as JSON) - -```json -{ - "coupon": { - "name": "name4", - "code": "code2", - "description": "description6", - "percentage": "String3", - "amount_in_cents": 230 - }, - "restricted_products": { - "key0": true - }, - "restricted_components": { - "key0": true - } -} +| `restrictedProducts` | `?array` | Optional | An object where the keys are product IDs or handles (prefixed with 'handle:'), and the values are booleans indicating if the coupon should be applicable to the product. | getRestrictedProducts(): ?array | setRestrictedProducts(?array restrictedProducts): void | +| `restrictedComponents` | `?array` | Optional | An object where the keys are component IDs or handles (prefixed with 'handle:'), and the values are booleans indicating if the coupon should be applicable to the component. | getRestrictedComponents(): ?array | setRestrictedComponents(?array restrictedComponents): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponRequestBuilder; +use AdvancedBillingLib\Models\Builders\CouponPayloadBuilder; + +$couponRequest = CouponRequestBuilder::init() + ->coupon( + CouponPayloadBuilder::init() + ->name('name4') + ->code('code2') + ->description('description6') + ->percentage( + 'String3' + ) + ->amountInCents(230) + ->build() + ) + ->restrictedProducts( + [ + 'key0' => true, + 'key1' => false + ] + ) + ->restrictedComponents( + [ + 'key0' => true, + 'key1' => false + ] + ) + ->build(); ``` diff --git a/doc/models/coupon-response.md b/doc/models/coupon-response.md index 225f00f9..81a59fa0 100644 --- a/doc/models/coupon-response.md +++ b/doc/models/coupon-response.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `coupon` | [`?Coupon`](../../doc/models/coupon.md) | Optional | - | getCoupon(): ?Coupon | setCoupon(?Coupon coupon): void | -## Example (as JSON) - -```json -{ - "coupon": { - "id": 196, - "name": "name4", - "code": "code2", - "description": "description6", - "amount": 97.66 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponResponseBuilder; +use AdvancedBillingLib\Models\Builders\CouponBuilder; + +$couponResponse = CouponResponseBuilder::init() + ->coupon( + CouponBuilder::init() + ->id(196) + ->name('name4') + ->code('code2') + ->description('description6') + ->amount(97.66) + ->build() + ) + ->build(); ``` diff --git a/doc/models/coupon-restriction.md b/doc/models/coupon-restriction.md index 21bcefb6..fed2ad45 100644 --- a/doc/models/coupon-restriction.md +++ b/doc/models/coupon-restriction.md @@ -15,15 +15,18 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | -## Example (as JSON) - -```json -{ - "id": 180, - "item_type": "Component", - "item_id": 184, - "name": "name4", - "handle": "handle0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponRestrictionBuilder; +use AdvancedBillingLib\Models\RestrictionType; + +$couponRestriction = CouponRestrictionBuilder::init() + ->id(66) + ->itemType(RestrictionType::COMPONENT) + ->itemId(214) + ->name('name0') + ->handle('handle6') + ->build(); ``` diff --git a/doc/models/coupon-subcodes-response.md b/doc/models/coupon-subcodes-response.md index 998da1bd..ca1861af 100644 --- a/doc/models/coupon-subcodes-response.md +++ b/doc/models/coupon-subcodes-response.md @@ -13,23 +13,28 @@ | `duplicateCodes` | `?(string[])` | Optional | - | getDuplicateCodes(): ?array | setDuplicateCodes(?array duplicateCodes): void | | `invalidCodes` | `?(string[])` | Optional | - | getInvalidCodes(): ?array | setInvalidCodes(?array invalidCodes): void | -## Example (as JSON) - -```json -{ - "created_codes": [ - "created_codes1", - "created_codes2" - ], - "duplicate_codes": [ - "duplicate_codes8", - "duplicate_codes7" - ], - "invalid_codes": [ - "invalid_codes0", - "invalid_codes9", - "invalid_codes8" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponSubcodesResponseBuilder; + +$couponSubcodesResponse = CouponSubcodesResponseBuilder::init() + ->createdCodes( + [ + 'created_codes7' + ] + ) + ->duplicateCodes( + [ + 'duplicate_codes8' + ] + ) + ->invalidCodes( + [ + 'invalid_codes4', + 'invalid_codes3' + ] + ) + ->build(); ``` diff --git a/doc/models/coupon-subcodes.md b/doc/models/coupon-subcodes.md index 70cf53a6..c7f47bc7 100644 --- a/doc/models/coupon-subcodes.md +++ b/doc/models/coupon-subcodes.md @@ -11,13 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `codes` | `?(string[])` | Optional | - | getCodes(): ?array | setCodes(?array codes): void | -## Example (as JSON) - -```json -{ - "codes": [ - "codes8" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponSubcodesBuilder; + +$couponSubcodes = CouponSubcodesBuilder::init() + ->codes( + [ + 'codes8', + 'codes9' + ] + ) + ->build(); ``` diff --git a/doc/models/coupon-usage.md b/doc/models/coupon-usage.md index 71379d6c..abbe7daf 100644 --- a/doc/models/coupon-usage.md +++ b/doc/models/coupon-usage.md @@ -14,18 +14,20 @@ | `signups` | `?int` | Optional | Number of times the coupon has been applied | getSignups(): ?int | setSignups(?int signups): void | | `savings` | `?int` | Optional | Dollar amount of customer savings as a result of the coupon. | getSavings(): ?int | setSavings(?int savings): void | | `savingsInCents` | `?int` | Optional | Dollar amount of customer savings as a result of the coupon. | getSavingsInCents(): ?int | setSavingsInCents(?int savingsInCents): void | -| `revenue` | `?int` | Optional | Total revenue of the all subscriptions that have received a discount from this coupon. | getRevenue(): ?int | setRevenue(?int revenue): void | -| `revenueInCents` | `?int` | Optional | Total revenue of the all subscriptions that have received a discount from this coupon. | getRevenueInCents(): ?int | setRevenueInCents(?int revenueInCents): void | - -## Example (as JSON) - -```json -{ - "id": 14, - "name": "name0", - "signups": 34, - "savings": 52, - "savings_in_cents": 138 -} +| `revenue` | `?int` | Optional | Total revenue of all subscriptions that have received a discount from this coupon. | getRevenue(): ?int | setRevenue(?int revenue): void | +| `revenueInCents` | `?int` | Optional | Total revenue of all subscriptions that have received a discount from this coupon. | getRevenueInCents(): ?int | setRevenueInCents(?int revenueInCents): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponUsageBuilder; + +$couponUsage = CouponUsageBuilder::init() + ->id(240) + ->name('name8') + ->signups(4) + ->savings(22) + ->savingsInCents(108) + ->build(); ``` diff --git a/doc/models/coupon.md b/doc/models/coupon.md index d2b3af1d..d13a0abe 100644 --- a/doc/models/coupon.md +++ b/doc/models/coupon.md @@ -41,15 +41,17 @@ | `couponRestrictions` | [`?(CouponRestriction[])`](../../doc/models/coupon-restriction.md) | Optional | - | getCouponRestrictions(): ?array | setCouponRestrictions(?array couponRestrictions): void | | `currencyPrices` | [`?(CouponCurrency[])`](../../doc/models/coupon-currency.md) | Optional | Returned in read, find, and list endpoints if the query parameter is provided. | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): void | -## Example (as JSON) - -```json -{ - "id": 22, - "name": "name2", - "code": "code0", - "description": "description2", - "amount": 62.64 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CouponBuilder; + +$coupon = CouponBuilder::init() + ->id(196) + ->name('name4') + ->code('code2') + ->description('description6') + ->amount(97.66) + ->build(); ``` diff --git a/doc/models/create-allocation-request.md b/doc/models/create-allocation-request.md index f34299e3..2d4677f8 100644 --- a/doc/models/create-allocation-request.md +++ b/doc/models/create-allocation-request.md @@ -11,18 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `allocation` | [`CreateAllocation`](../../doc/models/create-allocation.md) | Required | - | getAllocation(): CreateAllocation | setAllocation(CreateAllocation allocation): void | -## Example (as JSON) - -```json -{ - "allocation": { - "quantity": 228.94, - "decimal_quantity": "decimal_quantity6", - "previous_quantity": 254.04, - "decimal_previous_quantity": "decimal_previous_quantity8", - "component_id": 8, - "memo": "memo2" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateAllocationRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateAllocationBuilder; + +$createAllocationRequest = CreateAllocationRequestBuilder::init( + CreateAllocationBuilder::init( + 228.94 + ) + ->decimalQuantity('decimal_quantity6') + ->previousQuantity(254.04) + ->decimalPreviousQuantity('decimal_previous_quantity8') + ->componentId(8) + ->memo('memo2') + ->build() +)->build(); ``` diff --git a/doc/models/create-allocation.md b/doc/models/create-allocation.md index c128ecc9..5492986c 100644 --- a/doc/models/create-allocation.md +++ b/doc/models/create-allocation.md @@ -9,7 +9,7 @@ | 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 | +| `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 1 for on and 0 for off. | getQuantity(): float | setQuantity(float quantity): 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 | @@ -25,16 +25,19 @@ | `billingSchedule` | [`?BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | Billing schedule settings for component allocations or usages on multi-frequency subscriptions. Use this to start a component's billing period on a custom date instead of aligning with the product charge schedule. | 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" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateAllocationBuilder; + +$createAllocation = CreateAllocationBuilder::init( + 6.56 +) + ->decimalQuantity('decimal_quantity6') + ->previousQuantity(35.58) + ->decimalPreviousQuantity('decimal_previous_quantity0') + ->componentId(42) + ->memo('memo4') + ->build(); ``` diff --git a/doc/models/create-component-price-point-request.md b/doc/models/create-component-price-point-request.md index b2d070d8..31096727 100644 --- a/doc/models/create-component-price-point-request.md +++ b/doc/models/create-component-price-point-request.md @@ -11,26 +11,36 @@ | --- | --- | --- | --- | --- | --- | | `pricePoint` | [CreateComponentPricePoint](../../doc/models/create-component-price-point.md)\|[CreatePrepaidUsageComponentPricePoint](../../doc/models/create-prepaid-usage-component-price-point.md) | Required | This is a container for any-of cases. | getPricePoint(): | setPricePoint( pricePoint): void | -## Example (as JSON) - -```json -{ - "price_point": { - "name": "name0", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "use_site_exchange_rate": true, - "handle": "handle6", - "tax_included": false, - "interval": 24, - "interval_unit": "day" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateComponentPricePointRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createComponentPricePointRequest = CreateComponentPricePointRequestBuilder::init( + CreateComponentPricePointBuilder::init( + 'name0', + PricingScheme::PER_UNIT, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->handle('handle6') + ->useSiteExchangeRate(true) + ->taxIncluded(false) + ->interval(24) + ->intervalUnit(IntervalUnit::DAY) + ->build() +)->build(); ``` diff --git a/doc/models/create-component-price-point.md b/doc/models/create-component-price-point.md index be3119b7..8cdd52ec 100644 --- a/doc/models/create-component-price-point.md +++ b/doc/models/create-component-price-point.md @@ -15,27 +15,36 @@ | `prices` | [`Price[]`](../../doc/models/price.md) | Required | - | 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. Setting not supported when creating price points in bulk.

**Default**: `true` | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | | `taxIncluded` | `?bool` | Optional | Whether or not the price point includes tax. Setting not supported when creating price points in bulk. | 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 price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this price point, either month or day. This property is only available for sites with Multifrequency enabled. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | -## Example (as JSON) - -```json -{ - "name": "name0", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "use_site_exchange_rate": true, - "handle": "handle6", - "tax_included": false, - "interval": 24, - "interval_unit": "day" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createComponentPricePoint = CreateComponentPricePointBuilder::init( + 'name4', + PricingScheme::PER_UNIT, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] +) + ->handle('handle0') + ->useSiteExchangeRate(true) + ->taxIncluded(false) + ->interval(140) + ->intervalUnit(IntervalUnit::DAY) + ->build(); ``` diff --git a/doc/models/create-component-price-points-request.md b/doc/models/create-component-price-points-request.md index 44803a38..77093817 100644 --- a/doc/models/create-component-price-points-request.md +++ b/doc/models/create-component-price-points-request.md @@ -11,64 +11,54 @@ | --- | --- | --- | --- | --- | --- | | `pricePoints` | array<[CreateComponentPricePoint](../../doc/models/create-component-price-point.md)\|[CreatePrepaidUsageComponentPricePoint](../../doc/models/create-prepaid-usage-component-price-point.md)> | Required | This is Array of a container for any-of cases. | getPricePoints(): array | setPricePoints(array pricePoints): void | -## Example (as JSON) +## Example -```json -{ - "price_points": [ - { - "name": "name0", - "handle": "handle6", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "use_site_exchange_rate": false, - "tax_included": false, - "interval": 24, - "interval_unit": "day" - }, - { - "name": "name0", - "handle": "handle6", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "use_site_exchange_rate": false, - "tax_included": false, - "interval": 24, - "interval_unit": "day" - } - ] -} +```php +use AdvancedBillingLib\Models\Builders\CreateComponentPricePointsRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createComponentPricePointsRequest = CreateComponentPricePointsRequestBuilder::init( + [ + CreateComponentPricePointBuilder::init( + 'name0', + PricingScheme::PER_UNIT, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->handle('handle6') + ->useSiteExchangeRate(false) + ->taxIncluded(false) + ->interval(24) + ->intervalUnit(IntervalUnit::DAY) + ->build() + ] +)->build(); ``` diff --git a/doc/models/create-credit-note-event.md b/doc/models/create-credit-note-event.md index 0095c589..8b6aadef 100644 --- a/doc/models/create-credit-note-event.md +++ b/doc/models/create-credit-note-event.md @@ -15,31 +15,37 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::CREATE_CREDIT_NOTE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`CreditNote`](../../doc/models/credit-note.md) | Required | Example schema for an `create_credit_note` event | getEventData(): CreditNote | setEventData(CreditNote eventData): void | -## Example (as JSON) - -```json -{ - "id": 28, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "create_credit_note", - "event_data": { - "uid": "uid6", - "site_id": 132, - "customer_id": 244, - "subscription_id": 60, - "number": "number6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateCreditNoteEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; + +$createCreditNoteEvent = CreateCreditNoteEventBuilder::init( + 82, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::CREATE_CREDIT_NOTE, + CreditNoteBuilder::init() + ->uid('uid6') + ->siteId(132) + ->customerId(244) + ->subscriptionId(60) + ->number('number6') + ->build() +)->build(); ``` diff --git a/doc/models/create-currency-price.md b/doc/models/create-currency-price.md index 7b4a7382..3b41038c 100644 --- a/doc/models/create-currency-price.md +++ b/doc/models/create-currency-price.md @@ -13,13 +13,15 @@ | `price` | `?float` | Optional | Price for the price level in this currency | getPrice(): ?float | setPrice(?float price): void | | `priceId` | `?int` | Optional | ID of the price that this corresponds with | getPriceId(): ?int | setPriceId(?int priceId): void | -## Example (as JSON) - -```json -{ - "currency": "currency2", - "price": 10.4, - "price_id": 54 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateCurrencyPriceBuilder; + +$createCurrencyPrice = CreateCurrencyPriceBuilder::init() + ->currency('currency2') + ->price(54.8) + ->priceId(142) + ->build(); ``` diff --git a/doc/models/create-currency-prices-request.md b/doc/models/create-currency-prices-request.md index 5d32aacf..607ee766 100644 --- a/doc/models/create-currency-prices-request.md +++ b/doc/models/create-currency-prices-request.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`CreateCurrencyPrice[]`](../../doc/models/create-currency-price.md) | Required | - | getCurrencyPrices(): array | setCurrencyPrices(array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "currency": "currency8", - "price": 233.74, - "price_id": 116 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateCurrencyPricesRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateCurrencyPriceBuilder; + +$createCurrencyPricesRequest = CreateCurrencyPricesRequestBuilder::init( + [ + CreateCurrencyPriceBuilder::init() + ->currency('currency8') + ->price(233.74) + ->priceId(116) + ->build() + ] +)->build(); ``` diff --git a/doc/models/create-customer-request.md b/doc/models/create-customer-request.md index f7383631..268e7514 100644 --- a/doc/models/create-customer-request.md +++ b/doc/models/create-customer-request.md @@ -11,20 +11,24 @@ | --- | --- | --- | --- | --- | --- | | `customer` | [`CreateCustomer`](../../doc/models/create-customer.md) | Required | - | getCustomer(): CreateCustomer | setCustomer(CreateCustomer customer): void | -## Example (as JSON) - -```json -{ - "customer": { - "first_name": "first_name0", - "last_name": "last_name8", - "email": "email6", - "cc_emails": "cc_emails0", - "organization": "organization6", - "reference": "reference4", - "address": "address6", - "address_2": "address_24" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateCustomerRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateCustomerBuilder; + +$createCustomerRequest = CreateCustomerRequestBuilder::init( + CreateCustomerBuilder::init( + 'first_name0', + 'last_name8', + 'email6' + ) + ->ccEmails('cc_emails0') + ->organization('organization6') + ->reference('reference4') + ->address('address6') + ->address2('address_24') + ->build() +)->build(); ``` diff --git a/doc/models/create-customer.md b/doc/models/create-customer.md index e79c3640..c46ea342 100644 --- a/doc/models/create-customer.md +++ b/doc/models/create-customer.md @@ -25,22 +25,27 @@ | `locale` | `?string` | Optional | Set a specific language on a customer record. | getLocale(): ?string | setLocale(?string locale): void | | `vatNumber` | `?string` | Optional | - | getVatNumber(): ?string | setVatNumber(?string vatNumber): void | | `taxExempt` | `?bool` | Optional | - | getTaxExempt(): ?bool | setTaxExempt(?bool taxExempt): void | +| `surcharging` | `?bool` | Optional | Whether surcharging is enabled for the customer. Defaults to `true` when omitted. Only applied on sites where surcharging control is enabled. | getSurcharging(): ?bool | setSurcharging(?bool surcharging): void | | `taxExemptReason` | `?string` | Optional | - | getTaxExemptReason(): ?string | setTaxExemptReason(?string taxExemptReason): void | | `parentId` | `?int` | Optional | The parent ID in Chargify if applicable. Parent is another Customer object. | getParentId(): ?int | setParentId(?int parentId): void | | `salesforceId` | `?string` | Optional | The Salesforce ID of the customer | getSalesforceId(): ?string | setSalesforceId(?string salesforceId): void | - -## Example (as JSON) - -```json -{ - "first_name": "first_name8", - "last_name": "last_name6", - "email": "email8", - "cc_emails": "cc_emails8", - "organization": "organization2", - "reference": "reference4", - "address": "address4", - "address_2": "address_22" -} +| `brandingThemeId` | `?int` | Optional | The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. This customer-level Branding Theme is used when a subscription does not have its own subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. | getBrandingThemeId(): ?int | setBrandingThemeId(?int brandingThemeId): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateCustomerBuilder; + +$createCustomer = CreateCustomerBuilder::init( + 'first_name0', + 'last_name8', + 'email6' +) + ->ccEmails('cc_emails0') + ->organization('organization6') + ->reference('reference4') + ->address('address6') + ->address2('address_24') + ->build(); ``` diff --git a/doc/models/create-debit-note-event.md b/doc/models/create-debit-note-event.md index 347c3c96..696fde3a 100644 --- a/doc/models/create-debit-note-event.md +++ b/doc/models/create-debit-note-event.md @@ -15,31 +15,37 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::CREATE_DEBIT_NOTE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`DebitNote`](../../doc/models/debit-note.md) | Required | Example schema for an `create_debit_note` event | getEventData(): DebitNote | setEventData(DebitNote eventData): void | -## Example (as JSON) - -```json -{ - "id": 98, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "create_debit_note", - "event_data": { - "uid": "uid6", - "site_id": 132, - "customer_id": 244, - "subscription_id": 60, - "number": 64 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateDebitNoteEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\DebitNoteBuilder; + +$createDebitNoteEvent = CreateDebitNoteEventBuilder::init( + 176, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::CREATE_DEBIT_NOTE, + DebitNoteBuilder::init() + ->uid('uid6') + ->siteId(132) + ->customerId(244) + ->subscriptionId(60) + ->number(64) + ->build() +)->build(); ``` diff --git a/doc/models/create-ebb-component.md b/doc/models/create-ebb-component.md index bfa97376..2fa630e4 100644 --- a/doc/models/create-ebb-component.md +++ b/doc/models/create-ebb-component.md @@ -11,35 +11,50 @@ | --- | --- | --- | --- | --- | --- | | `eventBasedComponent` | [`EBBComponent`](../../doc/models/ebb-component.md) | Required | - | getEventBasedComponent(): EBBComponent | setEventBasedComponent(EBBComponent eventBasedComponent): void | -## Example (as JSON) - -```json -{ - "event_based_component": { - "name": "name8", - "unit_name": "unit_name0", - "description": "description8", - "handle": "handle4", - "taxable": false, - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "price_points": [ - { - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "interval": 92, - "interval_unit": "day" - } - ], - "event_based_billing_metric_id": 68 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateEBBComponentBuilder; +use AdvancedBillingLib\Models\Builders\EBBComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointItemBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createEBBComponent = CreateEBBComponentBuilder::init( + EBBComponentBuilder::init( + 'name8', + 'unit_name0', + PricingScheme::STAIRSTEP, + 68 + ) + ->description('description8') + ->handle('handle4') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->pricePoints( + [ + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build() + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-invoice-address.md b/doc/models/create-invoice-address.md index 6d7c7fbe..c48d7f88 100644 --- a/doc/models/create-invoice-address.md +++ b/doc/models/create-invoice-address.md @@ -21,15 +21,17 @@ Overrides the default address. | `zip` | `?string` | Optional | - | getZip(): ?string | setZip(?string zip): void | | `country` | `?string` | Optional | - | getCountry(): ?string | setCountry(?string country): void | -## Example (as JSON) - -```json -{ - "first_name": "first_name4", - "last_name": "last_name2", - "phone": "phone6", - "address": "address0", - "address_2": "address_28" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoiceAddressBuilder; + +$createInvoiceAddress = CreateInvoiceAddressBuilder::init() + ->firstName('first_name6') + ->lastName('last_name4') + ->phone('phone4') + ->address('address2') + ->address2('address_20') + ->build(); ``` diff --git a/doc/models/create-invoice-coupon.md b/doc/models/create-invoice-coupon.md index 1aec6fa1..6d3b99b3 100644 --- a/doc/models/create-invoice-coupon.md +++ b/doc/models/create-invoice-coupon.md @@ -17,15 +17,21 @@ | `productFamilyId` | string\|int\|null | Optional | This is a container for one-of cases. | getProductFamilyId(): | setProductFamilyId( productFamilyId): void | | `compoundingStrategy` | [`?string(CompoundingStrategy)`](../../doc/models/compounding-strategy.md) | Optional | Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied. | getCompoundingStrategy(): ?string | setCompoundingStrategy(?string compoundingStrategy): void | -## Example (as JSON) - -```json -{ - "percentage": 50.0, - "code": "code4", - "subcode": "subcode8", - "amount": "String9", - "description": "description4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoiceCouponBuilder; + +$createInvoiceCoupon = CreateInvoiceCouponBuilder::init() + ->code('code8') + ->subcode('subcode4') + ->percentage( + 50 + ) + ->amount( + 'String9' + ) + ->description('description0') + ->build(); ``` diff --git a/doc/models/create-invoice-item.md b/doc/models/create-invoice-item.md index 3acf41e1..88b54e3e 100644 --- a/doc/models/create-invoice-item.md +++ b/doc/models/create-invoice-item.md @@ -22,15 +22,21 @@ | `productPricePointId` | string\|int\|null | Optional | This is a container for one-of cases. | getProductPricePointId(): | setProductPricePointId( productPricePointId): void | | `description` | `?string` | Optional | **Constraints**: *Maximum Length*: `255` | getDescription(): ?string | setDescription(?string description): void | -## Example (as JSON) - -```json -{ - "title": "title2", - "quantity": 154.86, - "unit_price": 138.08, - "taxable": false, - "tax_code": "tax_code4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoiceItemBuilder; + +$createInvoiceItem = CreateInvoiceItemBuilder::init() + ->title('title8') + ->quantity( + 107.22 + ) + ->unitPrice( + 90.44 + ) + ->taxable(false) + ->taxCode('tax_code0') + ->build(); ``` diff --git a/doc/models/create-invoice-payment-application.md b/doc/models/create-invoice-payment-application.md index 40d9e5b1..3c9034fb 100644 --- a/doc/models/create-invoice-payment-application.md +++ b/doc/models/create-invoice-payment-application.md @@ -12,12 +12,14 @@ | `invoiceUid` | `string` | Required | Unique identifier for the invoice. It has the prefix "inv_" followed by alphanumeric characters. | getInvoiceUid(): string | setInvoiceUid(string invoiceUid): void | | `amount` | `string` | Required | Dollar amount of the invoice payment (eg. "10.50" => $10.50). | getAmount(): string | setAmount(string amount): void | -## Example (as JSON) +## Example -```json -{ - "invoice_uid": "invoice_uid4", - "amount": "amount6" -} +```php +use AdvancedBillingLib\Models\Builders\CreateInvoicePaymentApplicationBuilder; + +$createInvoicePaymentApplication = CreateInvoicePaymentApplicationBuilder::init( + 'invoice_uid6', + 'amount8' +)->build(); ``` diff --git a/doc/models/create-invoice-payment-request.md b/doc/models/create-invoice-payment-request.md index 79768703..e878fcee 100644 --- a/doc/models/create-invoice-payment-request.md +++ b/doc/models/create-invoice-payment-request.md @@ -12,18 +12,26 @@ | `payment` | [`CreateInvoicePayment`](../../doc/models/create-invoice-payment.md) | Required | - | getPayment(): CreateInvoicePayment | setPayment(CreateInvoicePayment payment): void | | `type` | [`?string(InvoicePaymentType)`](../../doc/models/invoice-payment-type.md) | Optional | The type of payment to be applied to an Invoice. Defaults to external. | getType(): ?string | setType(?string type): void | -## Example (as JSON) - -```json -{ - "payment": { - "amount": "String9", - "memo": "memo0", - "method": "ach", - "details": "details6", - "payment_profile_id": 42 - }, - "type": "external" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoicePaymentRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateInvoicePaymentBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; +use AdvancedBillingLib\Models\InvoicePaymentType; + +$createInvoicePaymentRequest = CreateInvoicePaymentRequestBuilder::init( + CreateInvoicePaymentBuilder::init() + ->amount( + 'String9' + ) + ->memo('memo0') + ->method(InvoicePaymentMethodType::ACH) + ->details('details6') + ->paymentProfileId(42) + ->build() +) + ->type(InvoicePaymentType::EXTERNAL) + ->build(); ``` diff --git a/doc/models/create-invoice-payment.md b/doc/models/create-invoice-payment.md index 9f76beb0..53a20ef8 100644 --- a/doc/models/create-invoice-payment.md +++ b/doc/models/create-invoice-payment.md @@ -16,15 +16,20 @@ | `paymentProfileId` | `?int` | Optional | The ID of the payment profile to be used for the payment. | getPaymentProfileId(): ?int | setPaymentProfileId(?int paymentProfileId): void | | `receivedOn` | `?DateTime` | Optional | Date reflecting when the payment was received from a customer. Must be in the past. Applicable only to
`external` payments. | getReceivedOn(): ?\DateTime | setReceivedOn(?\DateTime receivedOn): void | -## Example (as JSON) - -```json -{ - "amount": "String9", - "memo": "memo0", - "method": "cash", - "details": "details6", - "payment_profile_id": 122 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoicePaymentBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$createInvoicePayment = CreateInvoicePaymentBuilder::init() + ->amount( + 'String7' + ) + ->memo('memo8') + ->method(InvoicePaymentMethodType::ACH) + ->details('details4') + ->paymentProfileId(30) + ->build(); ``` diff --git a/doc/models/create-invoice-request.md b/doc/models/create-invoice-request.md index ed557b4c..716f7c30 100644 --- a/doc/models/create-invoice-request.md +++ b/doc/models/create-invoice-request.md @@ -11,40 +11,60 @@ | --- | --- | --- | --- | --- | --- | | `invoice` | [`CreateInvoice`](../../doc/models/create-invoice.md) | Required | - | getInvoice(): CreateInvoice | setInvoice(CreateInvoice invoice): void | -## Example (as JSON) - -```json -{ - "invoice": { - "issue_date": "2024-01-01", - "status": "draft", - "line_items": [ - { - "title": "title4", - "quantity": 56.68, - "unit_price": 39.9, - "taxable": false, - "tax_code": "tax_code6" - }, - { - "title": "title4", - "quantity": 56.68, - "unit_price": 39.9, - "taxable": false, - "tax_code": "tax_code6" - }, - { - "title": "title4", - "quantity": 56.68, - "unit_price": 39.9, - "taxable": false, - "tax_code": "tax_code6" - } - ], - "net_terms": 144, - "payment_instructions": "payment_instructions6", - "memo": "memo0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoiceRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateInvoiceBuilder; +use AdvancedBillingLib\Models\Builders\CreateInvoiceItemBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\CreateInvoiceStatus; + +$createInvoiceRequest = CreateInvoiceRequestBuilder::init( + CreateInvoiceBuilder::init() + ->lineItems( + [ + CreateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build(), + CreateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build(), + CreateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build() + ] + ) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->netTerms(144) + ->paymentInstructions('payment_instructions6') + ->memo('memo0') + ->status(CreateInvoiceStatus::DRAFT) + ->build() +)->build(); ``` diff --git a/doc/models/create-invoice-status.md b/doc/models/create-invoice-status.md index 73171a87..29d7290d 100644 --- a/doc/models/create-invoice-status.md +++ b/doc/models/create-invoice-status.md @@ -14,7 +14,9 @@ ## Example -``` -draft +```php +use AdvancedBillingLib\Models\CreateInvoiceStatus; + +$createInvoiceStatus = CreateInvoiceStatus::DRAFT; ``` diff --git a/doc/models/create-invoice.md b/doc/models/create-invoice.md index eed6c008..798c1819 100644 --- a/doc/models/create-invoice.md +++ b/doc/models/create-invoice.md @@ -14,30 +14,52 @@ | `netTerms` | `?int` | Optional | By default, invoices will be created with a due date matching the date of invoice creation. If a different due date is desired, the net_terms parameter can be sent indicating the number of days in advance the due date should be. | getNetTerms(): ?int | setNetTerms(?int netTerms): void | | `paymentInstructions` | `?string` | Optional | - | getPaymentInstructions(): ?string | setPaymentInstructions(?string paymentInstructions): void | | `memo` | `?string` | Optional | A custom memo can be sent to override the site's default. | getMemo(): ?string | setMemo(?string memo): void | -| `sellerAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the defaults for the site | getSellerAddress(): ?CreateInvoiceAddress | setSellerAddress(?CreateInvoiceAddress sellerAddress): void | -| `billingAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer | getBillingAddress(): ?CreateInvoiceAddress | setBillingAddress(?CreateInvoiceAddress billingAddress): void | -| `shippingAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer | getShippingAddress(): ?CreateInvoiceAddress | setShippingAddress(?CreateInvoiceAddress shippingAddress): void | +| `sellerAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the defaults for the site. | getSellerAddress(): ?CreateInvoiceAddress | setSellerAddress(?CreateInvoiceAddress sellerAddress): void | +| `billingAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer. | getBillingAddress(): ?CreateInvoiceAddress | setBillingAddress(?CreateInvoiceAddress billingAddress): void | +| `shippingAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer. | getShippingAddress(): ?CreateInvoiceAddress | setShippingAddress(?CreateInvoiceAddress shippingAddress): void | | `coupons` | [`?(CreateInvoiceCoupon[])`](../../doc/models/create-invoice-coupon.md) | Optional | - | getCoupons(): ?array | setCoupons(?array coupons): void | | `status` | [`?string(CreateInvoiceStatus)`](../../doc/models/create-invoice-status.md) | Optional | **Default**: `CreateInvoiceStatus::OPEN` | getStatus(): ?string | setStatus(?string status): void | -## Example (as JSON) - -```json -{ - "issue_date": "2024-01-01", - "status": "draft", - "line_items": [ - { - "title": "title4", - "quantity": 56.68, - "unit_price": 39.9, - "taxable": false, - "tax_code": "tax_code6" - } - ], - "net_terms": 18, - "payment_instructions": "payment_instructions0", - "memo": "memo6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateInvoiceBuilder; +use AdvancedBillingLib\Models\Builders\CreateInvoiceItemBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\CreateInvoiceStatus; + +$createInvoice = CreateInvoiceBuilder::init() + ->lineItems( + [ + CreateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build(), + CreateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build() + ] + ) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->netTerms(202) + ->paymentInstructions('payment_instructions2') + ->memo('memo8') + ->status(CreateInvoiceStatus::DRAFT) + ->build(); ``` diff --git a/doc/models/create-metadata-request.md b/doc/models/create-metadata-request.md index 35c2a1f3..ba2fe5a7 100644 --- a/doc/models/create-metadata-request.md +++ b/doc/models/create-metadata-request.md @@ -11,16 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `metadata` | [`CreateMetadata[]`](../../doc/models/create-metadata.md) | Required | - | getMetadata(): array | setMetadata(array metadata): void | -## Example (as JSON) - -```json -{ - "metadata": [ - { - "name": "name6", - "value": "value8" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateMetadataRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateMetadataBuilder; + +$createMetadataRequest = CreateMetadataRequestBuilder::init( + [ + CreateMetadataBuilder::init() + ->name('name6') + ->value('value8') + ->build() + ] +)->build(); ``` diff --git a/doc/models/create-metadata.md b/doc/models/create-metadata.md index a5ef96f8..1685b0ac 100644 --- a/doc/models/create-metadata.md +++ b/doc/models/create-metadata.md @@ -12,12 +12,14 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `value` | `?string` | Optional | - | getValue(): ?string | setValue(?string value): void | -## Example (as JSON) +## Example -```json -{ - "name": "name4", - "value": "value6" -} +```php +use AdvancedBillingLib\Models\Builders\CreateMetadataBuilder; + +$createMetadata = CreateMetadataBuilder::init() + ->name('name0') + ->value('value2') + ->build(); ``` diff --git a/doc/models/create-metafield.md b/doc/models/create-metafield.md index a96fe0e6..2ad41382 100644 --- a/doc/models/create-metafield.md +++ b/doc/models/create-metafield.md @@ -11,26 +11,35 @@ | --- | --- | --- | --- | --- | --- | | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `scope` | [`?MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | getScope(): ?MetafieldScope | setScope(?MetafieldScope scope): void | -| `inputType` | [`?string(MetafieldInput)`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | getInputType(): ?string | setInputType(?string inputType): void | +| `inputType` | [`?string(MetafieldInput)`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | getInputType(): ?string | setInputType(?string inputType): void | | `enum` | `?(string[])` | Optional | Only applicable when input_type is radio or dropdown. Empty strings will not be submitted. | getEnum(): ?array | setEnum(?array enum): void | -## Example (as JSON) - -```json -{ - "name": "my_field", - "scope": { - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0", - "public_edit": "0" - }, - "input_type": "text", - "enum": [ - "string" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateMetafieldBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; +use AdvancedBillingLib\Models\MetafieldInput; + +$createMetafield = CreateMetafieldBuilder::init() + ->name('my_field') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->publicEdit(IncludeOption::EXCLUDE) + ->build() + ) + ->inputType(MetafieldInput::TEXT) + ->enum( + [ + 'string' + ] + ) + ->build(); ``` diff --git a/doc/models/create-metafields-request.md b/doc/models/create-metafields-request.md index f8063422..6b6f157f 100644 --- a/doc/models/create-metafields-request.md +++ b/doc/models/create-metafields-request.md @@ -11,25 +11,35 @@ | --- | --- | --- | --- | --- | --- | | `metafields` | [CreateMetafield](../../doc/models/create-metafield.md)\|[CreateMetafield](../../doc/models/create-metafield.md)[] | Required | This is a container for one-of cases. | getMetafields(): | setMetafields( metafields): void | -## Example (as JSON) - -```json -{ - "metafields": { - "name": "my_field", - "scope": { - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0", - "public_edit": "0" - }, - "input_type": "text", - "enum": [ - "string" - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateMetafieldsRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateMetafieldBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; +use AdvancedBillingLib\Models\MetafieldInput; + +$createMetafieldsRequest = CreateMetafieldsRequestBuilder::init( + CreateMetafieldBuilder::init() + ->name('my_field') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->publicEdit(IncludeOption::EXCLUDE) + ->build() + ) + ->inputType(MetafieldInput::TEXT) + ->enum( + [ + 'string' + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-metered-component.md b/doc/models/create-metered-component.md index a3acfa80..b619662f 100644 --- a/doc/models/create-metered-component.md +++ b/doc/models/create-metered-component.md @@ -11,58 +11,79 @@ | --- | --- | --- | --- | --- | --- | | `meteredComponent` | [`MeteredComponent`](../../doc/models/metered-component.md) | Required | - | getMeteredComponent(): MeteredComponent | setMeteredComponent(MeteredComponent meteredComponent): void | -## Example (as JSON) +## Example -```json -{ - "metered_component": { - "name": "name0", - "unit_name": "unit_name2", - "description": "description0", - "handle": "handle6", - "taxable": 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 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "price_points": [ - { - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "interval": 92, - "interval_unit": "day" - }, - { - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "interval": 92, - "interval_unit": "day" - }, - { - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "interval": 92, - "interval_unit": "day" - } - ] - } -} +```php +use AdvancedBillingLib\Models\Builders\CreateMeteredComponentBuilder; +use AdvancedBillingLib\Models\Builders\MeteredComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointItemBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createMeteredComponent = CreateMeteredComponentBuilder::init( + MeteredComponentBuilder::init( + 'name0', + 'unit_name2', + PricingScheme::STAIRSTEP + ) + ->description('description0') + ->handle('handle6') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->pricePoints( + [ + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build(), + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build(), + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build() + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-multi-invoice-payment-request.md b/doc/models/create-multi-invoice-payment-request.md index 2e2caf45..22d387fd 100644 --- a/doc/models/create-multi-invoice-payment-request.md +++ b/doc/models/create-multi-invoice-payment-request.md @@ -11,23 +11,29 @@ | --- | --- | --- | --- | --- | --- | | `payment` | [`CreateMultiInvoicePayment`](../../doc/models/create-multi-invoice-payment.md) | Required | - | getPayment(): CreateMultiInvoicePayment | setPayment(CreateMultiInvoicePayment payment): void | -## Example (as JSON) - -```json -{ - "payment": { - "amount": "String9", - "applications": [ - { - "invoice_uid": "invoice_uid8", - "amount": "amount0" - } - ], - "memo": "memo0", - "details": "details6", - "method": "ach", - "received_on": "received_on8" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateMultiInvoicePaymentRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateMultiInvoicePaymentBuilder; +use AdvancedBillingLib\Models\Builders\CreateInvoicePaymentApplicationBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$createMultiInvoicePaymentRequest = CreateMultiInvoicePaymentRequestBuilder::init( + CreateMultiInvoicePaymentBuilder::init( + 'String9', + [ + CreateInvoicePaymentApplicationBuilder::init( + 'invoice_uid8', + 'amount0' + )->build() + ] + ) + ->memo('memo0') + ->details('details6') + ->method(InvoicePaymentMethodType::ACH) + ->receivedOn('received_on8') + ->build() +)->build(); ``` diff --git a/doc/models/create-multi-invoice-payment.md b/doc/models/create-multi-invoice-payment.md index 8412a014..1df8e340 100644 --- a/doc/models/create-multi-invoice-payment.md +++ b/doc/models/create-multi-invoice-payment.md @@ -16,21 +16,26 @@ | `receivedOn` | `?string` | Optional | Date reflecting when the payment was received from a customer. Must be in the past. | getReceivedOn(): ?string | setReceivedOn(?string receivedOn): void | | `applications` | [`CreateInvoicePaymentApplication[]`](../../doc/models/create-invoice-payment-application.md) | Required | - | getApplications(): array | setApplications(array applications): void | -## Example (as JSON) - -```json -{ - "amount": "String7", - "applications": [ - { - "invoice_uid": "invoice_uid8", - "amount": "amount0" - } - ], - "memo": "memo8", - "details": "details4", - "method": "credit_card", - "received_on": "received_on6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateMultiInvoicePaymentBuilder; +use AdvancedBillingLib\Models\Builders\CreateInvoicePaymentApplicationBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$createMultiInvoicePayment = CreateMultiInvoicePaymentBuilder::init( + 'String9', + [ + CreateInvoicePaymentApplicationBuilder::init( + 'invoice_uid8', + 'amount0' + )->build() + ] +) + ->memo('memo0') + ->details('details6') + ->method(InvoicePaymentMethodType::ACH) + ->receivedOn('received_on8') + ->build(); ``` diff --git a/doc/models/create-offer-component.md b/doc/models/create-offer-component.md index dd886cf6..0e61d50d 100644 --- a/doc/models/create-offer-component.md +++ b/doc/models/create-offer-component.md @@ -13,13 +13,15 @@ | `pricePointId` | `?int` | Optional | - | getPricePointId(): ?int | setPricePointId(?int pricePointId): void | | `startingQuantity` | `?int` | Optional | - | getStartingQuantity(): ?int | setStartingQuantity(?int startingQuantity): void | -## Example (as JSON) - -```json -{ - "component_id": 242, - "price_point_id": 10, - "starting_quantity": 50 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOfferComponentBuilder; + +$createOfferComponent = CreateOfferComponentBuilder::init() + ->componentId(252) + ->pricePointId(20) + ->startingQuantity(196) + ->build(); ``` diff --git a/doc/models/create-offer-request.md b/doc/models/create-offer-request.md index 815a3d6a..3b2479a4 100644 --- a/doc/models/create-offer-request.md +++ b/doc/models/create-offer-request.md @@ -11,32 +11,41 @@ | --- | --- | --- | --- | --- | --- | | `offer` | [`CreateOffer`](../../doc/models/create-offer.md) | Required | - | getOffer(): CreateOffer | setOffer(CreateOffer offer): void | -## Example (as JSON) - -```json -{ - "offer": { - "name": "name4", - "handle": "handle0", - "description": "description6", - "product_id": 30, - "product_price_point_id": 150, - "components": [ - { - "component_id": 108, - "price_point_id": 124, - "starting_quantity": 84 - }, - { - "component_id": 108, - "price_point_id": 124, - "starting_quantity": 84 - } - ], - "coupons": [ - "coupons6" - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOfferRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateOfferBuilder; +use AdvancedBillingLib\Models\Builders\CreateOfferComponentBuilder; + +$createOfferRequest = CreateOfferRequestBuilder::init( + CreateOfferBuilder::init( + 'name4', + 'handle0', + 30 + ) + ->description('description6') + ->productPricePointId(150) + ->components( + [ + CreateOfferComponentBuilder::init() + ->componentId(108) + ->pricePointId(124) + ->startingQuantity(84) + ->build(), + CreateOfferComponentBuilder::init() + ->componentId(108) + ->pricePointId(124) + ->startingQuantity(84) + ->build() + ] + ) + ->coupons( + [ + 'coupons6' + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-offer.md b/doc/models/create-offer.md index 118164a5..400691b7 100644 --- a/doc/models/create-offer.md +++ b/doc/models/create-offer.md @@ -17,30 +17,45 @@ | `components` | [`?(CreateOfferComponent[])`](../../doc/models/create-offer-component.md) | Optional | - | getComponents(): ?array | setComponents(?array components): void | | `coupons` | `?(string[])` | Optional | - | getCoupons(): ?array | setCoupons(?array coupons): void | -## Example (as JSON) - -```json -{ - "name": "name4", - "handle": "handle0", - "description": "description4", - "product_id": 208, - "product_price_point_id": 132, - "components": [ - { - "component_id": 108, - "price_point_id": 124, - "starting_quantity": 84 - }, - { - "component_id": 108, - "price_point_id": 124, - "starting_quantity": 84 - } - ], - "coupons": [ - "coupons4" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOfferBuilder; +use AdvancedBillingLib\Models\Builders\CreateOfferComponentBuilder; + +$createOffer = CreateOfferBuilder::init( + 'name6', + 'handle2', + 66 +) + ->description('description6') + ->productPricePointId(246) + ->components( + [ + CreateOfferComponentBuilder::init() + ->componentId(108) + ->pricePointId(124) + ->startingQuantity(84) + ->build(), + CreateOfferComponentBuilder::init() + ->componentId(108) + ->pricePointId(124) + ->startingQuantity(84) + ->build(), + CreateOfferComponentBuilder::init() + ->componentId(108) + ->pricePointId(124) + ->startingQuantity(84) + ->build() + ] + ) + ->coupons( + [ + 'coupons6', + 'coupons5', + 'coupons4' + ] + ) + ->build(); ``` diff --git a/doc/models/create-on-off-component.md b/doc/models/create-on-off-component.md index 81d4720c..153c6b54 100644 --- a/doc/models/create-on-off-component.md +++ b/doc/models/create-on-off-component.md @@ -11,19 +11,24 @@ | --- | --- | --- | --- | --- | --- | | `onOffComponent` | [`OnOffComponent`](../../doc/models/on-off-component.md) | Required | - | getOnOffComponent(): OnOffComponent | setOnOffComponent(OnOffComponent onOffComponent): void | -## Example (as JSON) - -```json -{ - "on_off_component": { - "name": "name6", - "description": "description6", - "handle": "handle2", - "taxable": false, - "upgrade_charge": "full", - "downgrade_credit": "full", - "unit_price": "String5" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOnOffComponentBuilder; +use AdvancedBillingLib\Models\Builders\OnOffComponentBuilder; +use AdvancedBillingLib\Models\CreditType; + +$createOnOffComponent = CreateOnOffComponentBuilder::init( + OnOffComponentBuilder::init( + 'name6', + 'String5' + ) + ->description('description6') + ->handle('handle2') + ->taxable(false) + ->upgradeCharge(CreditType::FULL) + ->downgradeCredit(CreditType::FULL) + ->build() +)->build(); ``` diff --git a/doc/models/create-or-update-endpoint-request.md b/doc/models/create-or-update-endpoint-request.md index aa38e5c0..265a319f 100644 --- a/doc/models/create-or-update-endpoint-request.md +++ b/doc/models/create-or-update-endpoint-request.md @@ -1,7 +1,7 @@ # Create or Update Endpoint Request -Used to Create or Update Endpoint +Used to Create or Update Endpoint. ## Structure @@ -11,18 +11,22 @@ Used to Create or Update Endpoint | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `endpoint` | [`CreateOrUpdateEndpoint`](../../doc/models/create-or-update-endpoint.md) | Required | Used to Create or Update Endpoint | getEndpoint(): CreateOrUpdateEndpoint | setEndpoint(CreateOrUpdateEndpoint endpoint): void | - -## Example (as JSON) - -```json -{ - "endpoint": { - "url": "url2", - "webhook_subscriptions": [ - "subscription_prepayment_account_balance_changed" - ] - } -} +| `endpoint` | [`CreateOrUpdateEndpoint`](../../doc/models/create-or-update-endpoint.md) | Required | Used to Create or Update Endpoint. | getEndpoint(): CreateOrUpdateEndpoint | setEndpoint(CreateOrUpdateEndpoint endpoint): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOrUpdateEndpointRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateEndpointBuilder; +use AdvancedBillingLib\Models\WebhookSubscription; + +$createOrUpdateEndpointRequest = CreateOrUpdateEndpointRequestBuilder::init( + CreateOrUpdateEndpointBuilder::init( + 'url2', + [ + WebhookSubscription::STATEMENT_CLOSED + ] + )->build() +)->build(); ``` diff --git a/doc/models/create-or-update-endpoint.md b/doc/models/create-or-update-endpoint.md index 6482033a..6e264779 100644 --- a/doc/models/create-or-update-endpoint.md +++ b/doc/models/create-or-update-endpoint.md @@ -1,7 +1,7 @@ # Create or Update Endpoint -Used to Create or Update Endpoint +Used to Create or Update Endpoint. ## Structure @@ -14,14 +14,19 @@ Used to Create or Update Endpoint | `url` | `string` | Required | - | getUrl(): string | setUrl(string url): void | | `webhookSubscriptions` | [`string(WebhookSubscription)[]`](../../doc/models/webhook-subscription.md) | Required | - | getWebhookSubscriptions(): array | setWebhookSubscriptions(array webhookSubscriptions): void | -## Example (as JSON) +## Example -```json -{ - "url": "url8", - "webhook_subscriptions": [ - "refund_success" - ] -} +```php +use AdvancedBillingLib\Models\Builders\CreateOrUpdateEndpointBuilder; +use AdvancedBillingLib\Models\WebhookSubscription; + +$createOrUpdateEndpoint = CreateOrUpdateEndpointBuilder::init( + 'url4', + [ + WebhookSubscription::TRIAL_END_NOTICE, + WebhookSubscription::SUBSCRIPTION_STATE_CHANGE, + WebhookSubscription::SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED + ] +)->build(); ``` diff --git a/doc/models/create-or-update-product-request.md b/doc/models/create-or-update-product-request.md index 44c853be..aad8b9df 100644 --- a/doc/models/create-or-update-product-request.md +++ b/doc/models/create-or-update-product-request.md @@ -11,22 +11,27 @@ | --- | --- | --- | --- | --- | --- | | `product` | [`CreateOrUpdateProduct`](../../doc/models/create-or-update-product.md) | Required | - | getProduct(): CreateOrUpdateProduct | setProduct(CreateOrUpdateProduct product): void | -## Example (as JSON) - -```json -{ - "product": { - "name": "name0", - "handle": "handle6", - "description": "description0", - "accounting_code": "accounting_code6", - "require_credit_card": false, - "price_in_cents": 54, - "interval": 186, - "interval_unit": "day", - "trial_price_in_cents": 34, - "trial_interval": 88 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOrUpdateProductRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateProductBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createOrUpdateProductRequest = CreateOrUpdateProductRequestBuilder::init( + CreateOrUpdateProductBuilder::init( + 'name0', + 'description0', + 54, + 186, + IntervalUnit::DAY + ) + ->handle('handle6') + ->accountingCode('accounting_code6') + ->requireCreditCard(false) + ->trialPriceInCents(34) + ->trialInterval(88) + ->build() +)->build(); ``` diff --git a/doc/models/create-or-update-product.md b/doc/models/create-or-update-product.md index c1270f72..f338d33f 100644 --- a/doc/models/create-or-update-product.md +++ b/doc/models/create-or-update-product.md @@ -15,31 +15,36 @@ | `accountingCode` | `?string` | Optional | E.g. Internal ID or SKU Number | getAccountingCode(): ?string | setAccountingCode(?string accountingCode): void | | `requireCreditCard` | `?bool` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. | getRequireCreditCard(): ?bool | setRequireCreditCard(?bool requireCreditCard): void | | `priceInCents` | `int` | Required | The product price, in integer cents | getPriceInCents(): int | setPriceInCents(int priceInCents): void | -| `interval` | `int` | Required | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days | getInterval(): int | setInterval(int interval): void | +| `interval` | `int` | Required | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days. | getInterval(): int | setInterval(int interval): void | | `intervalUnit` | [`string(IntervalUnit)`](../../doc/models/interval-unit.md) | Required | A string representing the interval unit for this product, either month or day | getIntervalUnit(): string | setIntervalUnit(string intervalUnit): void | | `trialPriceInCents` | `?int` | Optional | The product trial price, in integer cents | getTrialPriceInCents(): ?int | setTrialPriceInCents(?int trialPriceInCents): void | -| `trialInterval` | `?int` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product trial would last 30 days. | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | +| `trialInterval` | `?int` | Optional | The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product trial would last 30 days. | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | | `trialIntervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product, either month or day | getTrialIntervalUnit(): ?string | setTrialIntervalUnit(?string trialIntervalUnit): void | -| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): 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 would expire after 30 days. | getExpirationInterval(): ?int | setExpirationInterval(?int expirationInterval): void | +| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trial period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | +| `expirationInterval` | `?int` | Optional | The numerical expiration interval. e.g., an expiration_interval of ‘30’ coupled with an expiration_interval_unit of day would mean this product 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, either month, day or never | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | | `autoCreateSignupPage` | `?bool` | Optional | - | getAutoCreateSignupPage(): ?bool | setAutoCreateSignupPage(?bool autoCreateSignupPage): void | | `taxCode` | `?string` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | - -## Example (as JSON) - -```json -{ - "name": "name8", - "handle": "handle4", - "description": "description8", - "accounting_code": "accounting_code4", - "require_credit_card": false, - "price_in_cents": 190, - "interval": 174, - "interval_unit": "day", - "trial_price_in_cents": 22, - "trial_interval": 76 -} +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this product instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOrUpdateProductBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createOrUpdateProduct = CreateOrUpdateProductBuilder::init( + 'name6', + 'description4', + 138, + 154, + IntervalUnit::DAY +) + ->handle('handle2') + ->accountingCode('accounting_code2') + ->requireCreditCard(false) + ->trialPriceInCents(50) + ->trialInterval(252) + ->build(); ``` diff --git a/doc/models/create-or-update-segment-price.md b/doc/models/create-or-update-segment-price.md index 0d119f10..bdc8a6c6 100644 --- a/doc/models/create-or-update-segment-price.md +++ b/doc/models/create-or-update-segment-price.md @@ -13,13 +13,16 @@ | `endingQuantity` | `?int` | Optional | - | getEndingQuantity(): ?int | setEndingQuantity(?int endingQuantity): void | | `unitPrice` | string\|float | Required | This is a container for one-of cases. | getUnitPrice(): | setUnitPrice( unitPrice): void | -## Example (as JSON) - -```json -{ - "starting_quantity": 78, - "ending_quantity": 52, - "unit_price": "String7" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$createOrUpdateSegmentPrice = CreateOrUpdateSegmentPriceBuilder::init( + 'String9' +) + ->startingQuantity(98) + ->endingQuantity(184) + ->build(); ``` diff --git a/doc/models/create-payment-profile-request.md b/doc/models/create-payment-profile-request.md index 1e8fd5b6..41e40226 100644 --- a/doc/models/create-payment-profile-request.md +++ b/doc/models/create-payment-profile-request.md @@ -11,18 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `paymentProfile` | [`CreatePaymentProfile`](../../doc/models/create-payment-profile.md) | Required | - | getPaymentProfile(): CreatePaymentProfile | setPaymentProfile(CreatePaymentProfile paymentProfile): void | -## Example (as JSON) - -```json -{ - "payment_profile": { - "chargify_token": "tok_9g6hw85pnpt6knmskpwp4ttt", - "full_number": "5424000000000015", - "id": 44, - "payment_type": "credit_card", - "first_name": "first_name4", - "last_name": "last_name2" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePaymentProfileRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreatePaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; + +$createPaymentProfileRequest = CreatePaymentProfileRequestBuilder::init( + CreatePaymentProfileBuilder::init() + ->chargifyToken('tok_9g6hw85pnpt6knmskpwp4ttt') + ->id(44) + ->paymentType(PaymentType::CREDIT_CARD) + ->firstName('first_name4') + ->lastName('last_name2') + ->fullNumber('5424000000000015') + ->build() +)->build(); ``` diff --git a/doc/models/create-payment-profile.md b/doc/models/create-payment-profile.md index 27395037..cede6a43 100644 --- a/doc/models/create-payment-profile.md +++ b/doc/models/create-payment-profile.md @@ -19,12 +19,12 @@ | `cardType` | [`?string(CardType)`](../../doc/models/card-type.md) | Optional | The type of card used. | getCardType(): ?string | setCardType(?string cardType): void | | `expirationMonth` | int\|string\|null | Optional | This is a container for one-of cases. | getExpirationMonth(): | setExpirationMonth( expirationMonth): void | | `expirationYear` | int\|string\|null | Optional | This is a container for one-of cases. | getExpirationYear(): | setExpirationYear( expirationYear): void | -| `billingAddress` | `?string` | Optional | The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the payment gateway. | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | -| `billingAddress2` | `?string` | Optional | Second line of the customer’s billing address i.e. Apt. 100 | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | -| `billingCity` | `?string` | Optional | The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | getBillingCity(): ?string | setBillingCity(?string billingCity): void | -| `billingState` | `?string` | Optional | The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getBillingState(): ?string | setBillingState(?string billingState): void | -| `billingCountry` | `?string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | getBillingCountry(): ?string | setBillingCountry(?string billingCountry): void | -| `billingZip` | `?string` | Optional | The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | getBillingZip(): ?string | setBillingZip(?string billingZip): void | +| `billingAddress` | `?string` | Optional | The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely passed through to the payment gateway. | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | +| `billingAddress2` | `?string` | Optional | Second line of the customer’s billing address e.g., Apt. 100 | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | +| `billingCity` | `?string` | Optional | The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed through to the payment gateway. | getBillingCity(): ?string | setBillingCity(?string billingCity): void | +| `billingState` | `?string` | Optional | The credit card or bank account billing address state (e.g., MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getBillingState(): ?string | setBillingState(?string billingState): void | +| `billingCountry` | `?string` | Optional | “The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time.” | getBillingCountry(): ?string | setBillingCountry(?string billingCountry): void | +| `billingZip` | `?string` | Optional | The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed through to the payment gateway. | getBillingZip(): ?string | setBillingZip(?string billingZip): void | | `currentVault` | [`?string(AllVaults)`](../../doc/models/all-vaults.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `vaultToken` | `?string` | Optional | The “token” provided by your vault storage for an already stored payment profile | getVaultToken(): ?string | setVaultToken(?string vaultToken): void | | `customerVaultToken` | `?string` | Optional | (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | @@ -34,24 +34,27 @@ | `gatewayHandle` | `?string` | Optional | This attribute is only available if MultiGateway feature is enabled for your Site. This feature is in the Private Beta currently. gateway_handle is used to directly select a gateway where a payment profile will be stored in. Every connected gateway must have a unique gateway handle specified. Read [Multigateway description](https://chargify.zendesk.com/hc/en-us/articles/4407761759643#connecting-with-multiple-gateways) to learn more about new concepts that MultiGateway introduces and the default behavior when this attribute is not passed. | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | | `cvv` | `?string` | Optional | The 3- or 4-digit Card Verification Value. This value is merely passed through to the payment gateway. | getCvv(): ?string | setCvv(?string cvv): void | | `bankName` | `?string` | Optional | (Required when creating with ACH or GoCardless, optional with Stripe Direct Debit). The name of the bank where the customerʼs account resides | getBankName(): ?string | setBankName(?string bankName): void | -| `bankIban` | `?string` | Optional | (Optional when creating with GoCardless, required with Stripe Direct Debit). International Bank Account Number. Alternatively, local bank details can be provided | getBankIban(): ?string | setBankIban(?string bankIban): void | -| `bankRoutingNumber` | `?string` | Optional | (Required when creating with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API | getBankRoutingNumber(): ?string | setBankRoutingNumber(?string bankRoutingNumber): void | +| `bankIban` | `?string` | Optional | (Optional when creating with GoCardless, required with Stripe Direct Debit). International Bank Account Number. Alternatively, local bank details can be provided. | getBankIban(): ?string | setBankIban(?string bankIban): void | +| `bankRoutingNumber` | `?string` | Optional | (Required when creating with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API. | getBankRoutingNumber(): ?string | setBankRoutingNumber(?string bankRoutingNumber): void | | `bankAccountNumber` | `?string` | Optional | (Required when creating with ACH, GoCardless, Stripe BECS or BACS Direct Debit, and bank_iban is blank) The customerʼs bank account number | getBankAccountNumber(): ?string | setBankAccountNumber(?string bankAccountNumber): void | -| `bankBranchCode` | `?string` | Optional | (Optional when creating with GoCardless, required with Stripe BECS or BACS Direct Debit) Branch/Sort code. Alternatively, an IBAN can be provided | getBankBranchCode(): ?string | setBankBranchCode(?string bankBranchCode): void | +| `bankBranchCode` | `?string` | Optional | (Optional when creating with GoCardless, required with Stripe BECS or BACS Direct Debit) Branch/Sort code. Alternatively, an IBAN can be provided. | getBankBranchCode(): ?string | setBankBranchCode(?string bankBranchCode): void | | `bankAccountType` | [`?string(BankAccountType)`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking | getBankAccountType(): ?string | setBankAccountType(?string bankAccountType): void | | `bankAccountHolderType` | [`?string(BankAccountHolderType)`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal | getBankAccountHolderType(): ?string | setBankAccountHolderType(?string bankAccountHolderType): void | | `lastFour` | `?string` | Optional | (Optional) Used for creating subscription with payment profile imported using vault_token, for proper display in Advanced Billing UI | getLastFour(): ?string | setLastFour(?string lastFour): void | -## Example (as JSON) - -```json -{ - "chargify_token": "tok_9g6hw85pnpt6knmskpwp4ttt", - "full_number": "5424000000000015", - "id": 76, - "payment_type": "credit_card", - "first_name": "first_name8", - "last_name": "last_name6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; + +$createPaymentProfile = CreatePaymentProfileBuilder::init() + ->chargifyToken('tok_9g6hw85pnpt6knmskpwp4ttt') + ->id(124) + ->paymentType(PaymentType::CREDIT_CARD) + ->firstName('first_name6') + ->lastName('last_name4') + ->fullNumber('5424000000000015') + ->build(); ``` diff --git a/doc/models/create-payment.md b/doc/models/create-payment.md index 42a9877d..5fc51b57 100644 --- a/doc/models/create-payment.md +++ b/doc/models/create-payment.md @@ -14,14 +14,17 @@ | `paymentDetails` | `string` | Required | - | getPaymentDetails(): string | setPaymentDetails(string paymentDetails): void | | `paymentMethod` | [`string(InvoicePaymentMethodType)`](../../doc/models/invoice-payment-method-type.md) | Required | The type of payment method used. Defaults to other. | getPaymentMethod(): string | setPaymentMethod(string paymentMethod): void | -## Example (as JSON) - -```json -{ - "amount": "amount6", - "memo": "memo8", - "payment_details": "payment_details4", - "payment_method": "cash" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePaymentBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$createPayment = CreatePaymentBuilder::init( + 'amount6', + 'memo8', + 'payment_details4', + InvoicePaymentMethodType::CREDIT_CARD +)->build(); ``` diff --git a/doc/models/create-prepaid-component.md b/doc/models/create-prepaid-component.md index 4bac2f5c..b022b36c 100644 --- a/doc/models/create-prepaid-component.md +++ b/doc/models/create-prepaid-component.md @@ -11,36 +11,55 @@ | --- | --- | --- | --- | --- | --- | | `prepaidUsageComponent` | [`PrepaidUsageComponent`](../../doc/models/prepaid-usage-component.md) | Required | - | getPrepaidUsageComponent(): PrepaidUsageComponent | setPrepaidUsageComponent(PrepaidUsageComponent prepaidUsageComponent): void | -## Example (as JSON) - -```json -{ - "prepaid_usage_component": { - "name": "name2", - "unit_name": "unit_name4", - "description": "description2", - "handle": "handle8", - "taxable": false, - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "upgrade_charge": "full", - "overage_pricing": { - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePrepaidComponentBuilder; +use AdvancedBillingLib\Models\Builders\PrepaidUsageComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\OveragePricingBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\CreditType; + +$createPrepaidComponent = CreatePrepaidComponentBuilder::init( + PrepaidUsageComponentBuilder::init( + 'name2', + 'unit_name4', + PricingScheme::PER_UNIT, + OveragePricingBuilder::init( + PricingScheme::STAIRSTEP + ) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->build() + ) + ->description('description2') + ->handle('handle8') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->upgradeCharge(CreditType::FULL) + ->build() +)->build(); ``` diff --git a/doc/models/create-prepaid-usage-component-price-point.md b/doc/models/create-prepaid-usage-component-price-point.md index 98cf84bd..064661cc 100644 --- a/doc/models/create-prepaid-usage-component-price-point.md +++ b/doc/models/create-prepaid-usage-component-price-point.md @@ -15,39 +15,54 @@ | `prices` | [`Price[]`](../../doc/models/price.md) | Required | - | getPrices(): array | setPrices(array prices): void | | `overagePricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Required | - | getOveragePricing(): OveragePricing | setOveragePricing(OveragePricing overagePricing): 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.

**Default**: `true` | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | -| `rolloverPrepaidRemainder` | `?bool` | Optional | (only for 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 | -| `renewPrepaidAllocation` | `?bool` | Optional | (only for 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 | -| `expirationInterval` | `?float` | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire | getExpirationInterval(): ?float | setExpirationInterval(?float expirationInterval): void | -| `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | (only for 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 | - -## Example (as JSON) - -```json -{ - "name": "name0", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "overage_pricing": { - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - }, - "use_site_exchange_rate": true, - "handle": "handle6", - "rollover_prepaid_remainder": false, - "renew_prepaid_allocation": false, - "expiration_interval": 101.18 -} +| `rolloverPrepaidRemainder` | `?bool` | Optional | (only for 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 | +| `renewPrepaidAllocation` | `?bool` | Optional | (only for 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 | +| `expirationInterval` | `?float` | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire. | getExpirationInterval(): ?float | setExpirationInterval(?float expirationInterval): void | +| `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | (only for 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 | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePrepaidUsageComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\OveragePricingBuilder; + +$createPrepaidUsageComponentPricePoint = CreatePrepaidUsageComponentPricePointBuilder::init( + 'name2', + PricingScheme::PER_UNIT, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ], + OveragePricingBuilder::init( + PricingScheme::STAIRSTEP + ) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->build() +) + ->handle('handle8') + ->useSiteExchangeRate(true) + ->rolloverPrepaidRemainder(false) + ->renewPrepaidAllocation(false) + ->expirationInterval(165.7) + ->build(); ``` diff --git a/doc/models/create-prepayment-method.md b/doc/models/create-prepayment-method.md index 2b0a9c05..0c0c9f70 100644 --- a/doc/models/create-prepayment-method.md +++ b/doc/models/create-prepayment-method.md @@ -1,7 +1,7 @@ # Create Prepayment Method -:- When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. +When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. ## Enumeration @@ -20,3 +20,11 @@ | `CREDIT_CARD_ON_FILE` | | `OTHER` | +## Example + +```php +use AdvancedBillingLib\Models\CreatePrepaymentMethod; + +$createPrepaymentMethod = CreatePrepaymentMethod::CHECK; +``` + diff --git a/doc/models/create-prepayment-request.md b/doc/models/create-prepayment-request.md index a4c07992..c2b7d57f 100644 --- a/doc/models/create-prepayment-request.md +++ b/doc/models/create-prepayment-request.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `prepayment` | [`CreatePrepayment`](../../doc/models/create-prepayment.md) | Required | - | getPrepayment(): CreatePrepayment | setPrepayment(CreatePrepayment prepayment): void | -## Example (as JSON) - -```json -{ - "prepayment": { - "amount": 11.6, - "details": "details8", - "memo": "memo2", - "method": "money_order", - "payment_profile_id": 240 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePrepaymentRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreatePrepaymentBuilder; +use AdvancedBillingLib\Models\CreatePrepaymentMethod; + +$createPrepaymentRequest = CreatePrepaymentRequestBuilder::init( + CreatePrepaymentBuilder::init( + 11.6, + 'details8', + 'memo2', + CreatePrepaymentMethod::MONEY_ORDER + ) + ->paymentProfileId(240) + ->build() +)->build(); ``` diff --git a/doc/models/create-prepayment-response.md b/doc/models/create-prepayment-response.md index 66507c09..7f8f266f 100644 --- a/doc/models/create-prepayment-response.md +++ b/doc/models/create-prepayment-response.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `prepayment` | [`CreatedPrepayment`](../../doc/models/created-prepayment.md) | Required | - | getPrepayment(): CreatedPrepayment | setPrepayment(CreatedPrepayment prepayment): void | -## Example (as JSON) - -```json -{ - "prepayment": { - "id": 38, - "subscription_id": 148, - "amount_in_cents": 124, - "memo": "memo2", - "created_at": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatePrepaymentResponseBuilder; +use AdvancedBillingLib\Models\Builders\CreatedPrepaymentBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$createPrepaymentResponse = CreatePrepaymentResponseBuilder::init( + CreatedPrepaymentBuilder::init() + ->id(38) + ->subscriptionId(148) + ->amountInCents(124) + ->memo('memo2') + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() +)->build(); ``` diff --git a/doc/models/create-prepayment.md b/doc/models/create-prepayment.md index d25e2463..3b28c9c4 100644 --- a/doc/models/create-prepayment.md +++ b/doc/models/create-prepayment.md @@ -12,18 +12,22 @@ | `amount` | `float` | Required | - | getAmount(): float | setAmount(float amount): void | | `details` | `string` | Required | - | getDetails(): string | setDetails(string details): void | | `memo` | `string` | Required | - | getMemo(): string | setMemo(string memo): void | -| `method` | [`string(CreatePrepaymentMethod)`](../../doc/models/create-prepayment-method.md) | Required | :- When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. | getMethod(): string | setMethod(string method): void | +| `method` | [`string(CreatePrepaymentMethod)`](../../doc/models/create-prepayment-method.md) | Required | When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions. | getMethod(): string | setMethod(string method): void | | `paymentProfileId` | `?int` | Optional | - | getPaymentProfileId(): ?int | setPaymentProfileId(?int paymentProfileId): void | -## Example (as JSON) +## Example -```json -{ - "amount": 23.92, - "details": "details6", - "memo": "memo0", - "method": "credit_card_on_file", - "payment_profile_id": 240 -} +```php +use AdvancedBillingLib\Models\Builders\CreatePrepaymentBuilder; +use AdvancedBillingLib\Models\CreatePrepaymentMethod; + +$createPrepayment = CreatePrepaymentBuilder::init( + 73.78, + 'details6', + 'memo0', + CreatePrepaymentMethod::PAYPAL_ACCOUNT +) + ->paymentProfileId(58) + ->build(); ``` diff --git a/doc/models/create-product-currency-price.md b/doc/models/create-product-currency-price.md index ca6462ed..5bad0f15 100644 --- a/doc/models/create-product-currency-price.md +++ b/doc/models/create-product-currency-price.md @@ -13,13 +13,16 @@ | `price` | `int` | Required | Price for the given role. | getPrice(): int | setPrice(int price): void | | `role` | [`string(CurrencyPriceRole)`](../../doc/models/currency-price-role.md) | Required | Role for the price. | getRole(): string | setRole(string role): void | -## Example (as JSON) - -```json -{ - "currency": "currency0", - "price": 222, - "role": "baseline" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateProductCurrencyPriceBuilder; +use AdvancedBillingLib\Models\CurrencyPriceRole; + +$createProductCurrencyPrice = CreateProductCurrencyPriceBuilder::init( + 'currency2', + 78, + CurrencyPriceRole::BASELINE +)->build(); ``` diff --git a/doc/models/create-product-currency-prices-request.md b/doc/models/create-product-currency-prices-request.md index 6417d9f1..7f73b910 100644 --- a/doc/models/create-product-currency-prices-request.md +++ b/doc/models/create-product-currency-prices-request.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`CreateProductCurrencyPrice[]`](../../doc/models/create-product-currency-price.md) | Required | - | getCurrencyPrices(): array | setCurrencyPrices(array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "currency": "currency8", - "price": 78, - "role": "initial" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateProductCurrencyPricesRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateProductCurrencyPriceBuilder; +use AdvancedBillingLib\Models\CurrencyPriceRole; + +$createProductCurrencyPricesRequest = CreateProductCurrencyPricesRequestBuilder::init( + [ + CreateProductCurrencyPriceBuilder::init( + 'currency8', + 78, + CurrencyPriceRole::INITIAL + )->build() + ] +)->build(); ``` diff --git a/doc/models/create-product-family-request.md b/doc/models/create-product-family-request.md index 575daa5e..6578f709 100644 --- a/doc/models/create-product-family-request.md +++ b/doc/models/create-product-family-request.md @@ -11,15 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `productFamily` | [`CreateProductFamily`](../../doc/models/create-product-family.md) | Required | - | getProductFamily(): CreateProductFamily | setProductFamily(CreateProductFamily productFamily): void | -## Example (as JSON) - -```json -{ - "product_family": { - "name": "name0", - "handle": "handle6", - "description": "description0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateProductFamilyRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateProductFamilyBuilder; + +$createProductFamilyRequest = CreateProductFamilyRequestBuilder::init( + CreateProductFamilyBuilder::init( + 'name0' + ) + ->handle('handle6') + ->description('description0') + ->surcharging(false) + ->build() +)->build(); ``` diff --git a/doc/models/create-product-family.md b/doc/models/create-product-family.md index dc519a56..651b2c91 100644 --- a/doc/models/create-product-family.md +++ b/doc/models/create-product-family.md @@ -12,14 +12,19 @@ | `name` | `string` | Required | - | getName(): string | setName(string name): void | | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | | `description` | `?string` | Optional | - | getDescription(): ?string | setDescription(?string description): void | +| `surcharging` | `?bool` | Optional | Whether surcharging applies to this product family. Defaults to `true` when omitted. Only applied on sites where surcharging is enabled. | getSurcharging(): ?bool | setSurcharging(?bool surcharging): void | -## Example (as JSON) +## Example -```json -{ - "name": "name6", - "handle": "handle2", - "description": "description6" -} +```php +use AdvancedBillingLib\Models\Builders\CreateProductFamilyBuilder; + +$createProductFamily = CreateProductFamilyBuilder::init( + 'name0' +) + ->handle('handle6') + ->description('description0') + ->surcharging(false) + ->build(); ``` diff --git a/doc/models/create-product-price-point-request.md b/doc/models/create-product-price-point-request.md index 030bfdfa..7844513f 100644 --- a/doc/models/create-product-price-point-request.md +++ b/doc/models/create-product-price-point-request.md @@ -11,22 +11,28 @@ | --- | --- | --- | --- | --- | --- | | `pricePoint` | [`CreateProductPricePoint`](../../doc/models/create-product-price-point.md) | Required | - | getPricePoint(): CreateProductPricePoint | setPricePoint(CreateProductPricePoint pricePoint): void | -## Example (as JSON) - -```json -{ - "price_point": { - "name": "name0", - "price_in_cents": 196, - "interval": 44, - "interval_unit": "day", - "use_site_exchange_rate": true, - "handle": "handle6", - "trial_price_in_cents": 108, - "trial_interval": 202, - "trial_interval_unit": "day", - "trial_type": "no_obligation" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateProductPricePointRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateProductPricePointBuilder; +use AdvancedBillingLib\Models\IntervalUnit; +use AdvancedBillingLib\Models\TrialType; + +$createProductPricePointRequest = CreateProductPricePointRequestBuilder::init( + CreateProductPricePointBuilder::init( + 'name0', + 196, + 44, + IntervalUnit::DAY + ) + ->handle('handle6') + ->trialPriceInCents(108) + ->trialInterval(202) + ->trialIntervalUnit(IntervalUnit::DAY) + ->trialType(TrialType::NO_OBLIGATION) + ->useSiteExchangeRate(true) + ->build() +)->build(); ``` diff --git a/doc/models/create-product-price-point.md b/doc/models/create-product-price-point.md index 13b6da83..c386bfe2 100644 --- a/doc/models/create-product-price-point.md +++ b/doc/models/create-product-price-point.md @@ -12,32 +12,37 @@ | `name` | `string` | Required | The product price point name | getName(): string | setName(string name): void | | `handle` | `?string` | Optional | The product price point API handle | getHandle(): ?string | setHandle(?string handle): void | | `priceInCents` | `int` | Required | The product price point price, in integer cents | getPriceInCents(): int | setPriceInCents(int priceInCents): void | -| `interval` | `int` | Required | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this product price point would renew every 30 days | getInterval(): int | setInterval(int interval): void | +| `interval` | `int` | Required | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this product price point would renew every 30 days. | getInterval(): int | setInterval(int interval): void | | `intervalUnit` | [`string(IntervalUnit)`](../../doc/models/interval-unit.md) | Required | A string representing the interval unit for this product price point, either month or day | getIntervalUnit(): string | setIntervalUnit(string intervalUnit): void | | `trialPriceInCents` | `?int` | Optional | The product price point trial price, in integer cents | getTrialPriceInCents(): ?int | setTrialPriceInCents(?int trialPriceInCents): void | -| `trialInterval` | `?int` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days. | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | +| `trialInterval` | `?int` | Optional | The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days. | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | | `trialIntervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product price point, either month or day | getTrialIntervalUnit(): ?string | setTrialIntervalUnit(?string trialIntervalUnit): void | -| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | +| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trial period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | | `initialChargeInCents` | `?int` | Optional | The product price point initial charge, in integer cents | getInitialChargeInCents(): ?int | setInitialChargeInCents(?int initialChargeInCents): void | | `initialChargeAfterTrial` | `?bool` | Optional | - | getInitialChargeAfterTrial(): ?bool | setInitialChargeAfterTrial(?bool initialChargeAfterTrial): 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 | +| `expirationInterval` | `?int` | Optional | The numerical expiration interval. e.g., 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 | | `useSiteExchangeRate` | `?bool` | Optional | Whether or not to use the site's exchange rate or define your own pricing when your site has multiple currencies defined.

**Default**: `true` | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | -## Example (as JSON) - -```json -{ - "name": "name6", - "price_in_cents": 216, - "interval": 200, - "interval_unit": "day", - "use_site_exchange_rate": true, - "handle": "handle2", - "trial_price_in_cents": 48, - "trial_interval": 102, - "trial_interval_unit": "day", - "trial_type": "no_obligation" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateProductPricePointBuilder; +use AdvancedBillingLib\Models\IntervalUnit; +use AdvancedBillingLib\Models\TrialType; + +$createProductPricePoint = CreateProductPricePointBuilder::init( + 'name6', + 180, + 60, + IntervalUnit::DAY +) + ->handle('handle2') + ->trialPriceInCents(92) + ->trialInterval(218) + ->trialIntervalUnit(IntervalUnit::DAY) + ->trialType(TrialType::NO_OBLIGATION) + ->useSiteExchangeRate(true) + ->build(); ``` diff --git a/doc/models/create-quantity-based-component.md b/doc/models/create-quantity-based-component.md index c0ace5fa..4120f21f 100644 --- a/doc/models/create-quantity-based-component.md +++ b/doc/models/create-quantity-based-component.md @@ -11,31 +11,46 @@ | --- | --- | --- | --- | --- | --- | | `quantityBasedComponent` | [`QuantityBasedComponent`](../../doc/models/quantity-based-component.md) | Required | - | getQuantityBasedComponent(): QuantityBasedComponent | setQuantityBasedComponent(QuantityBasedComponent quantityBasedComponent): void | -## Example (as JSON) - -```json -{ - "quantity_based_component": { - "name": "name0", - "unit_name": "unit_name2", - "description": "description0", - "handle": "handle6", - "taxable": 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 - } - ], - "upgrade_charge": "prorated" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateQuantityBasedComponentBuilder; +use AdvancedBillingLib\Models\Builders\QuantityBasedComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\CreditType; + +$createQuantityBasedComponent = CreateQuantityBasedComponentBuilder::init( + QuantityBasedComponentBuilder::init( + 'name0', + 'unit_name2', + PricingScheme::STAIRSTEP + ) + ->description('description0') + ->handle('handle6') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->upgradeCharge(CreditType::PRORATED) + ->build() +)->build(); ``` diff --git a/doc/models/create-reason-code-request.md b/doc/models/create-reason-code-request.md index 6e52a1d1..e3ba379b 100644 --- a/doc/models/create-reason-code-request.md +++ b/doc/models/create-reason-code-request.md @@ -11,15 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `reasonCode` | [`CreateReasonCode`](../../doc/models/create-reason-code.md) | Required | - | getReasonCode(): CreateReasonCode | setReasonCode(CreateReasonCode reasonCode): void | -## Example (as JSON) - -```json -{ - "reason_code": { - "code": "code4", - "description": "description6", - "position": 14 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateReasonCodeRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateReasonCodeBuilder; + +$createReasonCodeRequest = CreateReasonCodeRequestBuilder::init( + CreateReasonCodeBuilder::init( + 'code4', + 'description6' + ) + ->position(14) + ->build() +)->build(); ``` diff --git a/doc/models/create-reason-code.md b/doc/models/create-reason-code.md index 839a26e6..36542652 100644 --- a/doc/models/create-reason-code.md +++ b/doc/models/create-reason-code.md @@ -13,13 +13,16 @@ | `description` | `string` | Required | The friendly summary of what the code signifies | getDescription(): string | setDescription(string description): void | | `position` | `?int` | Optional | The order that code appears in lists | getPosition(): ?int | setPosition(?int position): void | -## Example (as JSON) - -```json -{ - "code": "code4", - "description": "description6", - "position": 86 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateReasonCodeBuilder; + +$createReasonCode = CreateReasonCodeBuilder::init( + 'code4', + 'description6' +) + ->position(40) + ->build(); ``` diff --git a/doc/models/create-segment-request.md b/doc/models/create-segment-request.md index 979a288e..05c57678 100644 --- a/doc/models/create-segment-request.md +++ b/doc/models/create-segment-request.md @@ -11,34 +11,53 @@ | --- | --- | --- | --- | --- | --- | | `segment` | [`CreateSegment`](../../doc/models/create-segment.md) | Required | - | getSegment(): CreateSegment | setSegment(CreateSegment segment): void | -## Example (as JSON) - -```json -{ - "segment": { - "segment_property_1_value": "String1", - "segment_property_2_value": "String3", - "segment_property_3_value": "String1", - "segment_property_4_value": "String5", - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateSegmentRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateSegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$createSegmentRequest = CreateSegmentRequestBuilder::init( + CreateSegmentBuilder::init( + PricingScheme::STAIRSTEP + ) + ->segmentProperty1Value( + 'String1' + ) + ->segmentProperty2Value( + 'String3' + ) + ->segmentProperty3Value( + 'String1' + ) + ->segmentProperty4Value( + 'String5' + ) + ->prices( + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-segment.md b/doc/models/create-segment.md index 6566a996..8fabf8c2 100644 --- a/doc/models/create-segment.md +++ b/doc/models/create-segment.md @@ -16,32 +16,44 @@ | `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` | [`?(CreateOrUpdateSegmentPrice[])`](../../doc/models/create-or-update-segment-price.md) | Optional | - | getPrices(): ?array | setPrices(?array prices): void | -## Example (as JSON) - -```json -{ - "segment_property_1_value": "String9", - "segment_property_2_value": "String1", - "segment_property_3_value": "String3", - "segment_property_4_value": "String3", - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateSegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$createSegment = CreateSegmentBuilder::init( + PricingScheme::STAIRSTEP +) + ->segmentProperty1Value( + 'String7' + ) + ->segmentProperty2Value( + 'String9' + ) + ->segmentProperty3Value( + 'String5' + ) + ->segmentProperty4Value( + 'String1' + ) + ->prices( + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/create-signup-proforma-preview-include.md b/doc/models/create-signup-proforma-preview-include.md index e652ba44..93f04d83 100644 --- a/doc/models/create-signup-proforma-preview-include.md +++ b/doc/models/create-signup-proforma-preview-include.md @@ -13,7 +13,9 @@ ## Example -``` -next_proforma_invoice +```php +use AdvancedBillingLib\Models\CreateSignupProformaPreviewInclude; + +$createSignupProformaPreviewInclude = CreateSignupProformaPreviewInclude::NEXT_PROFORMA_INVOICE; ``` diff --git a/doc/models/create-subscription-component.md b/doc/models/create-subscription-component.md index 0f159a4a..391a0536 100644 --- a/doc/models/create-subscription-component.md +++ b/doc/models/create-subscription-component.md @@ -11,21 +11,29 @@ | --- | --- | --- | --- | --- | --- | | `componentId` | int\|string\|null | Optional | This is a container for one-of cases. | getComponentId(): | setComponentId( componentId): void | | `enabled` | `?bool` | Optional | Used for on/off components only. | getEnabled(): ?bool | setEnabled(?bool enabled): void | -| `unitBalance` | `?int` | Optional | Used for metered and events based components. | getUnitBalance(): ?int | setUnitBalance(?int unitBalance): void | +| `unitBalance` | int\|string\|null | Optional | This is a container for one-of cases. | getUnitBalance(): | setUnitBalance( unitBalance): void | | `allocatedQuantity` | int\|string\|null | Optional | This is a container for one-of cases. | getAllocatedQuantity(): | setAllocatedQuantity( allocatedQuantity): void | | `quantity` | `?int` | Optional | Deprecated. Use `allocated_quantity` instead. | getQuantity(): ?int | setQuantity(?int quantity): void | | `pricePointId` | int\|string\|null | Optional | This is a container for one-of cases. | getPricePointId(): | setPricePointId( pricePointId): 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 -{ - "component_id": 8, - "enabled": false, - "unit_balance": 144, - "allocated_quantity": 102, - "quantity": 188 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateSubscriptionComponentBuilder; + +$createSubscriptionComponent = CreateSubscriptionComponentBuilder::init() + ->componentId( + 210 + ) + ->enabled(false) + ->unitBalance( + 12 + ) + ->allocatedQuantity( + 48 + ) + ->quantity(134) + ->build(); ``` diff --git a/doc/models/create-subscription-group-request.md b/doc/models/create-subscription-group-request.md index 94a07db8..25f6e5c2 100644 --- a/doc/models/create-subscription-group-request.md +++ b/doc/models/create-subscription-group-request.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionGroup` | [`CreateSubscriptionGroup`](../../doc/models/create-subscription-group.md) | Required | - | getSubscriptionGroup(): CreateSubscriptionGroup | setSubscriptionGroup(CreateSubscriptionGroup subscriptionGroup): void | -## Example (as JSON) - -```json -{ - "subscription_group": { - "subscription_id": 36, - "member_ids": [ - 164, - 165 - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateSubscriptionGroupRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateSubscriptionGroupBuilder; + +$createSubscriptionGroupRequest = CreateSubscriptionGroupRequestBuilder::init( + CreateSubscriptionGroupBuilder::init( + 36 + ) + ->memberIds( + [ + 164, + 165 + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-subscription-group.md b/doc/models/create-subscription-group.md index 04af122f..f5decb89 100644 --- a/doc/models/create-subscription-group.md +++ b/doc/models/create-subscription-group.md @@ -12,14 +12,19 @@ | `subscriptionId` | `int` | Required | - | getSubscriptionId(): int | setSubscriptionId(int subscriptionId): void | | `memberIds` | `?(int[])` | Optional | - | getMemberIds(): ?array | setMemberIds(?array memberIds): void | -## Example (as JSON) - -```json -{ - "subscription_id": 38, - "member_ids": [ - 162 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateSubscriptionGroupBuilder; + +$createSubscriptionGroup = CreateSubscriptionGroupBuilder::init( + 204 +) + ->memberIds( + [ + 48 + ] + ) + ->build(); ``` diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md index 151185a6..bde06e76 100644 --- a/doc/models/create-subscription-request.md +++ b/doc/models/create-subscription-request.md @@ -11,33 +11,47 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`CreateSubscription`](../../doc/models/create-subscription.md) | Required | - | getSubscription(): CreateSubscription | setSubscription(CreateSubscription subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "defer_signup": false, - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "dunning_communication_delay_enabled": false, - "dunning_communication_delay_time_zone": "\"Eastern Time (US & Canada)\"", - "product_handle": "product_handle6", - "product_id": 206, - "product_price_point_handle": "product_price_point_handle2", - "product_price_point_id": 130, - "custom_price": { - "name": "name4", - "handle": "handle0", - "price_in_cents": "String3", - "interval": "String3", - "interval_unit": "day", - "trial_price_in_cents": "String3", - "trial_interval": "String5", - "trial_interval_unit": "day" - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateSubscriptionRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateSubscriptionBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionCustomPriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createSubscriptionRequest = CreateSubscriptionRequestBuilder::init( + CreateSubscriptionBuilder::init() + ->productHandle('product_handle6') + ->productId(206) + ->productPricePointHandle('product_price_point_handle2') + ->productPricePointId(130) + ->customPrice( + SubscriptionCustomPriceBuilder::init( + 'String3', + 'String3' + ) + ->name('name4') + ->handle('handle0') + ->intervalUnit(IntervalUnit::DAY) + ->trialPriceInCents( + 'String3' + ) + ->trialInterval( + 'String5' + ) + ->trialIntervalUnit(IntervalUnit::DAY) + ->build() + ) + ->deferSignup(false) + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->dunningCommunicationDelayEnabled(false) + ->dunningCommunicationDelayTimeZone('"Eastern Time (US & Canada)"') + ->build() +)->build(); ``` diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md index ec651145..b8897804 100644 --- a/doc/models/create-subscription.md +++ b/doc/models/create-subscription.md @@ -20,19 +20,20 @@ | `receivesInvoiceEmails` | `?string` | Optional | (Optional) Default: True - Whether or not this subscription is set to receive emails related to this subscription. | getReceivesInvoiceEmails(): ?string | setReceivesInvoiceEmails(?string receivesInvoiceEmails): void | | `netTerms` | `?string` | Optional | (Optional) Default: null The number of days after renewal (on invoice billing) that a subscription is due. A value between 0 (due immediately) and 180. | getNetTerms(): ?string | setNetTerms(?string netTerms): void | | `customerId` | `?int` | Optional | The ID of an existing customer within Chargify. Required, unless a `customer_reference` or a set of `customer_attributes` is given. | getCustomerId(): ?int | setCustomerId(?int customerId): void | +| `brandingThemeId` | `?int` | Optional | The ID of the Branding Theme to assign to this subscription. When set, this subscription-level Branding Theme is used instead of the customer's default Branding Theme for subscription-related documents and communications that use subscription theming. Pass null or an empty value to clear the subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not returned in the response. | getBrandingThemeId(): ?int | setBrandingThemeId(?int brandingThemeId): void | | `nextBillingAt` | `?DateTime` | Optional | (Optional) Set this attribute to a future date/time to sync imported subscriptions to your existing renewal schedule. See the notes on “Date/Time Format” in our [subscription import documentation](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format). If you provide a next_billing_at timestamp that is in the future, no trial or initial charges will be applied when you create the subscription. In fact, no payment will be captured at all. The first payment will be captured, according to the prices defined by the product, near the time specified by next_billing_at. If you do not provide a value for next_billing_at, any trial and/or initial charges will be assessed and charged at the time of subscription creation. If the card cannot be successfully charged, the subscription will not be created. See further notes in the section on Importing Subscriptions. | getNextBillingAt(): ?\DateTime | setNextBillingAt(?\DateTime nextBillingAt): void | | `initialBillingAt` | `?DateTime` | Optional | (Optional) Set this attribute to a future date/time to create a subscription in the Awaiting Signup state, rather than Active or Trialing. You can omit the initial_billing_at date to activate the subscription immediately. In the Awaiting Signup state, a subscription behaves like any other. It can be canceled, allocated to, or have its billing date changed. etc. When the initial_billing_at date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. See the [subscription import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format) documentation for more information about Date/Time Formats. | getInitialBillingAt(): ?\DateTime | setInitialBillingAt(?\DateTime initialBillingAt): void | -| `deferSignup` | `?bool` | Optional | (Optional) Set this attribute to true to create the subscription in the Awaiting Signup Date state. Use this when you want to create a subscription that has an unknown first billing date. When the first billing date is known, update a subscription and set the `initial_billing_at` date. The subscription moves to the Awaiting Signup state with a scheduled initial billing date. You can omit the initial_billing_at date to activate the subscription immediately. See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773-Subscription-States) for more information.

**Default**: `false` | getDeferSignup(): ?bool | setDeferSignup(?bool deferSignup): void | +| `deferSignup` | `?bool` | Optional | (Optional) Set this attribute to true to create the subscription in the Awaiting Signup Date state. Use this when you want to create a subscription that has an unknown first billing date. When the first billing date is known, update a subscription and set the `initial_billing_at` date. The subscription moves to the Awaiting Signup state with a scheduled initial billing date. You can omit the initial_billing_at date to activate the subscription immediately. See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773-Subscription-States) for more information.

**Default**: `false` | getDeferSignup(): ?bool | setDeferSignup(?bool deferSignup): 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 | | `salesRepId` | `?int` | Optional | - | getSalesRepId(): ?int | setSalesRepId(?int salesRepId): void | -| `paymentProfileId` | `?int` | Optional | The Payment Profile ID of an existing card or bank account, which belongs to an existing customer to use for payment for this subscription. If the card, bank account, or customer does not exist already, or if you want to use a new (unstored) card or bank account for the subscription, use `payment_profile_attributes` instead to create a new payment profile along with the subscription. (This value is available on an existing subscription via the API as `credit_card` > id or `bank_account` > id) | getPaymentProfileId(): ?int | setPaymentProfileId(?int paymentProfileId): void | +| `paymentProfileId` | `?int` | Optional | The Payment Profile ID of an existing card or bank account, which belongs to an existing customer to use for payment for this subscription. If the card, bank account, or customer does not exist already, or if you want to use a new (unstored) card or bank account for the subscription, use `payment_profile_attributes` instead to create a new payment profile along with the subscription. (This value is available on an existing subscription via the API as `credit_card` > id or `bank_account` > id.) | getPaymentProfileId(): ?int | setPaymentProfileId(?int paymentProfileId): void | | `reference` | `?string` | Optional | The reference value (provided by your app) for the subscription itself. | getReference(): ?string | setReference(?string reference): void | | `customerAttributes` | [`?CustomerAttributes`](../../doc/models/customer-attributes.md) | Optional | - | getCustomerAttributes(): ?CustomerAttributes | setCustomerAttributes(?CustomerAttributes customerAttributes): void | | `paymentProfileAttributes` | [`?PaymentProfileAttributes`](../../doc/models/payment-profile-attributes.md) | Optional | alias to credit_card_attributes | getPaymentProfileAttributes(): ?PaymentProfileAttributes | setPaymentProfileAttributes(?PaymentProfileAttributes paymentProfileAttributes): void | | `creditCardAttributes` | [`?PaymentProfileAttributes`](../../doc/models/payment-profile-attributes.md) | Optional | Credit Card data to create a new Subscription. Interchangeable with `payment_profile_attributes` property. | getCreditCardAttributes(): ?PaymentProfileAttributes | setCreditCardAttributes(?PaymentProfileAttributes creditCardAttributes): void | | `bankAccountAttributes` | [`?BankAccountAttributes`](../../doc/models/bank-account-attributes.md) | Optional | - | getBankAccountAttributes(): ?BankAccountAttributes | setBankAccountAttributes(?BankAccountAttributes bankAccountAttributes): void | | `components` | [`?(CreateSubscriptionComponent[])`](../../doc/models/create-subscription-component.md) | Optional | (Optional) An array of component ids and quantities to be added to the subscription. See [Components](https://maxio.zendesk.com/hc/en-us/articles/24261141522189-Components-Overview) for more information. | getComponents(): ?array | setComponents(?array components): 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 | +| `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 | | `customerReference` | `?string` | Optional | The reference value (provided by your app) of an existing customer within Chargify. Required, unless a `customer_id` or a set of `customer_attributes` is given. | getCustomerReference(): ?string | setCustomerReference(?string customerReference): void | | `group` | [`?GroupSettings`](../../doc/models/group-settings.md) | Optional | - | getGroup(): ?GroupSettings | setGroup(?GroupSettings group): void | @@ -60,31 +61,44 @@ | `dunningCommunicationDelayTimeZone` | `?string` | Optional | Time zone for the Dunning Communication Delay feature. | getDunningCommunicationDelayTimeZone(): ?string | setDunningCommunicationDelayTimeZone(?string dunningCommunicationDelayTimeZone): void | | `skipBillingManifestTaxes` | `?bool` | Optional | Valid only for the Subscription Preview endpoint. When set to `true` it skips calculating taxes for the current and next billing manifests. Defaults to `false` when not provided. | getSkipBillingManifestTaxes(): ?bool | setSkipBillingManifestTaxes(?bool skipBillingManifestTaxes): void | -## Example (as JSON) +## Example -```json -{ - "defer_signup": false, - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "dunning_communication_delay_enabled": false, - "dunning_communication_delay_time_zone": "\"Eastern Time (US & Canada)\"", - "product_handle": "product_handle6", - "product_id": 212, - "product_price_point_handle": "product_price_point_handle0", - "product_price_point_id": 136, - "custom_price": { - "name": "name4", - "handle": "handle0", - "price_in_cents": "String3", - "interval": "String3", - "interval_unit": "day", - "trial_price_in_cents": "String3", - "trial_interval": "String5", - "trial_interval_unit": "day" - } -} +```php +use AdvancedBillingLib\Models\Builders\CreateSubscriptionBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionCustomPriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$createSubscription = CreateSubscriptionBuilder::init() + ->productHandle('product_handle4') + ->productId(82) + ->productPricePointHandle('product_price_point_handle2') + ->productPricePointId(6) + ->customPrice( + SubscriptionCustomPriceBuilder::init( + 'String3', + 'String3' + ) + ->name('name4') + ->handle('handle0') + ->intervalUnit(IntervalUnit::DAY) + ->trialPriceInCents( + 'String3' + ) + ->trialInterval( + 'String5' + ) + ->trialIntervalUnit(IntervalUnit::DAY) + ->build() + ) + ->deferSignup(false) + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->dunningCommunicationDelayEnabled(false) + ->dunningCommunicationDelayTimeZone('"Eastern Time (US & Canada)"') + ->build(); ``` diff --git a/doc/models/create-usage-request.md b/doc/models/create-usage-request.md index 7a81b668..505a895f 100644 --- a/doc/models/create-usage-request.md +++ b/doc/models/create-usage-request.md @@ -11,37 +11,57 @@ | --- | --- | --- | --- | --- | --- | | `usage` | [`CreateUsage`](../../doc/models/create-usage.md) | Required | - | getUsage(): CreateUsage | setUsage(CreateUsage usage): void | -## Example (as JSON) - -```json -{ - "usage": { - "quantity": 162.34, - "price_point_id": "price_point_id0", - "memo": "memo2", - "billing_schedule": { - "initial_billing_at": "2016-03-13" - }, - "custom_price": { - "tax_included": false, - "pricing_scheme": "stairstep", - "interval": 66, - "interval_unit": "day", - "list_price_point_id": 174, - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateUsageRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateUsageBuilder; +use AdvancedBillingLib\Models\Builders\BillingScheduleBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\IntervalUnit; + +$createUsageRequest = CreateUsageRequestBuilder::init( + CreateUsageBuilder::init() + ->quantity(162.34) + ->pricePointId('price_point_id0') + ->memo('memo2') + ->billingSchedule( + BillingScheduleBuilder::init() + ->initialBillingAt(DateTimeHelper::fromSimpleDate('2016-03-13')) + ->build() + ) + ->customPrice( + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(66) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(174) + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/create-usage.md b/doc/models/create-usage.md index 3de0be60..4b8a61f6 100644 --- a/doc/models/create-usage.md +++ b/doc/models/create-usage.md @@ -15,35 +15,54 @@ | `billingSchedule` | [`?BillingSchedule`](../../doc/models/billing-schedule.md) | Optional | Billing schedule settings for component allocations or usages on multi-frequency subscriptions. Use this to start a component's billing period on a custom date instead of aligning with the product charge schedule. | 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": 23.44, - "price_point_id": "price_point_id0", - "memo": "memo2", - "billing_schedule": { - "initial_billing_at": "2016-03-13" - }, - "custom_price": { - "tax_included": false, - "pricing_scheme": "stairstep", - "interval": 66, - "interval_unit": "day", - "list_price_point_id": 174, - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreateUsageBuilder; +use AdvancedBillingLib\Models\Builders\BillingScheduleBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\IntervalUnit; + +$createUsage = CreateUsageBuilder::init() + ->quantity(204.7) + ->pricePointId('price_point_id4') + ->memo('memo8') + ->billingSchedule( + BillingScheduleBuilder::init() + ->initialBillingAt(DateTimeHelper::fromSimpleDate('2016-03-13')) + ->build() + ) + ->customPrice( + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(66) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(174) + ->build() + ) + ->build(); ``` diff --git a/doc/models/created-prepayment.md b/doc/models/created-prepayment.md index 87eb0258..42065a29 100644 --- a/doc/models/created-prepayment.md +++ b/doc/models/created-prepayment.md @@ -17,15 +17,18 @@ | `startingBalanceInCents` | `?int` | Optional | **Constraints**: `>= 0` | getStartingBalanceInCents(): ?int | setStartingBalanceInCents(?int startingBalanceInCents): void | | `endingBalanceInCents` | `?int` | Optional | - | getEndingBalanceInCents(): ?int | setEndingBalanceInCents(?int endingBalanceInCents): void | -## Example (as JSON) - -```json -{ - "id": 110, - "subscription_id": 220, - "amount_in_cents": 196, - "memo": "memo6", - "created_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreatedPrepaymentBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$createdPrepayment = CreatedPrepaymentBuilder::init() + ->id(186) + ->subscriptionId(40) + ->amountInCents(240) + ->memo('memo6') + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/credit-account-balance-changed.md b/doc/models/credit-account-balance-changed.md index e47d623f..15a646ab 100644 --- a/doc/models/credit-account-balance-changed.md +++ b/doc/models/credit-account-balance-changed.md @@ -15,15 +15,18 @@ | `currencyCode` | `string` | Required | - | getCurrencyCode(): string | setCurrencyCode(string currencyCode): void | | `atTime` | `DateTime` | Required | - | getAtTime(): \DateTime | setAtTime(\DateTime atTime): void | -## Example (as JSON) - -```json -{ - "reason": "reason8", - "service_credit_account_balance_in_cents": 10, - "service_credit_balance_change_in_cents": 116, - "currency_code": "currency_code8", - "at_time": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreditAccountBalanceChangedBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$creditAccountBalanceChanged = CreditAccountBalanceChangedBuilder::init( + 'reason4', + 216, + 166, + 'currency_code6', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); ``` diff --git a/doc/models/credit-card-attributes.md b/doc/models/credit-card-attributes.md index e3aa1d0e..cd0a0146 100644 --- a/doc/models/credit-card-attributes.md +++ b/doc/models/credit-card-attributes.md @@ -13,13 +13,15 @@ | `expirationMonth` | `?string` | Optional | - | getExpirationMonth(): ?string | setExpirationMonth(?string expirationMonth): void | | `expirationYear` | `?string` | Optional | - | getExpirationYear(): ?string | setExpirationYear(?string expirationYear): void | -## Example (as JSON) - -```json -{ - "full_number": "full_number0", - "expiration_month": "expiration_month6", - "expiration_year": "expiration_year0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreditCardAttributesBuilder; + +$creditCardAttributes = CreditCardAttributesBuilder::init() + ->fullNumber('full_number8') + ->expirationMonth('expiration_month8') + ->expirationYear('expiration_year2') + ->build(); ``` diff --git a/doc/models/credit-card-payment-profile.md b/doc/models/credit-card-payment-profile.md index 46c470f5..88d0d47f 100644 --- a/doc/models/credit-card-payment-profile.md +++ b/doc/models/credit-card-payment-profile.md @@ -12,10 +12,10 @@ | `id` | `?int` | Optional | The Chargify-assigned ID of the stored card. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer. | getId(): ?int | setId(?int id): void | | `firstName` | `?string` | Optional | The first name of the card holder. | getFirstName(): ?string | setFirstName(?string firstName): void | | `lastName` | `?string` | Optional | The last name of the card holder. | getLastName(): ?string | setLastName(?string lastName): void | -| `maskedCardNumber` | `?string` | Optional | A string representation of the credit card number with all but the last 4 digits masked with X’s (i.e. ‘XXXX-XXXX-XXXX-1234’). | getMaskedCardNumber(): ?string | setMaskedCardNumber(?string maskedCardNumber): void | +| `maskedCardNumber` | `?string` | Optional | A string representation of the credit card number with all but the last 4 digits masked with X’s (e.g., ‘XXXX-XXXX-XXXX-1234’). | getMaskedCardNumber(): ?string | setMaskedCardNumber(?string maskedCardNumber): void | | `cardType` | [`?string(CardType)`](../../doc/models/card-type.md) | Optional | The type of card used. | getCardType(): ?string | setCardType(?string cardType): void | | `expirationMonth` | `?int` | Optional | An integer representing the expiration month of the card(1 – 12). | getExpirationMonth(): ?int | setExpirationMonth(?int expirationMonth): void | -| `expirationYear` | `?int` | Optional | An integer representing the 4-digit expiration year of the card(i.e. ‘2012’). | getExpirationYear(): ?int | setExpirationYear(?int expirationYear): void | +| `expirationYear` | `?int` | Optional | An integer representing the 4-digit expiration year of the card(e.g., ‘2012’). | getExpirationYear(): ?int | setExpirationYear(?int expirationYear): void | | `customerId` | `?int` | Optional | The Chargify-assigned id for the customer record to which the card belongs. | getCustomerId(): ?int | setCustomerId(?int customerId): void | | `currentVault` | [`?string(CreditCardVault)`](../../doc/models/credit-card-vault.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `vaultToken` | `?string` | Optional | The “token” provided by your vault storage for an already stored payment profile. | getVaultToken(): ?string | setVaultToken(?string vaultToken): void | @@ -28,36 +28,42 @@ | `billingAddress2` | `?string` | Optional | The current billing street address, second line, for the card. | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | | `paymentType` | [`string(PaymentType)`](../../doc/models/payment-type.md) | Required | **Default**: `PaymentType::CREDIT_CARD` | getPaymentType(): string | setPaymentType(string paymentType): void | | `disabled` | `?bool` | Optional | - | getDisabled(): ?bool | setDisabled(?bool disabled): void | -| `chargifyToken` | `?string` | Optional | Token received after sending billing information using Maxio.js (formerly Chargify.js). This token will only be received if passed as a sole attribute of credit_card_attributes (i.e. tok_9g6hw85pnpt6knmskpwp4ttt) | getChargifyToken(): ?string | setChargifyToken(?string chargifyToken): void | +| `chargifyToken` | `?string` | Optional | Token received after sending billing information using Maxio.js (formerly Chargify.js). This token will only be received if passed as a sole attribute of credit_card_attributes (e.g., tok_9g6hw85pnpt6knmskpwp4ttt). | getChargifyToken(): ?string | setChargifyToken(?string chargifyToken): void | | `siteGatewaySettingId` | `?int` | Optional | - | getSiteGatewaySettingId(): ?int | setSiteGatewaySettingId(?int siteGatewaySettingId): void | | `gatewayHandle` | `?string` | Optional | An identifier of connected gateway. | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | | `createdAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was last updated | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -## Example (as JSON) - -```json -{ - "id": 10088716, - "first_name": "Test", - "last_name": "Subscription", - "masked_card_number": "XXXX-XXXX-XXXX-1", - "card_type": "bogus", - "expiration_month": 1, - "expiration_year": 2022, - "customer_id": 14543792, - "current_vault": "bogus", - "vault_token": "1", - "billing_address": "123 Montana Way", - "billing_city": "Billings", - "billing_state": "MT", - "billing_zip": "59101", - "billing_country": "US", - "customer_vault_token": null, - "billing_address_2": "", - "payment_type": "credit_card", - "site_gateway_setting_id": 1, - "gateway_handle": null -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreditCardPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\CardType; +use AdvancedBillingLib\Models\CreditCardVault; + +$creditCardPaymentProfile = CreditCardPaymentProfileBuilder::init( + PaymentType::CREDIT_CARD +) + ->id(10088716) + ->firstName('Test') + ->lastName('Subscription') + ->maskedCardNumber('XXXX-XXXX-XXXX-1') + ->cardType(CardType::BOGUS) + ->expirationMonth(1) + ->expirationYear(2022) + ->customerId(14543792) + ->currentVault(CreditCardVault::BOGUS) + ->vaultToken('1') + ->billingAddress('123 Montana Way') + ->billingCity('Billings') + ->billingState('MT') + ->billingZip('59101') + ->billingCountry('US') + ->customerVaultToken('customer_vault_token2') + ->billingAddress2('') + ->siteGatewaySettingId(1) + ->gatewayHandle('gateway_handle8') + ->build(); ``` diff --git a/doc/models/credit-card-vault.md b/doc/models/credit-card-vault.md index 64f7914a..903daa13 100644 --- a/doc/models/credit-card-vault.md +++ b/doc/models/credit-card-vault.md @@ -45,3 +45,11 @@ The vault that stores the payment profile with the provided `vault_token`. Use ` | `UNIPAAS` | | `WIRECARD` | +## Example + +```php +use AdvancedBillingLib\Models\CreditCardVault; + +$creditCardVault = CreditCardVault::UNIPAAS; +``` + diff --git a/doc/models/credit-note-application.md b/doc/models/credit-note-application.md index 3c0cd29f..fb9fafef 100644 --- a/doc/models/credit-note-application.md +++ b/doc/models/credit-note-application.md @@ -15,15 +15,18 @@ | `memo` | `?string` | Optional | - | getMemo(): ?string | setMemo(?string memo): void | | `appliedAmount` | `?string` | Optional | - | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid0", - "transaction_time": "2016-03-13T12:52:32.123Z", - "invoice_uid": "invoice_uid0", - "memo": "memo4", - "applied_amount": "applied_amount8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreditNoteApplicationBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$creditNoteApplication = CreditNoteApplicationBuilder::init() + ->uid('uid0') + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->invoiceUid('invoice_uid0') + ->memo('memo4') + ->appliedAmount('applied_amount8') + ->build(); ``` diff --git a/doc/models/credit-note-line-item.md b/doc/models/credit-note-line-item.md index 765db63f..1dabb89a 100644 --- a/doc/models/credit-note-line-item.md +++ b/doc/models/credit-note-line-item.md @@ -13,7 +13,7 @@ | `title` | `?string` | Optional | A short descriptor for the credit given by this line. | getTitle(): ?string | setTitle(?string title): void | | `description` | `?string` | Optional | Detailed description for the credit given by this line. May include proration details in plain text.

Note: this string may contain line breaks that are hints for the best display format on the credit note. | getDescription(): ?string | setDescription(?string description): void | | `quantity` | `?string` | Optional | The quantity or count of units credited by the line item.

This is a decimal number represented as a string. (See "About Decimal Numbers".) | getQuantity(): ?string | setQuantity(?string quantity): void | -| `unitPrice` | `?string` | Optional | The price per unit for the line item.

When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. | getUnitPrice(): ?string | setUnitPrice(?string unitPrice): void | +| `unitPrice` | `?string` | Optional | The price per unit for the line item.

When tiered pricing was used (i.e., not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. | getUnitPrice(): ?string | setUnitPrice(?string unitPrice): void | | `subtotalAmount` | `?string` | Optional | The line subtotal, generally calculated as `quantity * unit_price`. This is the canonical amount of record for the line - when rounding differences are in play, `subtotal_amount` takes precedence over the value derived from `quantity * unit_price` (which may not have the proper precision to exactly equal this amount). | getSubtotalAmount(): ?string | setSubtotalAmount(?string subtotalAmount): void | | `discountAmount` | `?string` | Optional | The approximate discount of just this line.

The value is approximated in cases where rounding errors make it difficult to apportion exactly a total discount among many lines. Several lines may have been summed prior to applying the discount to arrive at `discount_amount` for the invoice - backing that out to the discount on a single line may introduce rounding or precision errors. | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | | `taxAmount` | `?string` | Optional | The approximate tax of just this line.

The value is approximated in cases where rounding errors make it difficult to apportion exactly a total tax among many lines. Several lines may have been summed prior to applying the tax rate to arrive at `tax_amount` for the invoice - backing that out to the tax on a single line may introduce rounding or precision errors. | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | @@ -30,15 +30,17 @@ | `customItem` | `?bool` | Optional | - | getCustomItem(): ?bool | setCustomItem(?bool customItem): void | | `prepaidAllocationExpiresAt` | `?DateTime` | Optional | The date a prepaid allocation is set to expire. Only present on line items representing prepaid component allocations. The format is `"YYYY-MM-DD"`. | getPrepaidAllocationExpiresAt(): ?\DateTime | setPrepaidAllocationExpiresAt(?\DateTime prepaidAllocationExpiresAt): void | -## Example (as JSON) +## Example -```json -{ - "uid": "uid4", - "title": "title0", - "description": "description6", - "quantity": "quantity0", - "unit_price": "unit_price2" -} +```php +use AdvancedBillingLib\Models\Builders\CreditNoteLineItemBuilder; + +$creditNoteLineItem = CreditNoteLineItemBuilder::init() + ->uid('uid0') + ->title('title6') + ->description('description0') + ->quantity('quantity6') + ->unitPrice('unit_price8') + ->build(); ``` diff --git a/doc/models/credit-note-status.md b/doc/models/credit-note-status.md index 1b4271a3..dfe385f7 100644 --- a/doc/models/credit-note-status.md +++ b/doc/models/credit-note-status.md @@ -14,3 +14,11 @@ Current status of the credit note. | `OPEN` | | `APPLIED` | +## Example + +```php +use AdvancedBillingLib\Models\CreditNoteStatus; + +$creditNoteStatus = CreditNoteStatus::OPEN; +``` + diff --git a/doc/models/credit-note.md b/doc/models/credit-note.md index b383ab92..44759f3f 100644 --- a/doc/models/credit-note.md +++ b/doc/models/credit-note.md @@ -21,13 +21,13 @@ | `currency` | `?string` | Optional | The ISO 4217 currency code (3 character string) representing the currency of the credit note amount fields. | getCurrency(): ?string | setCurrency(?string currency): void | | `memo` | `?string` | Optional | The memo printed on credit note, which is a description of the reason for the credit. | getMemo(): ?string | setMemo(?string memo): void | | `seller` | [`?InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the credit note. | getSeller(): ?InvoiceSeller | setSeller(?InvoiceSeller seller): void | -| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the credited subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | +| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient of the credited subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | | `billingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The billing address of the credit subscription. | getBillingAddress(): ?InvoiceAddress | setBillingAddress(?InvoiceAddress billingAddress): void | | `shippingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The shipping address of the credited subscription. | getShippingAddress(): ?InvoiceAddress | setShippingAddress(?InvoiceAddress shippingAddress): void | | `subtotalAmount` | `?string` | Optional | Subtotal of the credit note, which is the sum of all line items before discounts or taxes. Note that this is a positive amount representing the credit back to the customer. | getSubtotalAmount(): ?string | setSubtotalAmount(?string subtotalAmount): void | -| `discountAmount` | `?string` | Optional | Total discount applied to the credit note. Note that this is a positive amount representing the discount amount being credited back to the customer (i.e. a credit on an earlier discount). For example, if the original purchase was $1.00 and the original discount was $0.10, a credit of $0.50 of the original purchase (half) would have a discount credit of $0.05 (also half). | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | -| `taxAmount` | `?string` | Optional | Total tax of the credit note. Note that this is a positive amount representing a previously taxex amount being credited back to the customer (i.e. a credit of an earlier tax). For example, if the original purchase was $1.00 and the original tax was $0.10, a credit of $0.50 of the original purchase (half) would also have a tax credit of $0.05 (also half). | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | -| `totalAmount` | `?string` | Optional | The credit note total, which is `subtotal_amount - discount_amount + tax_amount`.' | getTotalAmount(): ?string | setTotalAmount(?string totalAmount): void | +| `discountAmount` | `?string` | Optional | Total discount applied to the credit note. Note that this is a positive amount representing the discount amount being credited back to the customer (i.e., a credit on an earlier discount). For example, if the original purchase was $1.00 and the original discount was $0.10, a credit of $0.50 of the original purchase (half) would have a discount credit of $0.05 (also half). | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | +| `taxAmount` | `?string` | Optional | Total tax of the credit note. Note that this is a positive amount representing a previously taxed amount being credited back to the customer (i.e., a credit of an earlier tax). For example, if the original purchase was $1.00 and the original tax was $0.10, a credit of $0.50 of the original purchase (half) would also have a tax credit of $0.05 (also half). | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | +| `totalAmount` | `?string` | Optional | The credit note total, which is `subtotal_amount - discount_amount + tax_amount`. | getTotalAmount(): ?string | setTotalAmount(?string totalAmount): void | | `appliedAmount` | `?string` | Optional | The amount of the credit note that has already been applied to invoices. | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | | `remainingAmount` | `?string` | Optional | The amount of the credit note remaining to be applied to invoices, which is `total_amount - applied_amount`. | getRemainingAmount(): ?string | setRemainingAmount(?string remainingAmount): void | | `lineItems` | [`?(CreditNoteLineItem[])`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the credit note. | getLineItems(): ?array | setLineItems(?array lineItems): void | @@ -35,17 +35,19 @@ | `taxes` | [`?(InvoiceTax[])`](../../doc/models/invoice-tax.md) | Optional | - | getTaxes(): ?array | setTaxes(?array taxes): void | | `applications` | [`?(CreditNoteApplication[])`](../../doc/models/credit-note-application.md) | Optional | - | getApplications(): ?array | setApplications(?array applications): void | | `refunds` | [`?(InvoiceRefund[])`](../../doc/models/invoice-refund.md) | Optional | - | getRefunds(): ?array | setRefunds(?array refunds): void | -| `originInvoices` | [`?(OriginInvoice[])`](../../doc/models/origin-invoice.md) | Optional | An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin-invoices) | getOriginInvoices(): ?array | setOriginInvoices(?array originInvoices): void | - -## Example (as JSON) - -```json -{ - "uid": "uid2", - "site_id": 218, - "customer_id": 74, - "subscription_id": 146, - "number": "number0" -} +| `originInvoices` | [`?(OriginInvoice[])`](../../doc/models/origin-invoice.md) | Optional | An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin-invoices). | getOriginInvoices(): ?array | setOriginInvoices(?array originInvoices): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; + +$creditNote = CreditNoteBuilder::init() + ->uid('uid6') + ->siteId(20) + ->customerId(132) + ->subscriptionId(204) + ->number('number4') + ->build(); ``` diff --git a/doc/models/credit-scheme-request.md b/doc/models/credit-scheme-request.md index 58f72a49..d1c93128 100644 --- a/doc/models/credit-scheme-request.md +++ b/doc/models/credit-scheme-request.md @@ -11,11 +11,14 @@ | --- | --- | --- | --- | --- | --- | | `creditScheme` | [`string(CreditScheme)`](../../doc/models/credit-scheme.md) | Required | - | getCreditScheme(): string | setCreditScheme(string creditScheme): void | -## Example (as JSON) +## Example -```json -{ - "credit_scheme": "credit" -} +```php +use AdvancedBillingLib\Models\Builders\CreditSchemeRequestBuilder; +use AdvancedBillingLib\Models\CreditScheme; + +$creditSchemeRequest = CreditSchemeRequestBuilder::init( + CreditScheme::CREDIT +)->build(); ``` diff --git a/doc/models/credit-scheme.md b/doc/models/credit-scheme.md index fdf3956d..436984e0 100644 --- a/doc/models/credit-scheme.md +++ b/doc/models/credit-scheme.md @@ -13,3 +13,11 @@ | `CREDIT` | | `REFUND` | +## Example + +```php +use AdvancedBillingLib\Models\CreditScheme; + +$creditScheme = CreditScheme::NONE; +``` + diff --git a/doc/models/credit-type.md b/doc/models/credit-type.md index f7d2a090..2bbf0cad 100644 --- a/doc/models/credit-type.md +++ b/doc/models/credit-type.md @@ -15,3 +15,11 @@ The type of credit to be created when upgrading/downgrading. Defaults to the com | `PRORATED` | | `NONE` | +## Example + +```php +use AdvancedBillingLib\Models\CreditType; + +$creditType = CreditType::PRORATED; +``` + diff --git a/doc/models/currency-overage-prices.md b/doc/models/currency-overage-prices.md index 57956875..44b9de69 100644 --- a/doc/models/currency-overage-prices.md +++ b/doc/models/currency-overage-prices.md @@ -13,7 +13,7 @@ Extends a component price point with currency overage prices. | --- | --- | --- | --- | --- | --- | | `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 | +| `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 | @@ -25,7 +25,7 @@ Extends a component price point with currency overage prices. | `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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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 | @@ -36,15 +36,19 @@ Extends a component price point with currency overage prices. | `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) +## Example -```json -{ - "id": 50, - "type": "catalog", - "default": false, - "name": "name8", - "pricing_scheme": "stairstep" -} +```php +use AdvancedBillingLib\Models\Builders\CurrencyOveragePricesBuilder; +use AdvancedBillingLib\Models\PricePointType; +use AdvancedBillingLib\Models\PricingScheme; + +$currencyOveragePrices = CurrencyOveragePricesBuilder::init() + ->id(96) + ->type(PricePointType::CATALOG) + ->default(false) + ->name('name0') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build(); ``` diff --git a/doc/models/currency-price-role.md b/doc/models/currency-price-role.md index 32d78475..2fb3ec2c 100644 --- a/doc/models/currency-price-role.md +++ b/doc/models/currency-price-role.md @@ -15,3 +15,11 @@ Role for the price. | `TRIAL` | | `INITIAL` | +## Example + +```php +use AdvancedBillingLib\Models\CurrencyPriceRole; + +$currencyPriceRole = CurrencyPriceRole::INITIAL; +``` + diff --git a/doc/models/currency-price.md b/doc/models/currency-price.md index 37b79203..79748ca8 100644 --- a/doc/models/currency-price.md +++ b/doc/models/currency-price.md @@ -18,15 +18,17 @@ | `productPricePointId` | `?int` | Optional | - | getProductPricePointId(): ?int | setProductPricePointId(?int productPricePointId): void | | `role` | [`?string(CurrencyPriceRole)`](../../doc/models/currency-price-role.md) | Optional | Role for the price. | getRole(): ?string | setRole(?string role): void | -## Example (as JSON) - -```json -{ - "id": 88, - "currency": "currency6", - "price": 41.36, - "formatted_price": "formatted_price4", - "price_id": 178 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CurrencyPriceBuilder; + +$currencyPrice = CurrencyPriceBuilder::init() + ->id(208) + ->currency('currency4') + ->price(70.88) + ->formattedPrice('formatted_price2') + ->priceId(214) + ->build(); ``` diff --git a/doc/models/currency-prices-response.md b/doc/models/currency-prices-response.md index ddb51428..3f206be9 100644 --- a/doc/models/currency-prices-response.md +++ b/doc/models/currency-prices-response.md @@ -11,19 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`CurrencyPrice[]`](../../doc/models/currency-price.md) | Required | - | getCurrencyPrices(): array | setCurrencyPrices(array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "id": 50, - "currency": "currency8", - "price": 233.74, - "formatted_price": "formatted_price6", - "price_id": 116 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CurrencyPricesResponseBuilder; +use AdvancedBillingLib\Models\Builders\CurrencyPriceBuilder; + +$currencyPricesResponse = CurrencyPricesResponseBuilder::init( + [ + CurrencyPriceBuilder::init() + ->id(50) + ->currency('currency8') + ->price(233.74) + ->formattedPrice('formatted_price6') + ->priceId(116) + ->build() + ] +)->build(); ``` diff --git a/doc/models/custom-field-owner.md b/doc/models/custom-field-owner.md index 77c2f821..5e407a97 100644 --- a/doc/models/custom-field-owner.md +++ b/doc/models/custom-field-owner.md @@ -12,3 +12,11 @@ | `CUSTOMER` | | `SUBSCRIPTION` | +## Example + +```php +use AdvancedBillingLib\Models\CustomFieldOwner; + +$customFieldOwner = CustomFieldOwner::CUSTOMER; +``` + diff --git a/doc/models/custom-field-value-change.md b/doc/models/custom-field-value-change.md index 5790e7da..88c5f830 100644 --- a/doc/models/custom-field-value-change.md +++ b/doc/models/custom-field-value-change.md @@ -17,17 +17,20 @@ | `resourceType` | `string` | Required | - | getResourceType(): string | setResourceType(string resourceType): void | | `resourceId` | `int` | Required | - | getResourceId(): int | setResourceId(int resourceId): void | -## Example (as JSON) - -```json -{ - "event_type": "event_type2", - "metafield_name": "metafield_name6", - "metafield_id": 78, - "old_value": "old_value2", - "new_value": "new_value8", - "resource_type": "resource_type2", - "resource_id": 74 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CustomFieldValueChangeBuilder; + +$customFieldValueChange = CustomFieldValueChangeBuilder::init( + 'event_type8', + 'metafield_name2', + 138, + 'resource_type6', + 14 +) + ->oldValue('old_value6') + ->newValue('new_value2') + ->build(); ``` diff --git a/doc/models/customer-attributes.md b/doc/models/customer-attributes.md index e54fd228..72fd45ba 100644 --- a/doc/models/customer-attributes.md +++ b/doc/models/customer-attributes.md @@ -12,37 +12,42 @@ | `firstName` | `?string` | Optional | The first name of the customer. Required when creating a customer via attributes. | getFirstName(): ?string | setFirstName(?string firstName): void | | `lastName` | `?string` | Optional | The last name of the customer. Required when creating a customer via attributes. | getLastName(): ?string | setLastName(?string lastName): void | | `email` | `?string` | Optional | The email address of the customer. Required when creating a customer via attributes. | getEmail(): ?string | setEmail(?string email): void | -| `ccEmails` | `?string` | Optional | A list of emails that should be cc’d on all customer communications. Optional. | getCcEmails(): ?string | setCcEmails(?string ccEmails): void | -| `organization` | `?string` | Optional | The organization/company of the customer. Optional. | getOrganization(): ?string | setOrganization(?string organization): void | -| `reference` | `?string` | Optional | A customer “reference”, or unique identifier from your app, stored in Chargify. Can be used so that you may reference your customer’s within Chargify using the same unique value you use in your application. Optional. | getReference(): ?string | setReference(?string reference): void | -| `address` | `?string` | Optional | (Optional) The customer’s shipping street address (i.e. “123 Main St.”). | getAddress(): ?string | setAddress(?string address): void | -| `address2` | `?string` | Optional | (Optional) Second line of the customer’s shipping address i.e. “Apt. 100” | getAddress2(): ?string | setAddress2(?string address2): void | -| `city` | `?string` | Optional | (Optional) The customer’s shipping address city (i.e. “Boston”). | getCity(): ?string | setCity(?string city): void | -| `state` | `?string` | Optional | (Optional) The customer’s shipping address state (i.e. “MA”). This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getState(): ?string | setState(?string state): void | -| `zip` | `?string` | Optional | (Optional) The customer’s shipping address zip code (i.e. “12345”). | getZip(): ?string | setZip(?string zip): void | -| `country` | `?string` | Optional | (Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). | getCountry(): ?string | setCountry(?string country): void | +| `ccEmails` | `?string` | Optional | (Optional) A list of emails that should be cc’d on all customer communications. | getCcEmails(): ?string | setCcEmails(?string ccEmails): void | +| `organization` | `?string` | Optional | (Optional) The organization/company of the customer. | getOrganization(): ?string | setOrganization(?string organization): void | +| `reference` | `?string` | Optional | (Optional) A customer “reference”, or unique identifier from your app, stored in Chargify. Can be used so that you may reference your customer’s within Chargify using the same unique value you use in your application. | getReference(): ?string | setReference(?string reference): void | +| `address` | `?string` | Optional | (Optional) The customer’s shipping street address (e.g., “123 Main St.”). | getAddress(): ?string | setAddress(?string address): void | +| `address2` | `?string` | Optional | (Optional) Second line of the customer’s shipping address e.g., “Apt. 100” | getAddress2(): ?string | setAddress2(?string address2): void | +| `city` | `?string` | Optional | (Optional) The customer’s shipping address city (e.g., “Boston”). | getCity(): ?string | setCity(?string city): void | +| `state` | `?string` | Optional | “(Optional) The customer’s shipping address state (e.g., “MA”). This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes.” | getState(): ?string | setState(?string state): void | +| `zip` | `?string` | Optional | (Optional) The customer’s shipping address zip code (e.g., “12345”). | getZip(): ?string | setZip(?string zip): void | +| `country` | `?string` | Optional | “(Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”).” | getCountry(): ?string | setCountry(?string country): void | | `phone` | `?string` | Optional | (Optional) The phone number of the customer. | getPhone(): ?string | setPhone(?string phone): void | | `verified` | `?bool` | Optional | - | getVerified(): ?bool | setVerified(?bool verified): void | | `taxExempt` | `?bool` | Optional | (Optional) The tax_exempt status of the customer. Acceptable values are true or 1 for true and false or 0 for false. | getTaxExempt(): ?bool | setTaxExempt(?bool taxExempt): void | -| `vatNumber` | `?string` | Optional | (Optional) Supplying the VAT number allows EU customer’s to opt-out of the Value Added Tax assuming the merchant address and customer billing address are not within the same EU country. It’s important to omit the country code from the VAT number upon entry. Otherwise, taxes will be assessed upon the purchase. | getVatNumber(): ?string | setVatNumber(?string vatNumber): void | +| `surcharging` | `?bool` | Optional | (Optional) Whether surcharging is enabled for the customer. Defaults to `true` when omitted. Only applied on sites where surcharging control is enabled. | getSurcharging(): ?bool | setSurcharging(?bool surcharging): void | +| `vatNumber` | `?string` | Optional | (Optional) Supplying the VAT number allows EU customers to opt-out of the Value Added Tax assuming the merchant address and customer billing address are not within the same EU country. It’s important to omit the country code from the VAT number upon entry. Otherwise, taxes will be assessed upon the purchase. | getVatNumber(): ?string | setVatNumber(?string vatNumber): 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 | | `parentId` | `?int` | Optional | The parent ID in Chargify if applicable. Parent is another Customer object. | getParentId(): ?int | setParentId(?int parentId): void | | `salesforceId` | `?string` | Optional | (Optional) The Salesforce ID of the customer. | getSalesforceId(): ?string | setSalesforceId(?string salesforceId): void | | `defaultAutoRenewalProfileId` | `?int` | Optional | (Optional) The default auto-renewal profile ID for the customer | getDefaultAutoRenewalProfileId(): ?int | setDefaultAutoRenewalProfileId(?int defaultAutoRenewalProfileId): void | -## Example (as JSON) - -```json -{ - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "first_name": "first_name4", - "last_name": "last_name2", - "email": "email2", - "cc_emails": "cc_emails6", - "organization": "organization8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CustomerAttributesBuilder; + +$customerAttributes = CustomerAttributesBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails2') + ->organization('organization6') + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->build(); ``` diff --git a/doc/models/customer-change.md b/doc/models/customer-change.md index 48ea4f92..44eca09d 100644 --- a/doc/models/customer-change.md +++ b/doc/models/customer-change.md @@ -14,97 +14,113 @@ | `billingAddress` | [`?AddressChange`](../../doc/models/address-change.md) | Optional | - | getBillingAddress(): ?AddressChange | setBillingAddress(?AddressChange billingAddress): void | | `customFields` | [`?CustomerCustomFieldsChange`](../../doc/models/customer-custom-fields-change.md) | Optional | - | getCustomFields(): ?CustomerCustomFieldsChange | setCustomFields(?CustomerCustomFieldsChange customFields): void | -## Example (as JSON) +## Example -```json -{ - "payer": { - "before": { - "first_name": "first_name0", - "last_name": "last_name8", - "organization": "organization4", - "email": "email6" - }, - "after": { - "first_name": "first_name2", - "last_name": "last_name0", - "organization": "organization4", - "email": "email4" - } - }, - "shipping_address": { - "before": { - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state6", - "zip": "zip4" - }, - "after": { - "street": "street2", - "line2": "line26", - "city": "city8", - "state": "state2", - "zip": "zip4" - } - }, - "billing_address": { - "before": { - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state6", - "zip": "zip4" - }, - "after": { - "street": "street2", - "line2": "line26", - "city": "city8", - "state": "state2", - "zip": "zip4" - } - }, - "custom_fields": { - "before": [ - { - "owner_id": 26, - "owner_type": "Customer", - "name": "name0", - "value": "value2", - "metadatum_id": 26 - }, - { - "owner_id": 26, - "owner_type": "Customer", - "name": "name0", - "value": "value2", - "metadatum_id": 26 - } - ], - "after": [ - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - }, - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - }, - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - } - ] - } -} +```php +use AdvancedBillingLib\Models\Builders\CustomerChangeBuilder; +use AdvancedBillingLib\Models\Builders\CustomerPayerChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoicePayerChangeBuilder; +use AdvancedBillingLib\Models\Builders\AddressChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceAddressBuilder; +use AdvancedBillingLib\Models\Builders\CustomerCustomFieldsChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceCustomFieldBuilder; +use AdvancedBillingLib\Models\CustomFieldOwner; + +$customerChange = CustomerChangeBuilder::init() + ->payer( + CustomerPayerChangeBuilder::init( + InvoicePayerChangeBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->organization('organization4') + ->email('email6') + ->build(), + InvoicePayerChangeBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->organization('organization4') + ->email('email4') + ->build() + )->build() + ) + ->shippingAddress( + AddressChangeBuilder::init( + InvoiceAddressBuilder::init() + ->street('street0') + ->line2('line24') + ->city('city0') + ->state('state6') + ->zip('zip4') + ->build(), + InvoiceAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city8') + ->state('state2') + ->zip('zip4') + ->build() + )->build() + ) + ->billingAddress( + AddressChangeBuilder::init( + InvoiceAddressBuilder::init() + ->street('street0') + ->line2('line24') + ->city('city0') + ->state('state6') + ->zip('zip4') + ->build(), + InvoiceAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city8') + ->state('state2') + ->zip('zip4') + ->build() + )->build() + ) + ->customFields( + CustomerCustomFieldsChangeBuilder::init( + [ + InvoiceCustomFieldBuilder::init() + ->ownerId(26) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name0') + ->value('value2') + ->metadatumId(26) + ->build(), + InvoiceCustomFieldBuilder::init() + ->ownerId(26) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name0') + ->value('value2') + ->metadatumId(26) + ->build() + ], + [ + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build(), + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build(), + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build() + ] + )->build() + )->build(); ``` diff --git a/doc/models/customer-changes-preview-response.md b/doc/models/customer-changes-preview-response.md index 7cd677f9..e30c84f5 100644 --- a/doc/models/customer-changes-preview-response.md +++ b/doc/models/customer-changes-preview-response.md @@ -11,99 +11,116 @@ | --- | --- | --- | --- | --- | --- | | `changes` | [`CustomerChange`](../../doc/models/customer-change.md) | Required | - | getChanges(): CustomerChange | setChanges(CustomerChange changes): void | -## Example (as JSON) +## Example -```json -{ - "changes": { - "payer": { - "before": { - "first_name": "first_name0", - "last_name": "last_name8", - "organization": "organization4", - "email": "email6" - }, - "after": { - "first_name": "first_name2", - "last_name": "last_name0", - "organization": "organization4", - "email": "email4" - } - }, - "shipping_address": { - "before": { - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state6", - "zip": "zip4" - }, - "after": { - "street": "street2", - "line2": "line26", - "city": "city8", - "state": "state2", - "zip": "zip4" - } - }, - "billing_address": { - "before": { - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state6", - "zip": "zip4" - }, - "after": { - "street": "street2", - "line2": "line26", - "city": "city8", - "state": "state2", - "zip": "zip4" - } - }, - "custom_fields": { - "before": [ - { - "owner_id": 26, - "owner_type": "Customer", - "name": "name0", - "value": "value2", - "metadatum_id": 26 - }, - { - "owner_id": 26, - "owner_type": "Customer", - "name": "name0", - "value": "value2", - "metadatum_id": 26 - } - ], - "after": [ - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - }, - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - }, - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - } - ] - } - } -} +```php +use AdvancedBillingLib\Models\Builders\CustomerChangesPreviewResponseBuilder; +use AdvancedBillingLib\Models\Builders\CustomerChangeBuilder; +use AdvancedBillingLib\Models\Builders\CustomerPayerChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoicePayerChangeBuilder; +use AdvancedBillingLib\Models\Builders\AddressChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceAddressBuilder; +use AdvancedBillingLib\Models\Builders\CustomerCustomFieldsChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceCustomFieldBuilder; +use AdvancedBillingLib\Models\CustomFieldOwner; + +$customerChangesPreviewResponse = CustomerChangesPreviewResponseBuilder::init( + CustomerChangeBuilder::init() + ->payer( + CustomerPayerChangeBuilder::init( + InvoicePayerChangeBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->organization('organization4') + ->email('email6') + ->build(), + InvoicePayerChangeBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->organization('organization4') + ->email('email4') + ->build() + )->build() + ) + ->shippingAddress( + AddressChangeBuilder::init( + InvoiceAddressBuilder::init() + ->street('street0') + ->line2('line24') + ->city('city0') + ->state('state6') + ->zip('zip4') + ->build(), + InvoiceAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city8') + ->state('state2') + ->zip('zip4') + ->build() + )->build() + ) + ->billingAddress( + AddressChangeBuilder::init( + InvoiceAddressBuilder::init() + ->street('street0') + ->line2('line24') + ->city('city0') + ->state('state6') + ->zip('zip4') + ->build(), + InvoiceAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city8') + ->state('state2') + ->zip('zip4') + ->build() + )->build() + ) + ->customFields( + CustomerCustomFieldsChangeBuilder::init( + [ + InvoiceCustomFieldBuilder::init() + ->ownerId(26) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name0') + ->value('value2') + ->metadatumId(26) + ->build(), + InvoiceCustomFieldBuilder::init() + ->ownerId(26) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name0') + ->value('value2') + ->metadatumId(26) + ->build() + ], + [ + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build(), + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build(), + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build() + ] + )->build() + )->build() +)->build(); ``` diff --git a/doc/models/customer-custom-fields-change.md b/doc/models/customer-custom-fields-change.md index 50191700..8aad7224 100644 --- a/doc/models/customer-custom-fields-change.md +++ b/doc/models/customer-custom-fields-change.md @@ -12,28 +12,32 @@ | `before` | [`InvoiceCustomField[]`](../../doc/models/invoice-custom-field.md) | Required | - | getBefore(): array | setBefore(array before): void | | `after` | [`InvoiceCustomField[]`](../../doc/models/invoice-custom-field.md) | Required | - | getAfter(): array | setAfter(array after): void | -## Example (as JSON) - -```json -{ - "before": [ - { - "owner_id": 26, - "owner_type": "Customer", - "name": "name0", - "value": "value2", - "metadatum_id": 26 - } - ], - "after": [ - { - "owner_id": 130, - "owner_type": "Customer", - "name": "name2", - "value": "value4", - "metadatum_id": 130 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CustomerCustomFieldsChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceCustomFieldBuilder; +use AdvancedBillingLib\Models\CustomFieldOwner; + +$customerCustomFieldsChange = CustomerCustomFieldsChangeBuilder::init( + [ + InvoiceCustomFieldBuilder::init() + ->ownerId(26) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name0') + ->value('value2') + ->metadatumId(26) + ->build() + ], + [ + InvoiceCustomFieldBuilder::init() + ->ownerId(130) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name2') + ->value('value4') + ->metadatumId(130) + ->build() + ] +)->build(); ``` diff --git a/doc/models/customer-error-response-exception.md b/doc/models/customer-error-response-exception.md index 68cc0d1b..54f56f48 100644 --- a/doc/models/customer-error-response-exception.md +++ b/doc/models/customer-error-response-exception.md @@ -11,13 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [CustomerError](../../doc/models/customer-error.md)\|string[]\|null | Optional | This is a container for one-of cases. | getErrors(): | setErrors( errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "customer": "customer8" - } +## Example + +```php +try { + // make the API call +} catch (CustomerErrorResponseException $exp) { + echo 'Caught CustomerErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/customer-error.md b/doc/models/customer-error.md index aa297632..d9baf9db 100644 --- a/doc/models/customer-error.md +++ b/doc/models/customer-error.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `customer` | `?string` | Optional | - | getCustomer(): ?string | setCustomer(?string customer): void | -## Example (as JSON) +## Example -```json -{ - "customer": "customer8" -} +```php +use AdvancedBillingLib\Models\Builders\CustomerErrorBuilder; + +$customerError = CustomerErrorBuilder::init() + ->customer('customer8') + ->build(); ``` diff --git a/doc/models/customer-payer-change.md b/doc/models/customer-payer-change.md index 16e99ec9..a6035740 100644 --- a/doc/models/customer-payer-change.md +++ b/doc/models/customer-payer-change.md @@ -12,22 +12,25 @@ | `before` | [`InvoicePayerChange`](../../doc/models/invoice-payer-change.md) | Required | - | getBefore(): InvoicePayerChange | setBefore(InvoicePayerChange before): void | | `after` | [`InvoicePayerChange`](../../doc/models/invoice-payer-change.md) | Required | - | getAfter(): InvoicePayerChange | setAfter(InvoicePayerChange after): void | -## Example (as JSON) - -```json -{ - "before": { - "first_name": "first_name0", - "last_name": "last_name8", - "organization": "organization4", - "email": "email6" - }, - "after": { - "first_name": "first_name2", - "last_name": "last_name0", - "organization": "organization4", - "email": "email4" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CustomerPayerChangeBuilder; +use AdvancedBillingLib\Models\Builders\InvoicePayerChangeBuilder; + +$customerPayerChange = CustomerPayerChangeBuilder::init( + InvoicePayerChangeBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->organization('organization4') + ->email('email6') + ->build(), + InvoicePayerChangeBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->organization('organization4') + ->email('email4') + ->build() +)->build(); ``` diff --git a/doc/models/customer-response.md b/doc/models/customer-response.md index 2f6e2d11..5c3eb73c 100644 --- a/doc/models/customer-response.md +++ b/doc/models/customer-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `customer` | [`Customer`](../../doc/models/customer.md) | Required | - | getCustomer(): Customer | setCustomer(Customer customer): void | -## Example (as JSON) - -```json -{ - "customer": { - "first_name": "first_name0", - "last_name": "last_name8", - "email": "email6", - "cc_emails": "cc_emails0", - "organization": "organization6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\CustomerResponseBuilder; +use AdvancedBillingLib\Models\Builders\CustomerBuilder; + +$customerResponse = CustomerResponseBuilder::init( + CustomerBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->email('email6') + ->ccEmails('cc_emails0') + ->organization('organization6') + ->build() +)->build(); ``` diff --git a/doc/models/customer.md b/doc/models/customer.md index 6ffdda97..2875e8cd 100644 --- a/doc/models/customer.md +++ b/doc/models/customer.md @@ -12,18 +12,18 @@ | `firstName` | `?string` | Optional | The first name of the customer | getFirstName(): ?string | setFirstName(?string firstName): void | | `lastName` | `?string` | Optional | The last name of the customer | getLastName(): ?string | setLastName(?string lastName): void | | `email` | `?string` | Optional | The email address of the customer | getEmail(): ?string | setEmail(?string email): void | -| `ccEmails` | `?string` | Optional | A comma-separated list of emails that should be cc’d on all customer communications (i.e. “joe@example.com, sue@example.com”) | getCcEmails(): ?string | setCcEmails(?string ccEmails): void | +| `ccEmails` | `?string` | Optional | “A comma-separated list of emails that should be cc’d on all customer communications (e.g., “joe@example.com, sue@example.com”)” | getCcEmails(): ?string | setCcEmails(?string ccEmails): void | | `organization` | `?string` | Optional | The organization of the customer. If no value, `null` or empty string is provided, `organization` will be populated with the customer's first and last name, separated with a space. | getOrganization(): ?string | setOrganization(?string organization): void | | `reference` | `?string` | Optional | The unique identifier used within your own application for this customer | getReference(): ?string | setReference(?string reference): void | | `id` | `?int` | Optional | The customer ID in Chargify | getId(): ?int | setId(?int id): void | | `createdAt` | `?DateTime` | Optional | The timestamp in which the customer object was created in Chargify | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | The timestamp in which the customer object was last edited | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -| `address` | `?string` | Optional | The customer’s shipping street address (i.e. “123 Main St.”) | getAddress(): ?string | setAddress(?string address): void | -| `address2` | `?string` | Optional | Second line of the customer’s shipping address i.e. “Apt. 100” | getAddress2(): ?string | setAddress2(?string address2): void | -| `city` | `?string` | Optional | The customer’s shipping address city (i.e. “Boston”) | getCity(): ?string | setCity(?string city): void | -| `state` | `?string` | Optional | The customer’s shipping address state (i.e. “MA”) | getState(): ?string | setState(?string state): void | +| `address` | `?string` | Optional | The customer’s shipping street address (e.g., “123 Main St.”) | getAddress(): ?string | setAddress(?string address): void | +| `address2` | `?string` | Optional | Second line of the customer’s shipping address e.g., “Apt. 100” | getAddress2(): ?string | setAddress2(?string address2): void | +| `city` | `?string` | Optional | The customer’s shipping address city (e.g., “Boston”) | getCity(): ?string | setCity(?string city): void | +| `state` | `?string` | Optional | The customer’s shipping address state (e.g., “MA”) | getState(): ?string | setState(?string state): void | | `stateName` | `?string` | Optional | The customer's full name of state | getStateName(): ?string | setStateName(?string stateName): void | -| `zip` | `?string` | Optional | The customer’s shipping address zip code (i.e. “12345”) | getZip(): ?string | setZip(?string zip): void | +| `zip` | `?string` | Optional | The customer’s shipping address zip code (e.g., “12345”) | getZip(): ?string | setZip(?string zip): void | | `country` | `?string` | Optional | The customer shipping address country | getCountry(): ?string | setCountry(?string country): void | | `countryName` | `?string` | Optional | The customer's full name of country | getCountryName(): ?string | setCountryName(?string countryName): void | | `phone` | `?string` | Optional | The phone number of the customer | getPhone(): ?string | setPhone(?string phone): void | @@ -32,6 +32,7 @@ | `portalInviteLastSentAt` | `?DateTime` | Optional | The timestamp of when the Billing Portal invite was last sent at | getPortalInviteLastSentAt(): ?\DateTime | setPortalInviteLastSentAt(?\DateTime portalInviteLastSentAt): void | | `portalInviteLastAcceptedAt` | `?DateTime` | Optional | The timestamp of when the Billing Portal invite was last accepted | getPortalInviteLastAcceptedAt(): ?\DateTime | setPortalInviteLastAcceptedAt(?\DateTime portalInviteLastAcceptedAt): void | | `taxExempt` | `?bool` | Optional | The tax exempt status for the customer. Acceptable values are true or 1 for true and false or 0 for false. | getTaxExempt(): ?bool | setTaxExempt(?bool taxExempt): void | +| `surcharging` | `?bool` | Optional | Whether surcharging is enabled for the customer. Only included on sites where surcharging control is enabled. | getSurcharging(): ?bool | setSurcharging(?bool surcharging): void | | `vatNumber` | `?string` | Optional | The VAT business identification number for the customer. This number is used to determine VAT tax opt out rules. It is not validated when added or updated on a customer record. Instead, it is validated via VIES before calculating taxes. Only valid business identification numbers will allow for VAT opt out. | getVatNumber(): ?string | setVatNumber(?string vatNumber): void | | `parentId` | `?int` | Optional | The parent ID in Chargify if applicable. Parent is another Customer object. | getParentId(): ?int | setParentId(?int parentId): void | | `locale` | `?string` | Optional | The locale for the customer to identify language-region | getLocale(): ?string | setLocale(?string locale): void | @@ -40,16 +41,19 @@ | `taxExemptReason` | `?string` | Optional | The Tax Exemption Reason Code for the customer | getTaxExemptReason(): ?string | setTaxExemptReason(?string taxExemptReason): void | | `defaultAutoRenewalProfileId` | `?int` | Optional | The default auto-renewal profile ID for the customer | getDefaultAutoRenewalProfileId(): ?int | setDefaultAutoRenewalProfileId(?int defaultAutoRenewalProfileId): void | | `maxioid` | `?string` | Optional | The Maxio-generated unique identifier for the customer. | getMaxioid(): ?string | setMaxioid(?string maxioid): void | +| `brandingThemeId` | `?int` | Optional | The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. This customer-level Branding Theme is used when a subscription does not have its own subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. | getBrandingThemeId(): ?int | setBrandingThemeId(?int brandingThemeId): void | -## Example (as JSON) +## Example -```json -{ - "first_name": "first_name8", - "last_name": "last_name6", - "email": "email8", - "cc_emails": "cc_emails2", - "organization": "organization8" -} +```php +use AdvancedBillingLib\Models\Builders\CustomerBuilder; + +$customer = CustomerBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->email('email6') + ->ccEmails('cc_emails0') + ->organization('organization6') + ->build(); ``` diff --git a/doc/models/debit-note-role.md b/doc/models/debit-note-role.md index 9c261a9f..2c86ef79 100644 --- a/doc/models/debit-note-role.md +++ b/doc/models/debit-note-role.md @@ -14,3 +14,11 @@ The role of the debit note. | `CHARGEBACK` | | `REFUND` | +## Example + +```php +use AdvancedBillingLib\Models\DebitNoteRole; + +$debitNoteRole = DebitNoteRole::CHARGEBACK; +``` + diff --git a/doc/models/debit-note-status.md b/doc/models/debit-note-status.md index 48eb3cb1..3de596c3 100644 --- a/doc/models/debit-note-status.md +++ b/doc/models/debit-note-status.md @@ -16,3 +16,11 @@ Current status of the debit note. | `BANISHED` | | `PAID` | +## Example + +```php +use AdvancedBillingLib\Models\DebitNoteStatus; + +$debitNoteStatus = DebitNoteStatus::OPEN; +``` + diff --git a/doc/models/debit-note.md b/doc/models/debit-note.md index 87cf5e5c..f46ebb34 100644 --- a/doc/models/debit-note.md +++ b/doc/models/debit-note.md @@ -13,10 +13,10 @@ | `siteId` | `?int` | Optional | ID of the site to which the debit note belongs. | getSiteId(): ?int | setSiteId(?int siteId): void | | `customerId` | `?int` | Optional | ID of the customer to which the debit note belongs. | getCustomerId(): ?int | setCustomerId(?int customerId): void | | `subscriptionId` | `?int` | Optional | ID of the subscription that generated the debit note. | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | -| `number` | `?int` | Optional | A unique, identifier that appears on the debit note and in places it is referenced. | getNumber(): ?int | setNumber(?int number): void | +| `number` | `?int` | Optional | A unique identifier that appears on the debit note and in places it is referenced. | getNumber(): ?int | setNumber(?int number): void | | `sequenceNumber` | `?int` | Optional | A monotonically increasing number assigned to debit notes as they are created. | getSequenceNumber(): ?int | setSequenceNumber(?int sequenceNumber): void | | `originCreditNoteUid` | `?string` | Optional | Unique identifier for the connected credit note. It is generated automatically by Chargify and has the prefix "cn_" followed by alphanumeric characters.

While the UID is long and not appropriate to show to customers, the number is usually shorter and consumable by the customer and the merchant alike. | getOriginCreditNoteUid(): ?string | setOriginCreditNoteUid(?string originCreditNoteUid): void | -| `originCreditNoteNumber` | `?string` | Optional | A unique, identifying string of the connected credit note. | getOriginCreditNoteNumber(): ?string | setOriginCreditNoteNumber(?string originCreditNoteNumber): void | +| `originCreditNoteNumber` | `?string` | Optional | A unique identifying string of the connected credit note. | getOriginCreditNoteNumber(): ?string | setOriginCreditNoteNumber(?string originCreditNoteNumber): void | | `issueDate` | `?DateTime` | Optional | Date the document was issued to the customer. This is the date that the document was made available for payment.

The format is "YYYY-MM-DD". | getIssueDate(): ?\DateTime | setIssueDate(?\DateTime issueDate): void | | `appliedDate` | `?DateTime` | Optional | Debit notes are applied to invoices to offset invoiced amounts - they adjust the amount due. This field is the date the debit note document became fully applied to the invoice.

The format is "YYYY-MM-DD". | getAppliedDate(): ?\DateTime | setAppliedDate(?\DateTime appliedDate): void | | `dueDate` | `?DateTime` | Optional | Date the document is due for payment. The format is "YYYY-MM-DD". | getDueDate(): ?\DateTime | setDueDate(?\DateTime dueDate): void | @@ -25,7 +25,7 @@ | `role` | [`?string(DebitNoteRole)`](../../doc/models/debit-note-role.md) | Optional | The role of the debit note. | getRole(): ?string | setRole(?string role): void | | `currency` | `?string` | Optional | The ISO 4217 currency code (3 character string) representing the currency of the credit note amount fields. | getCurrency(): ?string | setCurrency(?string currency): void | | `seller` | [`?InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the debit note. | getSeller(): ?InvoiceSeller | setSeller(?InvoiceSeller seller): void | -| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the debited subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | +| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is the owner or recipient of the debited subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | | `billingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The billing address of the debited subscription. | getBillingAddress(): ?InvoiceAddress | setBillingAddress(?InvoiceAddress billingAddress): void | | `shippingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The shipping address of the debited subscription. | getShippingAddress(): ?InvoiceAddress | setShippingAddress(?InvoiceAddress shippingAddress): void | | `lineItems` | [`?(CreditNoteLineItem[])`](../../doc/models/credit-note-line-item.md) | Optional | Line items on the debit note. | getLineItems(): ?array | setLineItems(?array lineItems): void | @@ -33,15 +33,17 @@ | `taxes` | [`?(InvoiceTax[])`](../../doc/models/invoice-tax.md) | Optional | - | getTaxes(): ?array | setTaxes(?array taxes): void | | `refunds` | [`?(InvoiceRefund[])`](../../doc/models/invoice-refund.md) | Optional | - | getRefunds(): ?array | setRefunds(?array refunds): void | -## Example (as JSON) +## Example -```json -{ - "uid": "uid2", - "site_id": 112, - "customer_id": 224, - "subscription_id": 40, - "number": 172 -} +```php +use AdvancedBillingLib\Models\Builders\DebitNoteBuilder; + +$debitNote = DebitNoteBuilder::init() + ->uid('uid2') + ->siteId(196) + ->customerId(52) + ->subscriptionId(124) + ->number(0) + ->build(); ``` diff --git a/doc/models/deduct-service-credit-request.md b/doc/models/deduct-service-credit-request.md index caf47c95..16dc5d6d 100644 --- a/doc/models/deduct-service-credit-request.md +++ b/doc/models/deduct-service-credit-request.md @@ -11,14 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `deduction` | [`DeductServiceCredit`](../../doc/models/deduct-service-credit.md) | Required | - | getDeduction(): DeductServiceCredit | setDeduction(DeductServiceCredit deduction): void | -## Example (as JSON) - -```json -{ - "deduction": { - "amount": "String9", - "memo": "memo0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\DeductServiceCreditRequestBuilder; +use AdvancedBillingLib\Models\Builders\DeductServiceCreditBuilder; + +$deductServiceCreditRequest = DeductServiceCreditRequestBuilder::init( + DeductServiceCreditBuilder::init( + 'String9' + ) + ->memo('memo0') + ->build() +)->build(); ``` diff --git a/doc/models/deduct-service-credit.md b/doc/models/deduct-service-credit.md index a1aec169..c6cababc 100644 --- a/doc/models/deduct-service-credit.md +++ b/doc/models/deduct-service-credit.md @@ -12,12 +12,15 @@ | `amount` | string\|float | Required | This is a container for one-of cases. | getAmount(): | setAmount( amount): void | | `memo` | `?string` | Optional | - | getMemo(): ?string | setMemo(?string memo): void | -## Example (as JSON) +## Example -```json -{ - "amount": "String1", - "memo": "memo2" -} +```php +use AdvancedBillingLib\Models\Builders\DeductServiceCreditBuilder; + +$deductServiceCredit = DeductServiceCreditBuilder::init( + 'String5' +) + ->memo('memo6') + ->build(); ``` diff --git a/doc/models/delayed-cancellation-response.md b/doc/models/delayed-cancellation-response.md index 36f9a14a..bac677b9 100644 --- a/doc/models/delayed-cancellation-response.md +++ b/doc/models/delayed-cancellation-response.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `message` | `?string` | Optional | - | getMessage(): ?string | setMessage(?string message): void | -## Example (as JSON) +## Example -```json -{ - "message": "message8" -} +```php +use AdvancedBillingLib\Models\Builders\DelayedCancellationResponseBuilder; + +$delayedCancellationResponse = DelayedCancellationResponseBuilder::init() + ->message('message4') + ->build(); ``` diff --git a/doc/models/delete-subscription-group-response.md b/doc/models/delete-subscription-group-response.md index 0b686d59..236c9495 100644 --- a/doc/models/delete-subscription-group-response.md +++ b/doc/models/delete-subscription-group-response.md @@ -12,12 +12,14 @@ | `uid` | `?string` | Optional | - | getUid(): ?string | setUid(?string uid): void | | `deleted` | `?bool` | Optional | - | getDeleted(): ?bool | setDeleted(?bool deleted): void | -## Example (as JSON) +## Example -```json -{ - "uid": "uid4", - "deleted": false -} +```php +use AdvancedBillingLib\Models\Builders\DeleteSubscriptionGroupResponseBuilder; + +$deleteSubscriptionGroupResponse = DeleteSubscriptionGroupResponseBuilder::init() + ->uid('uid0') + ->deleted(false) + ->build(); ``` diff --git a/doc/models/deliver-proforma-invoice-request.md b/doc/models/deliver-proforma-invoice-request.md index a45f8537..319cbfa3 100644 --- a/doc/models/deliver-proforma-invoice-request.md +++ b/doc/models/deliver-proforma-invoice-request.md @@ -13,21 +13,30 @@ | `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" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\DeliverProformaInvoiceRequestBuilder; + +$deliverProformaInvoiceRequest = DeliverProformaInvoiceRequestBuilder::init() + ->recipientEmails( + [ + 'recipient_emails3', + 'recipient_emails4' + ] + ) + ->ccRecipientEmails( + [ + 'cc_recipient_emails2', + 'cc_recipient_emails1', + 'cc_recipient_emails0' + ] + ) + ->bccRecipientEmails( + [ + 'bcc_recipient_emails6' + ] + ) + ->build(); ``` diff --git a/doc/models/direction.md b/doc/models/direction.md index ef6c29da..1489db77 100644 --- a/doc/models/direction.md +++ b/doc/models/direction.md @@ -12,3 +12,11 @@ | `ASC` | | `DESC` | +## Example + +```php +use AdvancedBillingLib\Models\Direction; + +$direction = Direction::ASC; +``` + diff --git a/doc/models/discount-type.md b/doc/models/discount-type.md index 77357ece..0cac7ca2 100644 --- a/doc/models/discount-type.md +++ b/doc/models/discount-type.md @@ -12,3 +12,11 @@ | `AMOUNT` | | `PERCENT` | +## Example + +```php +use AdvancedBillingLib\Models\DiscountType; + +$discountType = DiscountType::AMOUNT; +``` + diff --git a/doc/models/downgrade-credit-credit-type.md b/doc/models/downgrade-credit-credit-type.md index 50858a3b..9440d65d 100644 --- a/doc/models/downgrade-credit-credit-type.md +++ b/doc/models/downgrade-credit-credit-type.md @@ -21,3 +21,11 @@ The type of credit to be created when upgrading/downgrading. Defaults to the com | `PRORATED` | | `NONE` | +## Example + +```php +use AdvancedBillingLib\Models\DowngradeCreditCreditType; + +$downgradeCreditCreditType = DowngradeCreditCreditType::FULL; +``` + diff --git a/doc/models/dunner-data.md b/doc/models/dunner-data.md index 63d81d7b..f947d9e4 100644 --- a/doc/models/dunner-data.md +++ b/doc/models/dunner-data.md @@ -16,16 +16,19 @@ | `attempts` | `int` | Required | - | getAttempts(): int | setAttempts(int attempts): void | | `lastAttemptedAt` | `DateTime` | Required | - | getLastAttemptedAt(): \DateTime | setLastAttemptedAt(\DateTime lastAttemptedAt): void | -## Example (as JSON) - -```json -{ - "state": "state4", - "subscription_id": 126, - "revenue_at_risk_in_cents": 30, - "created_at": "2016-03-13T12:52:32.123Z", - "attempts": 110, - "last_attempted_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\DunnerDataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$dunnerData = DunnerDataBuilder::init( + 'state4', + 230, + 134, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + 6, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); ``` diff --git a/doc/models/dunning-step-data.md b/doc/models/dunning-step-data.md index d090a342..7276ba19 100644 --- a/doc/models/dunning-step-data.md +++ b/doc/models/dunning-step-data.md @@ -18,18 +18,21 @@ | `sendSms` | `bool` | Required | - | getSendSms(): bool | setSendSms(bool sendSms): void | | `smsBody` | `?string` | Optional | - | getSmsBody(): ?string | setSmsBody(?string smsBody): void | -## Example (as JSON) - -```json -{ - "day_threshold": 88, - "action": "action4", - "email_body": "email_body4", - "email_subject": "email_subject4", - "send_email": false, - "send_bcc_email": false, - "send_sms": false, - "sms_body": "sms_body0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\DunningStepDataBuilder; + +$dunningStepData = DunningStepDataBuilder::init( + 206, + 'action6', + false, + false, + false +) + ->emailBody('email_body6') + ->emailSubject('email_subject6') + ->smsBody('sms_body8') + ->build(); ``` diff --git a/doc/models/dunning-step-reached.md b/doc/models/dunning-step-reached.md index df282050..f9d50c76 100644 --- a/doc/models/dunning-step-reached.md +++ b/doc/models/dunning-step-reached.md @@ -13,38 +13,45 @@ | `currentStep` | [`DunningStepData`](../../doc/models/dunning-step-data.md) | Required | - | getCurrentStep(): DunningStepData | setCurrentStep(DunningStepData currentStep): void | | `nextStep` | [`DunningStepData`](../../doc/models/dunning-step-data.md) | Required | - | getNextStep(): DunningStepData | setNextStep(DunningStepData nextStep): void | -## Example (as JSON) - -```json -{ - "dunner": { - "state": "state8", - "subscription_id": 194, - "revenue_at_risk_in_cents": 98, - "created_at": "2016-03-13T12:52:32.123Z", - "attempts": 42, - "last_attempted_at": "2016-03-13T12:52:32.123Z" - }, - "current_step": { - "day_threshold": 198, - "action": "action4", - "email_body": "email_body4", - "email_subject": "email_subject6", - "send_email": false, - "send_bcc_email": false, - "send_sms": false, - "sms_body": "sms_body0" - }, - "next_step": { - "day_threshold": 30, - "action": "action4", - "email_body": "email_body4", - "email_subject": "email_subject4", - "send_email": false, - "send_bcc_email": false, - "send_sms": false, - "sms_body": "sms_body0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\DunningStepReachedBuilder; +use AdvancedBillingLib\Models\Builders\DunnerDataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\DunningStepDataBuilder; + +$dunningStepReached = DunningStepReachedBuilder::init( + DunnerDataBuilder::init( + 'state8', + 194, + 98, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + 42, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') + )->build(), + DunningStepDataBuilder::init( + 198, + 'action4', + false, + false, + false + ) + ->emailBody('email_body4') + ->emailSubject('email_subject6') + ->smsBody('sms_body0') + ->build(), + DunningStepDataBuilder::init( + 30, + 'action4', + false, + false, + false + ) + ->emailBody('email_body4') + ->emailSubject('email_subject4') + ->smsBody('sms_body0') + ->build() +)->build(); ``` diff --git a/doc/models/ebb-component.md b/doc/models/ebb-component.md index 821b2a8f..a84eae5b 100644 --- a/doc/models/ebb-component.md +++ b/doc/models/ebb-component.md @@ -9,10 +9,10 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes". | getName(): string | setName(string name): void | -| `unitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item | getUnitName(): string | setUnitName(string unitName): void | +| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, i.e., "Minutes". | getName(): string | setName(string name): void | +| `unitName` | `string` | Required | “The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e., “message”, which may then be shown as “5 messages” on a subscription’s component line-item” | getUnitName(): string | setUnitName(string unitName): void | | `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 | +| `handle` | `?string` | Optional | A unique identifier for your use that can be used to retrieve this component in 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 | | `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 | @@ -21,36 +21,73 @@ | `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 | | `hideDateRangeOnInvoice` | `?bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | getHideDateRangeOnInvoice(): ?bool | setHideDateRangeOnInvoice(?bool hideDateRangeOnInvoice): void | | `eventBasedBillingMetricId` | `int` | Required | The ID of an event based billing metric that will be attached to this component. | getEventBasedBillingMetricId(): int | setEventBasedBillingMetricId(int eventBasedBillingMetricId): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. i.e., an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | -## Example (as JSON) - -```json -{ - "name": "name0", - "unit_name": "unit_name2", - "description": "description0", - "handle": "handle6", - "taxable": false, - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "price_points": [ - { - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "interval": 92, - "interval_unit": "day" - } - ], - "event_based_billing_metric_id": 190 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EBBComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointItemBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$eBBComponent = EBBComponentBuilder::init( + 'name0', + 'unit_name2', + PricingScheme::STAIRSTEP, + 36 +) + ->description('description0') + ->handle('handle6') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->pricePoints( + [ + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build(), + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build(), + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/ebb-event.md b/doc/models/ebb-event.md index f4dc0d13..5f700c0f 100644 --- a/doc/models/ebb-event.md +++ b/doc/models/ebb-event.md @@ -11,28 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `chargify` | [`?ChargifyEBB`](../../doc/models/chargify-ebb.md) | Optional | - | getChargify(): ?ChargifyEBB | setChargify(?ChargifyEBB chargify): void | -## Example (as JSON) - -```json -{ - "chargify": { - "subscription_id": 1, - "timestamp": "2020-02-27T17:45:50-05:00", - "id": "id6", - "created_at": "2016-03-13T12:52:32.123Z", - "uniqueness_token": "uniqueness_token2" - }, - "messages": 150, - "country": "US", - "customer": { - "name": "John", - "lastName": "Doe", - "address": { - "street": "Maple Street", - "zip": 4888, - "state": "MA" - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EBBEventBuilder; +use AdvancedBillingLib\Models\Builders\ChargifyEBBBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$eBBEvent = EBBEventBuilder::init() + ->chargify( + ChargifyEBBBuilder::init() + ->timestamp(DateTimeHelper::fromRfc3339DateTime('2020-02-27T17:45:50-05:00')) + ->subscriptionId(1) + ->build() + ) + ->build(); ``` diff --git a/doc/models/enable-webhooks-request.md b/doc/models/enable-webhooks-request.md index 91238414..578e0a84 100644 --- a/doc/models/enable-webhooks-request.md +++ b/doc/models/enable-webhooks-request.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `webhooksEnabled` | `bool` | Required | - | getWebhooksEnabled(): bool | setWebhooksEnabled(bool webhooksEnabled): void | -## Example (as JSON) +## Example -```json -{ - "webhooks_enabled": false -} +```php +use AdvancedBillingLib\Models\Builders\EnableWebhooksRequestBuilder; + +$enableWebhooksRequest = EnableWebhooksRequestBuilder::init( + false +)->build(); ``` diff --git a/doc/models/enable-webhooks-response.md b/doc/models/enable-webhooks-response.md index c06e20dc..55753c8a 100644 --- a/doc/models/enable-webhooks-response.md +++ b/doc/models/enable-webhooks-response.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `webhooksEnabled` | `?bool` | Optional | - | getWebhooksEnabled(): ?bool | setWebhooksEnabled(?bool webhooksEnabled): void | -## Example (as JSON) +## Example -```json -{ - "webhooks_enabled": false -} +```php +use AdvancedBillingLib\Models\Builders\EnableWebhooksResponseBuilder; + +$enableWebhooksResponse = EnableWebhooksResponseBuilder::init() + ->webhooksEnabled(false) + ->build(); ``` diff --git a/doc/models/endpoint-response.md b/doc/models/endpoint-response.md index f96c7728..2556a434 100644 --- a/doc/models/endpoint-response.md +++ b/doc/models/endpoint-response.md @@ -11,19 +11,26 @@ | --- | --- | --- | --- | --- | --- | | `endpoint` | [`?Endpoint`](../../doc/models/endpoint.md) | Optional | - | getEndpoint(): ?Endpoint | setEndpoint(?Endpoint endpoint): void | -## Example (as JSON) - -```json -{ - "endpoint": { - "id": 202, - "url": "url2", - "site_id": 128, - "status": "status0", - "webhook_subscriptions": [ - "webhook_subscriptions4" - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EndpointResponseBuilder; +use AdvancedBillingLib\Models\Builders\EndpointBuilder; + +$endpointResponse = EndpointResponseBuilder::init() + ->endpoint( + EndpointBuilder::init() + ->id(202) + ->url('url2') + ->siteId(128) + ->status('status0') + ->webhookSubscriptions( + [ + 'webhook_subscriptions4' + ] + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/endpoint.md b/doc/models/endpoint.md index ae6a6348..7ad79bed 100644 --- a/doc/models/endpoint.md +++ b/doc/models/endpoint.md @@ -15,18 +15,21 @@ | `status` | `?string` | Optional | - | getStatus(): ?string | setStatus(?string status): void | | `webhookSubscriptions` | `?(string[])` | Optional | - | getWebhookSubscriptions(): ?array | setWebhookSubscriptions(?array webhookSubscriptions): void | -## Example (as JSON) - -```json -{ - "id": 196, - "url": "url2", - "site_id": 122, - "status": "status0", - "webhook_subscriptions": [ - "webhook_subscriptions4", - "webhook_subscriptions3" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EndpointBuilder; + +$endpoint = EndpointBuilder::init() + ->id(202) + ->url('url2') + ->siteId(128) + ->status('status0') + ->webhookSubscriptions( + [ + 'webhook_subscriptions4' + ] + ) + ->build(); ``` diff --git a/doc/models/error-array-map-response-exception.md b/doc/models/error-array-map-response-exception.md index cb66c210..c482583b 100644 --- a/doc/models/error-array-map-response-exception.md +++ b/doc/models/error-array-map-response-exception.md @@ -11,16 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | `?array` | Optional | - | getErrors(): ?array | setErrors(?array errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "key0": { - "key1": "val1", - "key2": "val2" - } - } +## Example + +```php +try { + // make the API call +} catch (ErrorArrayMapResponseException $exp) { + echo 'Caught ErrorArrayMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/error-list-response-exception.md b/doc/models/error-list-response-exception.md index 51ea3324..df1c8b81 100644 --- a/doc/models/error-list-response-exception.md +++ b/doc/models/error-list-response-exception.md @@ -13,15 +13,15 @@ Error which contains list of messages. | --- | --- | --- | --- | --- | --- | | `errors` | `string[]` | Required | - | getErrors(): array | setErrors(array errors): void | -## Example (as JSON) - -```json -{ - "errors": [ - "errors5", - "errors6", - "errors7" - ] +## Example + +```php +try { + // make the API call +} catch (ErrorListResponseException $exp) { + echo 'Caught ErrorListResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/error-string-map-response-exception.md b/doc/models/error-string-map-response-exception.md index 023d545d..62d043cb 100644 --- a/doc/models/error-string-map-response-exception.md +++ b/doc/models/error-string-map-response-exception.md @@ -11,14 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | `?array` | Optional | - | getErrors(): ?array | setErrors(?array errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "key0": "errors3", - "key1": "errors4" - } +## Example + +```php +try { + // make the API call +} catch (ErrorStringMapResponseException $exp) { + echo 'Caught ErrorStringMapResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/errors.md b/doc/models/errors.md index d6c3ded6..d8bd6221 100644 --- a/doc/models/errors.md +++ b/doc/models/errors.md @@ -12,18 +12,26 @@ | `perPage` | `?(string[])` | Optional | - | getPerPage(): ?array | setPerPage(?array perPage): void | | `pricePoint` | `?(string[])` | Optional | - | getPricePoint(): ?array | setPricePoint(?array pricePoint): void | -## Example (as JSON) - -```json -{ - "per_page": [ - "per_page7", - "per_page8" - ], - "price_point": [ - "price_point6", - "price_point7" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ErrorsBuilder; + +$errors = ErrorsBuilder::init() + ->perPage( + [ + 'per_page1', + 'per_page2', + 'per_page3' + ] + ) + ->pricePoint( + [ + 'price_point0', + 'price_point9', + 'price_point8' + ] + ) + ->build(); ``` diff --git a/doc/models/event-based-billing-list-segments-errors-exception.md b/doc/models/event-based-billing-list-segments-errors-exception.md index bb773570..7bf47ad2 100644 --- a/doc/models/event-based-billing-list-segments-errors-exception.md +++ b/doc/models/event-based-billing-list-segments-errors-exception.md @@ -11,22 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?Errors`](../../doc/models/errors.md) | Optional | - | getErrors(): ?Errors | setErrors(?Errors errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "per_page": [ - "per_page1", - "per_page2", - "per_page3" - ], - "price_point": [ - "price_point0", - "price_point9", - "price_point8" - ] - } +## Example + +```php +try { + // make the API call +} catch (EventBasedBillingListSegmentsErrorsException $exp) { + echo 'Caught EventBasedBillingListSegmentsErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/event-based-billing-segment-error.md b/doc/models/event-based-billing-segment-error.md index 936daecc..8fcc5f0e 100644 --- a/doc/models/event-based-billing-segment-error.md +++ b/doc/models/event-based-billing-segment-error.md @@ -11,20 +11,17 @@ | --- | --- | --- | --- | --- | --- | | `segments` | `array` | Required | The key of the object would be a number (an index in the request array) where the error occurred. In the value object, the key represents the field and the value is an array with error messages. In most cases, this object would contain just one key. | getSegments(): array | setSegments(array segments): void | -## Example (as JSON) - -```json -{ - "segments": { - "key0": { - "key1": "val1", - "key2": "val2" - }, - "key1": { - "key1": "val1", - "key2": "val2" - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EventBasedBillingSegmentErrorBuilder; +use AdvancedBillingLib\ApiHelper; + +$eventBasedBillingSegmentError = EventBasedBillingSegmentErrorBuilder::init( + [ + 'key0' => ApiHelper::deserialize('{"key1":"val1","key2":"val2"}'), + 'key1' => ApiHelper::deserialize('{"key1":"val1","key2":"val2"}') + ] +)->build(); ``` diff --git a/doc/models/event-based-billing-segment-errors-exception.md b/doc/models/event-based-billing-segment-errors-exception.md index a0f0450e..1eb5819e 100644 --- a/doc/models/event-based-billing-segment-errors-exception.md +++ b/doc/models/event-based-billing-segment-errors-exception.md @@ -11,24 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | `?array` | Optional | The key of the object would be a number (an index in the request array) where the error occurred. In the value object, the key represents the field and the value is an array with error messages. In most cases, this object would contain just one key. | getErrors(): ?array | setErrors(?array errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "key0": { - "key1": "val1", - "key2": "val2" - }, - "key1": { - "key1": "val1", - "key2": "val2" - }, - "key2": { - "key1": "val1", - "key2": "val2" - } - } +## Example + +```php +try { + // make the API call +} catch (EventBasedBillingSegmentErrorsException $exp) { + echo 'Caught EventBasedBillingSegmentErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/event-based-billing-segment-exception.md b/doc/models/event-based-billing-segment-exception.md index 5d548d20..06c7988d 100644 --- a/doc/models/event-based-billing-segment-exception.md +++ b/doc/models/event-based-billing-segment-exception.md @@ -11,18 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`EventBasedBillingSegmentError`](../../doc/models/event-based-billing-segment-error.md) | Required | - | getErrors(): EventBasedBillingSegmentError | setErrors(EventBasedBillingSegmentError errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "segments": { - "key0": { - "key1": "val1", - "key2": "val2" - } - } - } +## Example + +```php +try { + // make the API call +} catch (EventBasedBillingSegmentException $exp) { + echo 'Caught EventBasedBillingSegmentException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/event-key.md b/doc/models/event-key.md index a400739e..718941ee 100644 --- a/doc/models/event-key.md +++ b/doc/models/event-key.md @@ -21,6 +21,7 @@ | `RENEWAL_FAILURE` | | `SUBSCRIPTION_STATE_CHANGE` | | `SUBSCRIPTION_PRODUCT_CHANGE` | +| `SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED` | | `PENDING_CANCELLATION_CHANGE` | | `EXPIRING_CARD` | | `CUSTOMER_UPDATE` | @@ -93,3 +94,11 @@ | `SUBSCRIPTION_TERM_RENEWAL_ACTIVATED` | | `SUBSCRIPTION_TERM_RENEWAL_REMOVED` | +## Example + +```php +use AdvancedBillingLib\Models\EventKey; + +$eventKey = EventKey::SUBSCRIPTION_GROUP_SIGNUP_SUCCESS; +``` + diff --git a/doc/models/event-response.md b/doc/models/event-response.md index b2a65f7e..fd7b1ce9 100644 --- a/doc/models/event-response.md +++ b/doc/models/event-response.md @@ -11,34 +11,35 @@ | --- | --- | --- | --- | --- | --- | | `event` | [`Event`](../../doc/models/event.md) | Required | - | getEvent(): Event | setEvent(Event event): void | -## Example (as JSON) - -```json -{ - "event": { - "id": 242, - "key": "maxio_payments_direct_debit_payment_rejected", - "message": "message0", - "subscription_id": 96, - "customer_id": 24, - "created_at": "2016-03-13T12:52:32.123Z", - "event_specific_data": { - "previous_unit_balance": null, - "previous_overage_unit_balance": null, - "new_unit_balance": null, - "new_overage_unit_balance": null, - "usage_quantity": null, - "overage_usage_quantity": null, - "component_id": null, - "component_handle": null, - "memo": null, - "allocation_details": [ - null - ], - "previous_product_id": 126, - "new_product_id": 12 - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EventResponseBuilder; +use AdvancedBillingLib\Models\Builders\EventBuilder; +use AdvancedBillingLib\Models\EventKey; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\SubscriptionProductChangeBuilder; + +$eventResponse = EventResponseBuilder::init( + EventBuilder::init( + 242, + EventKey::SUBSCRIPTION_REMOVED_FROM_GROUP, + 'message0', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') + ) + ->subscriptionId(96) + ->customerId(24) + ->eventSpecificData( + SubscriptionProductChangeBuilder::init( + 126, + 12 + ) + ->previousProductPricePointId(250) + ->newProductPricePointId(244) + ->effectiveAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/event.md b/doc/models/event.md index c03fda16..cf908a7e 100644 --- a/doc/models/event.md +++ b/doc/models/event.md @@ -17,32 +17,32 @@ | `createdAt` | `DateTime` | Required | - | getCreatedAt(): \DateTime | setCreatedAt(\DateTime createdAt): void | | `eventSpecificData` | [SubscriptionProductChange](../../doc/models/subscription-product-change.md)\|[SubscriptionStateChange](../../doc/models/subscription-state-change.md)\|[PaymentRelatedEvents](../../doc/models/payment-related-events.md)\|[RefundSuccess](../../doc/models/refund-success.md)\|[ComponentAllocationChange](../../doc/models/component-allocation-change.md)\|[MeteredUsage](../../doc/models/metered-usage.md)\|[PrepaidUsage](../../doc/models/prepaid-usage.md)\|[DunningStepReached](../../doc/models/dunning-step-reached.md)\|[InvoiceIssued](../../doc/models/invoice-issued.md)\|[PendingCancellationChange](../../doc/models/pending-cancellation-change.md)\|[PrepaidSubscriptionBalanceChanged](../../doc/models/prepaid-subscription-balance-changed.md)\|Proforma[InvoiceIssued](../../doc/models/invoice-issued.md)\|[SubscriptionGroupSignupEventData](../../doc/models/subscription-group-signup-event-data.md)\|[CreditAccountBalanceChanged](../../doc/models/credit-account-balance-changed.md)\|[PrepaymentAccountBalanceChanged](../../doc/models/prepayment-account-balance-changed.md)\|[PaymentCollectionMethodChanged](../../doc/models/payment-collection-method-changed.md)\|[ItemPricePointChanged](../../doc/models/item-price-point-changed.md)\|[CustomFieldValueChange](../../doc/models/custom-field-value-change.md)\|[ChjsTokenizationSuccess](../../doc/models/chjs-tokenization-success.md)\|[ChjsTokenizationFailure](../../doc/models/chjs-tokenization-failure.md)\|null | Required | This is a container for one-of cases. | getEventSpecificData(): | setEventSpecificData( eventSpecificData): void | -## Example (as JSON) - -```json -{ - "id": 40, - "key": "subscription_group_signup_success", - "message": "message8", - "subscription_id": 150, - "customer_id": 78, - "created_at": "2016-03-13T12:52:32.123Z", - "event_specific_data": { - "previous_unit_balance": null, - "previous_overage_unit_balance": null, - "new_unit_balance": null, - "new_overage_unit_balance": null, - "usage_quantity": null, - "overage_usage_quantity": null, - "component_id": null, - "component_handle": null, - "memo": null, - "allocation_details": [ - null - ], - "previous_product_id": 126, - "new_product_id": 12 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\EventBuilder; +use AdvancedBillingLib\Models\EventKey; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\SubscriptionProductChangeBuilder; + +$event = EventBuilder::init( + 242, + EventKey::SUBSCRIPTION_REMOVED_FROM_GROUP, + 'message0', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +) + ->subscriptionId(96) + ->customerId(24) + ->eventSpecificData( + SubscriptionProductChangeBuilder::init( + 126, + 12 + ) + ->previousProductPricePointId(250) + ->newProductPricePointId(244) + ->effectiveAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build(); ``` diff --git a/doc/models/expiration-interval-unit.md b/doc/models/expiration-interval-unit.md index d6b75bef..d12d973a 100644 --- a/doc/models/expiration-interval-unit.md +++ b/doc/models/expiration-interval-unit.md @@ -13,3 +13,11 @@ | `MONTH` | | `NEVER` | +## Example + +```php +use AdvancedBillingLib\Models\ExpirationIntervalUnit; + +$expirationIntervalUnit = ExpirationIntervalUnit::NEVER; +``` + diff --git a/doc/models/failed-payment-action.md b/doc/models/failed-payment-action.md index 4d48d023..2ff5f777 100644 --- a/doc/models/failed-payment-action.md +++ b/doc/models/failed-payment-action.md @@ -5,7 +5,7 @@ Action taken when payment for an invoice fails: - `leave_open_invoice` - prepayments and credits applied to invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history. This is the default option. - `rollback_to_pending` - prepayments and credits not applied; invoice remains in "pending" status; no email sent to the customer; payment failure recorded in the invoice history. -- `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending upon net terms and dunning settings). +- `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending upon net terms and dunning settings). ## Enumeration @@ -19,3 +19,11 @@ Action taken when payment for an invoice fails: | `ROLLBACK_TO_PENDING` | | `INITIATE_DUNNING` | +## Example + +```php +use AdvancedBillingLib\Models\FailedPaymentAction; + +$failedPaymentAction = FailedPaymentAction::LEAVE_OPEN_INVOICE; +``` + diff --git a/doc/models/failed-payment-event-data.md b/doc/models/failed-payment-event-data.md index 59494099..3029fa81 100644 --- a/doc/models/failed-payment-event-data.md +++ b/doc/models/failed-payment-event-data.md @@ -17,15 +17,19 @@ Example schema for an `failed_payment` event | `paymentMethod` | [`string(InvoicePaymentMethodType)`](../../doc/models/invoice-payment-method-type.md) | Required | - | getPaymentMethod(): string | setPaymentMethod(string paymentMethod): void | | `transactionId` | `int` | Required | The transaction ID of the failed payment. | getTransactionId(): int | setTransactionId(int transactionId): void | -## Example (as JSON) - -```json -{ - "amount_in_cents": 128, - "applied_amount": 154, - "memo": "memo2", - "payment_method": "credit_card", - "transaction_id": 170 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\FailedPaymentEventDataBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$failedPaymentEventData = FailedPaymentEventDataBuilder::init( + 34, + 196, + InvoicePaymentMethodType::ACH, + 76 +) + ->memo('memo0') + ->build(); ``` diff --git a/doc/models/failed-payment-event.md b/doc/models/failed-payment-event.md index 8ade1290..36f1e189 100644 --- a/doc/models/failed-payment-event.md +++ b/doc/models/failed-payment-event.md @@ -15,31 +15,39 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::FAILED_PAYMENT` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`FailedPaymentEventData`](../../doc/models/failed-payment-event-data.md) | Required | Example schema for an `failed_payment` event | getEventData(): FailedPaymentEventData | setEventData(FailedPaymentEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 120, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "failed_payment", - "event_data": { - "amount_in_cents": 220, - "applied_amount": 194, - "memo": "memo0", - "payment_method": "cash", - "transaction_id": 78 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\FailedPaymentEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\FailedPaymentEventDataBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$failedPaymentEvent = FailedPaymentEventBuilder::init( + 186, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::FAILED_PAYMENT, + FailedPaymentEventDataBuilder::init( + 220, + 194, + InvoicePaymentMethodType::CASH, + 78 + ) + ->memo('memo0') + ->build() +)->build(); ``` diff --git a/doc/models/first-charge-type.md b/doc/models/first-charge-type.md index 9fa953d6..e3dace72 100644 --- a/doc/models/first-charge-type.md +++ b/doc/models/first-charge-type.md @@ -13,3 +13,11 @@ | `IMMEDIATE` | | `DELAYED` | +## Example + +```php +use AdvancedBillingLib\Models\FirstChargeType; + +$firstChargeType = FirstChargeType::DELAYED; +``` + diff --git a/doc/models/full-subscription-group-response.md b/doc/models/full-subscription-group-response.md index ecb6351c..5b9cd071 100644 --- a/doc/models/full-subscription-group-response.md +++ b/doc/models/full-subscription-group-response.md @@ -22,19 +22,23 @@ | `customer` | [`?SubscriptionGroupCustomer`](../../doc/models/subscription-group-customer.md) | Optional | - | getCustomer(): ?SubscriptionGroupCustomer | setCustomer(?SubscriptionGroupCustomer customer): void | | `accountBalances` | [`?SubscriptionGroupBalances`](../../doc/models/subscription-group-balances.md) | Optional | - | getAccountBalances(): ?SubscriptionGroupBalances | setAccountBalances(?SubscriptionGroupBalances accountBalances): void | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "scheme": 90, - "customer_id": 110, - "payment_profile_id": 18, - "subscription_ids": [ - 220, - 221, - 222 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\FullSubscriptionGroupResponseBuilder; + +$fullSubscriptionGroupResponse = FullSubscriptionGroupResponseBuilder::init() + ->uid('uid6') + ->scheme(80) + ->customerId(100) + ->paymentProfileId(8) + ->subscriptionIds( + [ + 210, + 211, + 212 + ] + ) + ->build(); ``` diff --git a/doc/models/get-one-time-token-bank-account-payment-profile.md b/doc/models/get-one-time-token-bank-account-payment-profile.md new file mode 100644 index 00000000..72ea403c --- /dev/null +++ b/doc/models/get-one-time-token-bank-account-payment-profile.md @@ -0,0 +1,70 @@ + +# Get One Time Token Bank Account Payment Profile + +## Structure + +`GetOneTimeTokenBankAccountPaymentProfile` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `id` | `?string` | Optional | - | getId(): ?string | setId(?string id): void | +| `firstName` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getFirstName(): string | setFirstName(string firstName): void | +| `lastName` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getLastName(): string | setLastName(string lastName): void | +| `customerId` | `?string` | Optional | - | getCustomerId(): ?string | setCustomerId(?string customerId): void | +| `currentVault` | [`string(BankAccountVault)`](../../doc/models/bank-account-vault.md) | Required | The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing. | getCurrentVault(): string | setCurrentVault(string currentVault): void | +| `vaultToken` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getVaultToken(): string | setVaultToken(string vaultToken): void | +| `billingAddress` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getBillingAddress(): string | setBillingAddress(string billingAddress): void | +| `billingAddress2` | `?string` | Optional | - | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | +| `billingCity` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getBillingCity(): string | setBillingCity(string billingCity): void | +| `billingCountry` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getBillingCountry(): string | setBillingCountry(string billingCountry): void | +| `billingState` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getBillingState(): string | setBillingState(string billingState): void | +| `billingZip` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getBillingZip(): string | setBillingZip(string billingZip): void | +| `bankName` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getBankName(): string | setBankName(string bankName): void | +| `maskedBankRoutingNumber` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getMaskedBankRoutingNumber(): string | setMaskedBankRoutingNumber(string maskedBankRoutingNumber): void | +| `maskedBankAccountNumber` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getMaskedBankAccountNumber(): string | setMaskedBankAccountNumber(string maskedBankAccountNumber): void | +| `bankAccountType` | [`string(BankAccountType)`](../../doc/models/bank-account-type.md) | Required | Defaults to checking | getBankAccountType(): string | setBankAccountType(string bankAccountType): void | +| `bankAccountHolderType` | [`string(BankAccountHolderType)`](../../doc/models/bank-account-holder-type.md) | Required | Defaults to personal | getBankAccountHolderType(): string | setBankAccountHolderType(string bankAccountHolderType): void | +| `paymentType` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getPaymentType(): string | setPaymentType(string paymentType): void | +| `disabled` | `bool` | Required | - | getDisabled(): bool | setDisabled(bool disabled): void | +| `siteGatewaySettingId` | `int` | Required | - | getSiteGatewaySettingId(): int | setSiteGatewaySettingId(int siteGatewaySettingId): void | +| `customerVaultToken` | `?string` | Optional | - | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | +| `gatewayHandle` | `?string` | Optional | - | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | +| `verified` | `?bool` | Optional | - | getVerified(): ?bool | setVerified(?bool verified): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\GetOneTimeTokenBankAccountPaymentProfileBuilder; +use AdvancedBillingLib\Models\BankAccountVault; +use AdvancedBillingLib\Models\BankAccountType; +use AdvancedBillingLib\Models\BankAccountHolderType; + +$getOneTimeTokenBankAccountPaymentProfile = GetOneTimeTokenBankAccountPaymentProfileBuilder::init( + 'first_name0', + 'last_name8', + BankAccountVault::MAXP, + 'vault_token2', + 'billing_address2', + 'billing_city8', + 'billing_country4', + 'billing_state6', + 'billing_zip8', + 'bank_name4', + 'masked_bank_routing_number4', + 'masked_bank_account_number2', + BankAccountType::CHECKING, + BankAccountHolderType::PERSONAL, + 'payment_type0', + false, + 246 +) + ->id('id0') + ->customerId('customer_id8') + ->billingAddress2('billing_address_22') + ->customerVaultToken('customer_vault_token8') + ->gatewayHandle('gateway_handle2') + ->build(); +``` + diff --git a/doc/models/get-one-time-token-payment-profile.md b/doc/models/get-one-time-token-payment-profile.md index 0bf6caf7..ef3a0ed1 100644 --- a/doc/models/get-one-time-token-payment-profile.md +++ b/doc/models/get-one-time-token-payment-profile.md @@ -31,31 +31,36 @@ | `customerVaultToken` | `?string` | Optional | - | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | | `gatewayHandle` | `?string` | Optional | - | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | -## Example (as JSON) - -```json -{ - "id": "id2", - "first_name": "first_name2", - "last_name": "last_name0", - "masked_card_number": "masked_card_number0", - "card_type": "routex", - "expiration_month": 187.78, - "expiration_year": 164.44, - "customer_id": "customer_id0", - "current_vault": "braintree_blue", - "vault_token": "vault_token4", - "billing_address": "billing_address4", - "billing_address_2": "billing_address_24", - "billing_city": "billing_city0", - "billing_country": "billing_country6", - "billing_state": "billing_state6", - "billing_zip": "billing_zip0", - "payment_type": "payment_type2", - "disabled": false, - "site_gateway_setting_id": 232, - "customer_vault_token": "customer_vault_token0", - "gateway_handle": "gateway_handle4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\GetOneTimeTokenPaymentProfileBuilder; +use AdvancedBillingLib\Models\CardType; +use AdvancedBillingLib\Models\CreditCardVault; + +$getOneTimeTokenPaymentProfile = GetOneTimeTokenPaymentProfileBuilder::init( + 'first_name4', + 'last_name2', + 'masked_card_number2', + CardType::MAESTRO_NO_LUHN, + 28.3, + 4.96, + CreditCardVault::TRUST_COMMERCE, + 'vault_token6', + 'billing_address6', + 'billing_city2', + 'billing_country8', + 'billing_state2', + 'billing_zip2', + 'payment_type6', + false, + 156 +) + ->id('id4') + ->customerId('customer_id2') + ->billingAddress2('billing_address_26') + ->customerVaultToken('customer_vault_token2') + ->gatewayHandle('gateway_handle6') + ->build(); ``` diff --git a/doc/models/get-one-time-token-request.md b/doc/models/get-one-time-token-request.md index 587acdbf..e7783c82 100644 --- a/doc/models/get-one-time-token-request.md +++ b/doc/models/get-one-time-token-request.md @@ -9,35 +9,41 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `paymentProfile` | [`GetOneTimeTokenPaymentProfile`](../../doc/models/get-one-time-token-payment-profile.md) | Required | - | getPaymentProfile(): GetOneTimeTokenPaymentProfile | setPaymentProfile(GetOneTimeTokenPaymentProfile paymentProfile): void | - -## Example (as JSON) - -```json -{ - "payment_profile": { - "id": "id4", - "first_name": "first_name4", - "last_name": "last_name2", - "masked_card_number": "masked_card_number2", - "card_type": "bogus", - "expiration_month": 133.5, - "expiration_year": 156.84, - "customer_id": "customer_id2", - "current_vault": "stripe", - "vault_token": "vault_token6", - "billing_address": "billing_address4", - "billing_address_2": "billing_address_26", - "billing_city": "billing_city8", - "billing_country": "billing_country2", - "billing_state": "billing_state2", - "billing_zip": "billing_zip2", - "payment_type": "payment_type6", - "disabled": false, - "site_gateway_setting_id": 104, - "customer_vault_token": "customer_vault_token2", - "gateway_handle": "gateway_handle4" - } -} +| `paymentProfile` | [GetOneTimeTokenPaymentProfile](../../doc/models/get-one-time-token-payment-profile.md)\|[GetOneTimeTokenBankAccountPaymentProfile](../../doc/models/get-one-time-token-bank-account-payment-profile.md) | Required | This is a container for any-of cases. | getPaymentProfile(): | setPaymentProfile( paymentProfile): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\GetOneTimeTokenRequestBuilder; +use AdvancedBillingLib\Models\Builders\GetOneTimeTokenPaymentProfileBuilder; +use AdvancedBillingLib\Models\CardType; +use AdvancedBillingLib\Models\CreditCardVault; + +$getOneTimeTokenRequest = GetOneTimeTokenRequestBuilder::init( + GetOneTimeTokenPaymentProfileBuilder::init( + 'first_name2', + 'last_name0', + 'masked_card_number0', + CardType::ROUTEX, + 187.78, + 164.44, + CreditCardVault::BRAINTREE_BLUE, + 'vault_token4', + 'billing_address4', + 'billing_city0', + 'billing_country6', + 'billing_state6', + 'billing_zip0', + 'payment_type2', + false, + 232 + ) + ->id('id2') + ->customerId('customer_id0') + ->billingAddress2('billing_address_24') + ->customerVaultToken('customer_vault_token0') + ->gatewayHandle('gateway_handle4') + ->build() +)->build(); ``` diff --git a/doc/models/group-billing.md b/doc/models/group-billing.md index 71dc9405..3169f5af 100644 --- a/doc/models/group-billing.md +++ b/doc/models/group-billing.md @@ -1,7 +1,7 @@ # Group Billing -Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions. +(Optional) Attributes related to billing date and accrual. Note: Only applicable for new subscriptions. ## Structure @@ -15,13 +15,15 @@ Optional attributes related to billing date and accrual. Note: Only applicable f | `alignDate` | `?bool` | Optional | A flag indicating whether or not to align the billing date of the new subscription with the billing date of the primary subscription of the hierarchy's default subscription group. Required to be true if prorate is also true.

**Default**: `false` | getAlignDate(): ?bool | setAlignDate(?bool alignDate): void | | `prorate` | `?bool` | Optional | A flag indicating whether or not to prorate billing of the new subscription for the current period. A value of true is ignored unless align_date is also true.

**Default**: `false` | getProrate(): ?bool | setProrate(?bool prorate): void | -## Example (as JSON) +## Example -```json -{ - "accrue": false, - "align_date": false, - "prorate": false -} +```php +use AdvancedBillingLib\Models\Builders\GroupBillingBuilder; + +$groupBilling = GroupBillingBuilder::init() + ->accrue(false) + ->alignDate(false) + ->prorate(false) + ->build(); ``` diff --git a/doc/models/group-settings.md b/doc/models/group-settings.md index c2afe97c..23bead5c 100644 --- a/doc/models/group-settings.md +++ b/doc/models/group-settings.md @@ -10,21 +10,30 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `target` | [`GroupTarget`](../../doc/models/group-target.md) | Required | Attributes of the target customer who will be the responsible payer of the created subscription. Required. | getTarget(): GroupTarget | setTarget(GroupTarget target): void | -| `billing` | [`?GroupBilling`](../../doc/models/group-billing.md) | Optional | Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions. | getBilling(): ?GroupBilling | setBilling(?GroupBilling billing): void | - -## Example (as JSON) - -```json -{ - "target": { - "type": "parent", - "id": 236 - }, - "billing": { - "accrue": false, - "align_date": false, - "prorate": false - } -} +| `billing` | [`?GroupBilling`](../../doc/models/group-billing.md) | Optional | (Optional) Attributes related to billing date and accrual. Note: Only applicable for new subscriptions. | getBilling(): ?GroupBilling | setBilling(?GroupBilling billing): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\GroupSettingsBuilder; +use AdvancedBillingLib\Models\Builders\GroupTargetBuilder; +use AdvancedBillingLib\Models\GroupTargetType; +use AdvancedBillingLib\Models\Builders\GroupBillingBuilder; + +$groupSettings = GroupSettingsBuilder::init( + GroupTargetBuilder::init( + GroupTargetType::PARENT_ + ) + ->id(236) + ->build() +) + ->billing( + GroupBillingBuilder::init() + ->accrue(false) + ->alignDate(false) + ->prorate(false) + ->build() + ) + ->build(); ``` diff --git a/doc/models/group-status.md b/doc/models/group-status.md new file mode 100644 index 00000000..9ae8273d --- /dev/null +++ b/doc/models/group-status.md @@ -0,0 +1,22 @@ + +# Group Status + +## Enumeration + +`GroupStatus` + +## Fields + +| Name | +| --- | +| `UNGROUPED` | +| `GROUPED` | + +## Example + +```php +use AdvancedBillingLib\Models\GroupStatus; + +$groupStatus = GroupStatus::UNGROUPED; +``` + diff --git a/doc/models/group-target-type.md b/doc/models/group-target-type.md index a1146d46..209e5b66 100644 --- a/doc/models/group-target-type.md +++ b/doc/models/group-target-type.md @@ -17,3 +17,11 @@ The type of object indicated by the id attribute. | `PARENT_` | | `ELDEST` | +## Example + +```php +use AdvancedBillingLib\Models\GroupTargetType; + +$groupTargetType = GroupTargetType::SELF_; +``` + diff --git a/doc/models/group-target.md b/doc/models/group-target.md index 90db32a3..8d856792 100644 --- a/doc/models/group-target.md +++ b/doc/models/group-target.md @@ -12,14 +12,18 @@ Attributes of the target customer who will be the responsible payer of the creat | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `type` | [`string(GroupTargetType)`](../../doc/models/group-target-type.md) | Required | The type of object indicated by the id attribute. | getType(): string | setType(string type): void | -| `id` | `?int` | Optional | The id of the target customer or subscription to group the existing subscription with. Ignored and should not be included if type is "self" , "parent", or "eldest" | getId(): ?int | setId(?int id): void | +| `id` | `?int` | Optional | The id of the target customer or subscription to group the existing subscription with. Ignored and should not be included if type is "self", "parent", or "eldest". | getId(): ?int | setId(?int id): void | -## Example (as JSON) +## Example -```json -{ - "type": "self", - "id": 134 -} +```php +use AdvancedBillingLib\Models\Builders\GroupTargetBuilder; +use AdvancedBillingLib\Models\GroupTargetType; + +$groupTarget = GroupTargetBuilder::init( + GroupTargetType::PARENT_ +) + ->id(234) + ->build(); ``` diff --git a/doc/models/group-type.md b/doc/models/group-type.md index bc9c31b9..5ecb799b 100644 --- a/doc/models/group-type.md +++ b/doc/models/group-type.md @@ -12,3 +12,11 @@ | `SINGLE_CUSTOMER` | | `MULTIPLE_CUSTOMERS` | +## Example + +```php +use AdvancedBillingLib\Models\GroupType; + +$groupType = GroupType::SINGLE_CUSTOMER; +``` + diff --git a/doc/models/historic-usage.md b/doc/models/historic-usage.md index b3b7f4dc..06b5d7ac 100644 --- a/doc/models/historic-usage.md +++ b/doc/models/historic-usage.md @@ -1,7 +1,7 @@ # Historic Usage -Optional for Event Based Components. If the `include=historic_usages` query param is provided, the last ten billing periods will be returned. +(Optional) For Event Based Components. If the `include=historic_usages` query param is provided, the last ten billing periods will be returned. ## Structure @@ -15,13 +15,16 @@ Optional for Event Based Components. If the `include=historic_usages` query para | `billingPeriodStartsAt` | `?DateTime` | Optional | Start date of billing period | getBillingPeriodStartsAt(): ?\DateTime | setBillingPeriodStartsAt(?\DateTime billingPeriodStartsAt): void | | `billingPeriodEndsAt` | `?DateTime` | Optional | End date of billing period | getBillingPeriodEndsAt(): ?\DateTime | setBillingPeriodEndsAt(?\DateTime billingPeriodEndsAt): void | -## Example (as JSON) +## Example -```json -{ - "total_usage_quantity": 26.6, - "billing_period_starts_at": "2016-03-13T12:52:32.123Z", - "billing_period_ends_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\HistoricUsageBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$historicUsage = HistoricUsageBuilder::init() + ->totalUsageQuantity(140.74) + ->billingPeriodStartsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->billingPeriodEndsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/include-not-null.md b/doc/models/include-not-null.md index 694ffcf9..b9c968dc 100644 --- a/doc/models/include-not-null.md +++ b/doc/models/include-not-null.md @@ -15,7 +15,9 @@ Passed as a parameter to list methods to return only non null values. ## Example -``` -not_null +```php +use AdvancedBillingLib\Models\IncludeNotNull; + +$includeNotNull = IncludeNotNull::NOT_NULL; ``` diff --git a/doc/models/include-null-or-not-null.md b/doc/models/include-null-or-not-null.md index 5ca912d2..911b272d 100644 --- a/doc/models/include-null-or-not-null.md +++ b/doc/models/include-null-or-not-null.md @@ -16,7 +16,9 @@ Allows to filter by `not_null` or `null`. ## Example -``` -not_null +```php +use AdvancedBillingLib\Models\IncludeNullOrNotNull; + +$includeNullOrNotNull = IncludeNullOrNotNull::NOT_NULL; ``` diff --git a/doc/models/include-option.md b/doc/models/include-option.md index 047dab1d..02027ee0 100644 --- a/doc/models/include-option.md +++ b/doc/models/include-option.md @@ -12,3 +12,11 @@ | `EXCLUDE` | | `INCLUDE_` | +## Example + +```php +use AdvancedBillingLib\Models\IncludeOption; + +$includeOption = IncludeOption::EXCLUDE; +``` + diff --git a/doc/models/interval-unit.md b/doc/models/interval-unit.md index 7e4cab3b..7343cc1f 100644 --- a/doc/models/interval-unit.md +++ b/doc/models/interval-unit.md @@ -12,3 +12,11 @@ | `DAY` | | `MONTH` | +## Example + +```php +use AdvancedBillingLib\Models\IntervalUnit; + +$intervalUnit = IntervalUnit::DAY; +``` + diff --git a/doc/models/invoice-address.md b/doc/models/invoice-address.md index 093fa59f..1a8a9610 100644 --- a/doc/models/invoice-address.md +++ b/doc/models/invoice-address.md @@ -16,15 +16,17 @@ | `zip` | `?string` | Optional | - | getZip(): ?string | setZip(?string zip): void | | `country` | `?string` | Optional | - | getCountry(): ?string | setCountry(?string country): void | -## Example (as JSON) - -```json -{ - "street": "street0", - "line2": "line24", - "city": "city0", - "state": "state6", - "zip": "zip4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceAddressBuilder; + +$invoiceAddress = InvoiceAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city2') + ->state('state8') + ->zip('zip6') + ->build(); ``` diff --git a/doc/models/invoice-avatax-details.md b/doc/models/invoice-avatax-details.md index 6656277e..6234d3cf 100644 --- a/doc/models/invoice-avatax-details.md +++ b/doc/models/invoice-avatax-details.md @@ -15,15 +15,18 @@ | `commitDate` | `?DateTime` | Optional | - | getCommitDate(): ?\DateTime | setCommitDate(?\DateTime commitDate): void | | `modifyDate` | `?DateTime` | Optional | - | getModifyDate(): ?\DateTime | setModifyDate(?\DateTime modifyDate): void | -## Example (as JSON) - -```json -{ - "id": 112, - "status": "status2", - "document_code": "document_code0", - "commit_date": "2016-03-13T12:52:32.123Z", - "modify_date": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceAvataxDetailsBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$invoiceAvataxDetails = InvoiceAvataxDetailsBuilder::init() + ->id(184) + ->status('status2') + ->documentCode('document_code4') + ->commitDate(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->modifyDate(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/invoice-balance-item.md b/doc/models/invoice-balance-item.md index 0f61d06b..4c2346df 100644 --- a/doc/models/invoice-balance-item.md +++ b/doc/models/invoice-balance-item.md @@ -13,13 +13,15 @@ | `number` | `?string` | Optional | - | getNumber(): ?string | setNumber(?string number): void | | `outstandingAmount` | `?string` | Optional | - | getOutstandingAmount(): ?string | setOutstandingAmount(?string outstandingAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "number": "number6", - "outstanding_amount": "outstanding_amount6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceBalanceItemBuilder; + +$invoiceBalanceItem = InvoiceBalanceItemBuilder::init() + ->uid('uid8') + ->number('number6') + ->outstandingAmount('outstanding_amount6') + ->build(); ``` diff --git a/doc/models/invoice-consolidation-level.md b/doc/models/invoice-consolidation-level.md index 852ec242..c59a3195 100644 --- a/doc/models/invoice-consolidation-level.md +++ b/doc/models/invoice-consolidation-level.md @@ -1,7 +1,7 @@ # Invoice Consolidation Level -Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values: +Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values: * "none": A normal invoice with no consolidation. * "child": An invoice segment which has been combined into a consolidated invoice. @@ -23,3 +23,11 @@ See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/ | `CHILD` | | `PARENT_` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; + +$invoiceConsolidationLevel = InvoiceConsolidationLevel::NONE; +``` + diff --git a/doc/models/invoice-credit.md b/doc/models/invoice-credit.md index 89500f56..d6c416b2 100644 --- a/doc/models/invoice-credit.md +++ b/doc/models/invoice-credit.md @@ -17,15 +17,18 @@ | `originalAmount` | `?string` | Optional | - | getOriginalAmount(): ?string | setOriginalAmount(?string originalAmount): void | | `appliedAmount` | `?string` | Optional | - | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid6", - "credit_note_number": "credit_note_number0", - "credit_note_uid": "credit_note_uid0", - "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceCreditBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$invoiceCredit = InvoiceCreditBuilder::init() + ->uid('uid8') + ->creditNoteNumber('credit_note_number2') + ->creditNoteUid('credit_note_uid2') + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo2') + ->build(); ``` diff --git a/doc/models/invoice-custom-field.md b/doc/models/invoice-custom-field.md index b1d9243c..e8dcec19 100644 --- a/doc/models/invoice-custom-field.md +++ b/doc/models/invoice-custom-field.md @@ -15,15 +15,18 @@ | `value` | `?string` | Optional | **Constraints**: *Minimum Length*: `1` | getValue(): ?string | setValue(?string value): void | | `metadatumId` | `?int` | Optional | - | getMetadatumId(): ?int | setMetadatumId(?int metadatumId): void | -## Example (as JSON) - -```json -{ - "owner_id": 142, - "owner_type": "Customer", - "name": "name0", - "value": "value2", - "metadatum_id": 142 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceCustomFieldBuilder; +use AdvancedBillingLib\Models\CustomFieldOwner; + +$invoiceCustomField = InvoiceCustomFieldBuilder::init() + ->ownerId(14) + ->ownerType(CustomFieldOwner::CUSTOMER) + ->name('name0') + ->value('value2') + ->metadatumId(14) + ->build(); ``` diff --git a/doc/models/invoice-customer.md b/doc/models/invoice-customer.md index 6a80f641..e413bd33 100644 --- a/doc/models/invoice-customer.md +++ b/doc/models/invoice-customer.md @@ -1,7 +1,7 @@ # Invoice Customer -Information about the customer who is owner or recipient the invoiced subscription. +Information about the customer who is owner or recipient of the invoiced subscription. ## Structure @@ -19,15 +19,17 @@ Information about the customer who is owner or recipient the invoiced subscripti | `vatNumber` | `?string` | Optional | - | getVatNumber(): ?string | setVatNumber(?string vatNumber): void | | `reference` | `?string` | Optional | - | getReference(): ?string | setReference(?string reference): void | -## Example (as JSON) +## Example -```json -{ - "chargify_id": 236, - "first_name": "first_name0", - "last_name": "last_name8", - "organization": "organization4", - "email": "email6" -} +```php +use AdvancedBillingLib\Models\Builders\InvoiceCustomerBuilder; + +$invoiceCustomer = InvoiceCustomerBuilder::init() + ->chargifyId(82) + ->firstName('first_name2') + ->lastName('last_name0') + ->organization('organization6') + ->email('email4') + ->build(); ``` diff --git a/doc/models/invoice-date-field.md b/doc/models/invoice-date-field.md index 05d7f5f1..2b3d5e2d 100644 --- a/doc/models/invoice-date-field.md +++ b/doc/models/invoice-date-field.md @@ -17,7 +17,9 @@ ## Example -``` -issue_date +```php +use AdvancedBillingLib\Models\InvoiceDateField; + +$invoiceDateField = InvoiceDateField::UPDATED_AT; ``` diff --git a/doc/models/invoice-debit.md b/doc/models/invoice-debit.md index 1093d83d..ae50c669 100644 --- a/doc/models/invoice-debit.md +++ b/doc/models/invoice-debit.md @@ -18,15 +18,19 @@ | `originalAmount` | `?string` | Optional | - | getOriginalAmount(): ?string | setOriginalAmount(?string originalAmount): void | | `appliedAmount` | `?string` | Optional | - | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid2", - "debit_note_number": "debit_note_number2", - "debit_note_uid": "debit_note_uid8", - "role": "chargeback", - "transaction_time": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceDebitBuilder; +use AdvancedBillingLib\Models\DebitNoteRole; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$invoiceDebit = InvoiceDebitBuilder::init() + ->uid('uid8') + ->debitNoteNumber('debit_note_number8') + ->debitNoteUid('debit_note_uid4') + ->role(DebitNoteRole::CHARGEBACK) + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/invoice-discount-breakout.md b/doc/models/invoice-discount-breakout.md index 86de51d7..ff6b2e29 100644 --- a/doc/models/invoice-discount-breakout.md +++ b/doc/models/invoice-discount-breakout.md @@ -13,13 +13,15 @@ | `eligibleAmount` | `?string` | Optional | - | getEligibleAmount(): ?string | setEligibleAmount(?string eligibleAmount): void | | `discountAmount` | `?string` | Optional | - | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "eligible_amount": "eligible_amount0", - "discount_amount": "discount_amount8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceDiscountBreakoutBuilder; + +$invoiceDiscountBreakout = InvoiceDiscountBreakoutBuilder::init() + ->uid('uid0') + ->eligibleAmount('eligible_amount2') + ->discountAmount('discount_amount4') + ->build(); ``` diff --git a/doc/models/invoice-discount-source-type.md b/doc/models/invoice-discount-source-type.md index 7218f6c9..572b6766 100644 --- a/doc/models/invoice-discount-source-type.md +++ b/doc/models/invoice-discount-source-type.md @@ -13,3 +13,11 @@ | `REFERRAL` | | `ENUM_AD_HOC_COUPON` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceDiscountSourceType; + +$invoiceDiscountSourceType = InvoiceDiscountSourceType::REFERRAL; +``` + diff --git a/doc/models/invoice-discount-type.md b/doc/models/invoice-discount-type.md index 3e5355b5..cf69d97e 100644 --- a/doc/models/invoice-discount-type.md +++ b/doc/models/invoice-discount-type.md @@ -13,3 +13,11 @@ | `FLAT_AMOUNT` | | `ROLLOVER` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceDiscountType; + +$invoiceDiscountType = InvoiceDiscountType::PERCENTAGE; +``` + diff --git a/doc/models/invoice-discount.md b/doc/models/invoice-discount.md index 77d56f35..e85032a2 100644 --- a/doc/models/invoice-discount.md +++ b/doc/models/invoice-discount.md @@ -22,15 +22,18 @@ | `transactionId` | `?int` | Optional | - | getTransactionId(): ?int | setTransactionId(?int transactionId): void | | `lineItemBreakouts` | [`?(InvoiceDiscountBreakout[])`](../../doc/models/invoice-discount-breakout.md) | Optional | - | getLineItemBreakouts(): ?array | setLineItemBreakouts(?array lineItemBreakouts): void | -## Example (as JSON) - -```json -{ - "uid": "uid0", - "title": "title4", - "description": "description0", - "code": "code8", - "source_type": "Coupon" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceDiscountBuilder; +use AdvancedBillingLib\Models\InvoiceDiscountSourceType; + +$invoiceDiscount = InvoiceDiscountBuilder::init() + ->uid('uid4') + ->title('title0') + ->description('description6') + ->code('code2') + ->sourceType(InvoiceDiscountSourceType::COUPON) + ->build(); ``` diff --git a/doc/models/invoice-display-settings.md b/doc/models/invoice-display-settings.md index c4274fd9..23b54173 100644 --- a/doc/models/invoice-display-settings.md +++ b/doc/models/invoice-display-settings.md @@ -12,12 +12,14 @@ | `hideZeroSubtotalLines` | `?bool` | Optional | - | getHideZeroSubtotalLines(): ?bool | setHideZeroSubtotalLines(?bool hideZeroSubtotalLines): void | | `includeDiscountsOnLines` | `?bool` | Optional | - | getIncludeDiscountsOnLines(): ?bool | setIncludeDiscountsOnLines(?bool includeDiscountsOnLines): void | -## Example (as JSON) +## Example -```json -{ - "hide_zero_subtotal_lines": false, - "include_discounts_on_lines": false -} +```php +use AdvancedBillingLib\Models\Builders\InvoiceDisplaySettingsBuilder; + +$invoiceDisplaySettings = InvoiceDisplaySettingsBuilder::init() + ->hideZeroSubtotalLines(false) + ->includeDiscountsOnLines(false) + ->build(); ``` diff --git a/doc/models/invoice-event-payment-method.md b/doc/models/invoice-event-payment-method.md index 8df097ea..5dad2679 100644 --- a/doc/models/invoice-event-payment-method.md +++ b/doc/models/invoice-event-payment-method.md @@ -15,3 +15,11 @@ | `EXTERNAL` | | `PAYPAL_ACCOUNT` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$invoiceEventPaymentMethod = InvoiceEventPaymentMethod::CREDIT_CARD; +``` + diff --git a/doc/models/invoice-event-type.md b/doc/models/invoice-event-type.md index c6c09926..54b7681a 100644 --- a/doc/models/invoice-event-type.md +++ b/doc/models/invoice-event-type.md @@ -27,3 +27,11 @@ Invoice Event Type | `FAILED_PAYMENT` | | `CHANGE_CHARGEBACK_STATUS` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceEventType; + +$invoiceEventType = InvoiceEventType::CREATE_CREDIT_NOTE; +``` + diff --git a/doc/models/invoice-issued.md b/doc/models/invoice-issued.md index 19c23630..d1edae45 100644 --- a/doc/models/invoice-issued.md +++ b/doc/models/invoice-issued.md @@ -25,33 +25,38 @@ | `consolidationLevel` | `string` | Required | - | getConsolidationLevel(): string | setConsolidationLevel(string consolidationLevel): void | | `lineItems` | [`InvoiceLineItemEventData[]`](../../doc/models/invoice-line-item-event-data.md) | Required | - | getLineItems(): array | setLineItems(array lineItems): void | -## Example (as JSON) - -```json -{ - "uid": "uid4", - "number": "number8", - "role": "role2", - "due_date": "2016-03-13", - "issue_date": "issue_date0", - "paid_date": "paid_date6", - "due_amount": "due_amount6", - "paid_amount": "paid_amount4", - "tax_amount": "tax_amount2", - "refund_amount": "refund_amount0", - "total_amount": "total_amount0", - "status_amount": "status_amount4", - "product_name": "product_name0", - "consolidation_level": "consolidation_level4", - "line_items": [ - { - "uid": "uid8", - "title": "title4", - "description": "description8", - "quantity": 102, - "quantity_delta": 204 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceIssuedBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceLineItemEventDataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$invoiceIssued = InvoiceIssuedBuilder::init( + 'uid8', + 'number4', + 'role8', + 'issue_date4', + 'paid_date8', + 'due_amount0', + 'paid_amount0', + 'tax_amount8', + 'refund_amount6', + 'total_amount4', + 'status_amount8', + 'product_name4', + 'consolidation_level0', + [ + InvoiceLineItemEventDataBuilder::init() + ->uid('uid8') + ->title('title4') + ->description('description8') + ->quantity(102) + ->quantityDelta(204) + ->build() + ] +) + ->dueDate(DateTimeHelper::fromSimpleDate('2016-03-13')) + ->build(); ``` diff --git a/doc/models/invoice-line-item-component-cost-data.md b/doc/models/invoice-line-item-component-cost-data.md index f2c3db61..6e2d9e10 100644 --- a/doc/models/invoice-line-item-component-cost-data.md +++ b/doc/models/invoice-line-item-component-cost-data.md @@ -11,33 +11,31 @@ | --- | --- | --- | --- | --- | --- | | `rates` | [`?(ComponentCostData[])`](../../doc/models/component-cost-data.md) | Optional | - | getRates(): ?array | setRates(?array rates): void | -## Example (as JSON) - -```json -{ - "rates": [ - { - "component_code_id": 116, - "price_point_id": 226, - "product_id": 94, - "quantity": "quantity0", - "amount": "amount6" - }, - { - "component_code_id": 116, - "price_point_id": 226, - "product_id": 94, - "quantity": "quantity0", - "amount": "amount6" - }, - { - "component_code_id": 116, - "price_point_id": 226, - "product_id": 94, - "quantity": "quantity0", - "amount": "amount6" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceLineItemComponentCostDataBuilder; +use AdvancedBillingLib\Models\Builders\ComponentCostDataBuilder; + +$invoiceLineItemComponentCostData = InvoiceLineItemComponentCostDataBuilder::init() + ->rates( + [ + ComponentCostDataBuilder::init() + ->componentCodeId(116) + ->pricePointId(226) + ->productId(94) + ->quantity('quantity0') + ->amount('amount6') + ->build(), + ComponentCostDataBuilder::init() + ->componentCodeId(116) + ->pricePointId(226) + ->productId(94) + ->quantity('quantity0') + ->amount('amount6') + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/invoice-line-item-event-data.md b/doc/models/invoice-line-item-event-data.md index a58a3c43..c9f524fe 100644 --- a/doc/models/invoice-line-item-event-data.md +++ b/doc/models/invoice-line-item-event-data.md @@ -30,15 +30,17 @@ | `billingScheduleItemId` | `?int` | Optional | - | getBillingScheduleItemId(): ?int | setBillingScheduleItemId(?int billingScheduleItemId): void | | `customItem` | `?bool` | Optional | - | getCustomItem(): ?bool | setCustomItem(?bool customItem): void | -## Example (as JSON) - -```json -{ - "uid": "uid4", - "title": "title0", - "description": "description6", - "quantity": 40, - "quantity_delta": 114 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceLineItemEventDataBuilder; + +$invoiceLineItemEventData = InvoiceLineItemEventDataBuilder::init() + ->uid('uid4') + ->title('title0') + ->description('description4') + ->quantity(190) + ->quantityDelta(36) + ->build(); ``` diff --git a/doc/models/invoice-line-item-pricing-detail.md b/doc/models/invoice-line-item-pricing-detail.md index 11c308cb..5a38b7ac 100644 --- a/doc/models/invoice-line-item-pricing-detail.md +++ b/doc/models/invoice-line-item-pricing-detail.md @@ -12,12 +12,14 @@ | `label` | `?string` | Optional | - | getLabel(): ?string | setLabel(?string label): void | | `amount` | `?string` | Optional | - | getAmount(): ?string | setAmount(?string amount): void | -## Example (as JSON) +## Example -```json -{ - "label": "label0", - "amount": "amount2" -} +```php +use AdvancedBillingLib\Models\Builders\InvoiceLineItemPricingDetailBuilder; + +$invoiceLineItemPricingDetail = InvoiceLineItemPricingDetailBuilder::init() + ->label('label4') + ->amount('amount6') + ->build(); ``` diff --git a/doc/models/invoice-line-item.md b/doc/models/invoice-line-item.md index 0ebb7fe5..658026cc 100644 --- a/doc/models/invoice-line-item.md +++ b/doc/models/invoice-line-item.md @@ -9,19 +9,19 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `uid` | `?string` | Optional | Unique identifier for the line item. Useful when cross-referencing the line against individual discounts in the `discounts` or `taxes` lists. | getUid(): ?string | setUid(?string uid): void | +| `uid` | `?string` | Optional | Unique identifier for the line item. Useful when cross-referencing the line against individual discounts in the `discounts` or `taxes` lists. | getUid(): ?string | setUid(?string uid): void | | `title` | `?string` | Optional | A short descriptor for the charge or item represented by this line. | getTitle(): ?string | setTitle(?string title): void | -| `description` | `?string` | Optional | Detailed description for the charge or item represented by this line. May include proration details in plain text.

Note: this string may contain line breaks that are hints for the best display format on the invoice. | getDescription(): ?string | setDescription(?string description): void | +| `description` | `?string` | Optional | Detailed description for the charge or item represented by this line. May include proration details in plain text.

Note: this string may contain line breaks that are hints for the best display format on the invoice. | getDescription(): ?string | setDescription(?string description): void | | `quantity` | `?string` | Optional | The quantity or count of units billed by the line item.

This is a decimal number represented as a string. (See "About Decimal Numbers".) | getQuantity(): ?string | setQuantity(?string quantity): void | -| `unitPrice` | `?string` | Optional | The price per unit for the line item.

When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. | getUnitPrice(): ?string | setUnitPrice(?string unitPrice): void | +| `unitPrice` | `?string` | Optional | The price per unit for the line item.

When tiered pricing was used (i.e., not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. | getUnitPrice(): ?string | setUnitPrice(?string unitPrice): void | | `subtotalAmount` | `?string` | Optional | The line subtotal, generally calculated as `quantity * unit_price`. This is the canonical amount of record for the line - when rounding differences are in play, `subtotal_amount` takes precedence over the value derived from `quantity * unit_price` (which may not have the proper precision to exactly equal this amount). | getSubtotalAmount(): ?string | setSubtotalAmount(?string subtotalAmount): void | | `discountAmount` | `?string` | Optional | The approximate discount applied to just this line.

The value is approximated in cases where rounding errors make it difficult to apportion exactly a total discount among many lines. Several lines may have been summed prior to applying the discount to arrive at `discount_amount` for the invoice - backing that out to the discount on a single line may introduce rounding or precision errors. | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | | `taxAmount` | `?string` | Optional | The approximate tax applied to just this line.

The value is approximated in cases where rounding errors make it difficult to apportion exactly a total tax among many lines. Several lines may have been summed prior to applying the tax rate to arrive at `tax_amount` for the invoice - backing that out to the tax on a single line may introduce rounding or precision errors. | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | | `taxIncluded` | `?bool` | Optional | Whether the unit price for this line item is tax-inclusive.

When `true`, `unit_price` already includes tax and `tax_amount` represents the portion of the price attributable to tax. When `false`, any applicable tax is added on top of the price.

The value is inherited from the source price point's `tax_included` setting. Custom or ad-hoc line items (which have no associated price point) always return `false`. | getTaxIncluded(): ?bool | setTaxIncluded(?bool taxIncluded): void | -| `totalAmount` | `?string` | Optional | The non-canonical total amount for the line.

`subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to rounding or precision errors, the sum of line `total_amount`s may not equal the invoice `total_amount`. | getTotalAmount(): ?string | setTotalAmount(?string totalAmount): void | +| `totalAmount` | `?string` | Optional | The non-canonical total amount for the line.

`subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to rounding or precision errors, the sum of line `total_amount`s may not equal the invoice `total_amount`. | getTotalAmount(): ?string | setTotalAmount(?string totalAmount): void | | `tieredUnitPrice` | `?bool` | Optional | When `true`, indicates that the actual pricing scheme for the line was tiered, so the `unit_price` shown is the blended average for all units. | getTieredUnitPrice(): ?bool | setTieredUnitPrice(?bool tieredUnitPrice): void | -| `periodRangeStart` | `?DateTime` | Optional | Start date for the period covered by this line. The format is `"YYYY-MM-DD"`.

* For periodic charges paid in advance, this date will match the billing date, and the end date will be in the future.
* For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the previous billing, and the end date will be the current billing date.
* For non-periodic charges, this date and the end date will match. | getPeriodRangeStart(): ?\DateTime | setPeriodRangeStart(?\DateTime periodRangeStart): void | -| `periodRangeEnd` | `?DateTime` | Optional | End date for the period covered by this line. The format is `"YYYY-MM-DD"`.

* For periodic charges paid in advance, this date will match the next (future) billing date.
* For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the current billing date.
* For non-periodic charges, this date and the start date will match. | getPeriodRangeEnd(): ?\DateTime | setPeriodRangeEnd(?\DateTime periodRangeEnd): void | +| `periodRangeStart` | `?DateTime` | Optional | Start date for the period covered by this line. The format is `"YYYY-MM-DD"`.

* For periodic charges paid in advance, this date will match the billing date, and the end date will be in the future.
* For periodic charges paid in arrears (e.g., metered charges), this date will be the date of the previous billing, and the end date will be the current billing date.
* For non-periodic charges, this date and the end date will match. | getPeriodRangeStart(): ?\DateTime | setPeriodRangeStart(?\DateTime periodRangeStart): void | +| `periodRangeEnd` | `?DateTime` | Optional | End date for the period covered by this line. The format is `"YYYY-MM-DD"`.

* For periodic charges paid in advance, this date will match the next (future) billing date.
* For periodic charges paid in arrears (e.g., metered charges), this date will be the date of the current billing date.
* For non-periodic charges, this date and the start date will match. | getPeriodRangeEnd(): ?\DateTime | setPeriodRangeEnd(?\DateTime periodRangeEnd): void | | `transactionId` | `?int` | Optional | - | getTransactionId(): ?int | setTransactionId(?int transactionId): void | | `productId` | `?int` | Optional | The ID of the product subscribed when the charge was made.

This may be set even for component charges, so true product-only (non-component) charges will also have a nil `component_id`. | getProductId(): ?int | setProductId(?int productId): void | | `productVersion` | `?int` | Optional | The version of the product subscribed when the charge was made. | getProductVersion(): ?int | setProductVersion(?int productVersion): void | @@ -35,15 +35,17 @@ | `kind` | `?string` | Optional | - | getKind(): ?string | setKind(?string kind): void | | `prepaidAllocationExpiresAt` | `?DateTime` | Optional | The date a prepaid allocation is set to expire. Only present on line items representing prepaid component allocations. The format is `"YYYY-MM-DD"`. | getPrepaidAllocationExpiresAt(): ?\DateTime | setPrepaidAllocationExpiresAt(?\DateTime prepaidAllocationExpiresAt): void | -## Example (as JSON) +## Example -```json -{ - "uid": "uid4", - "title": "title0", - "description": "description4", - "quantity": "quantity0", - "unit_price": "unit_price2" -} +```php +use AdvancedBillingLib\Models\Builders\InvoiceLineItemBuilder; + +$invoiceLineItem = InvoiceLineItemBuilder::init() + ->uid('uid6') + ->title('title2') + ->description('description6') + ->quantity('quantity2') + ->unitPrice('unit_price4') + ->build(); ``` diff --git a/doc/models/invoice-payer-change.md b/doc/models/invoice-payer-change.md index 304ec017..d43c9648 100644 --- a/doc/models/invoice-payer-change.md +++ b/doc/models/invoice-payer-change.md @@ -14,14 +14,16 @@ | `organization` | `?string` | Optional | - | getOrganization(): ?string | setOrganization(?string organization): void | | `email` | `?string` | Optional | - | getEmail(): ?string | setEmail(?string email): void | -## Example (as JSON) - -```json -{ - "first_name": "first_name2", - "last_name": "last_name0", - "organization": "organization4", - "email": "email4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePayerChangeBuilder; + +$invoicePayerChange = InvoicePayerChangeBuilder::init() + ->firstName('first_name4') + ->lastName('last_name2') + ->organization('organization2') + ->email('email2') + ->build(); ``` diff --git a/doc/models/invoice-payer.md b/doc/models/invoice-payer.md index fe4cb259..3650545b 100644 --- a/doc/models/invoice-payer.md +++ b/doc/models/invoice-payer.md @@ -16,15 +16,17 @@ | `email` | `?string` | Optional | - | getEmail(): ?string | setEmail(?string email): void | | `vatNumber` | `?string` | Optional | - | getVatNumber(): ?string | setVatNumber(?string vatNumber): void | -## Example (as JSON) - -```json -{ - "chargify_id": 46, - "first_name": "first_name4", - "last_name": "last_name2", - "organization": "organization8", - "email": "email2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePayerBuilder; + +$invoicePayer = InvoicePayerBuilder::init() + ->chargifyId(198) + ->firstName('first_name2') + ->lastName('last_name0') + ->organization('organization4') + ->email('email4') + ->build(); ``` diff --git a/doc/models/invoice-payment-application.md b/doc/models/invoice-payment-application.md index 3d216c04..d90b9d59 100644 --- a/doc/models/invoice-payment-application.md +++ b/doc/models/invoice-payment-application.md @@ -13,13 +13,15 @@ | `applicationUid` | `?string` | Optional | Unique identifier for the payment. It has the prefix "pmt_" followed by alphanumeric characters. | getApplicationUid(): ?string | setApplicationUid(?string applicationUid): void | | `appliedAmount` | `?string` | Optional | Dollar amount of the paid invoice. | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | -## Example (as JSON) - -```json -{ - "invoice_uid": "invoice_uid2", - "application_uid": "application_uid4", - "applied_amount": "applied_amount6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePaymentApplicationBuilder; + +$invoicePaymentApplication = InvoicePaymentApplicationBuilder::init() + ->invoiceUid('invoice_uid8') + ->applicationUid('application_uid8') + ->appliedAmount('applied_amount0') + ->build(); ``` diff --git a/doc/models/invoice-payment-method-type.md b/doc/models/invoice-payment-method-type.md index a920712d..334f82fa 100644 --- a/doc/models/invoice-payment-method-type.md +++ b/doc/models/invoice-payment-method-type.md @@ -18,3 +18,11 @@ The type of payment method used. Defaults to other. | `ACH` | | `OTHER` | +## Example + +```php +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$invoicePaymentMethodType = InvoicePaymentMethodType::CASH; +``` + diff --git a/doc/models/invoice-payment-method.md b/doc/models/invoice-payment-method.md index 500d8e3e..f6a0ce2e 100644 --- a/doc/models/invoice-payment-method.md +++ b/doc/models/invoice-payment-method.md @@ -18,15 +18,17 @@ | `lastFour` | `?string` | Optional | - | getLastFour(): ?string | setLastFour(?string lastFour): void | | `maskedCardNumber` | `?string` | Optional | - | getMaskedCardNumber(): ?string | setMaskedCardNumber(?string maskedCardNumber): void | -## Example (as JSON) - -```json -{ - "details": "details8", - "kind": "kind6", - "memo": "memo2", - "type": "type8", - "card_brand": "card_brand8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePaymentMethodBuilder; + +$invoicePaymentMethod = InvoicePaymentMethodBuilder::init() + ->details('details2') + ->kind('kind0') + ->memo('memo6') + ->type('type8') + ->cardBrand('card_brand4') + ->build(); ``` diff --git a/doc/models/invoice-payment-type.md b/doc/models/invoice-payment-type.md index 8283fc2f..b01cfb2f 100644 --- a/doc/models/invoice-payment-type.md +++ b/doc/models/invoice-payment-type.md @@ -16,3 +16,11 @@ The type of payment to be applied to an Invoice. Defaults to external. | `SERVICE_CREDIT` | | `PAYMENT` | +## Example + +```php +use AdvancedBillingLib\Models\InvoicePaymentType; + +$invoicePaymentType = InvoicePaymentType::EXTERNAL; +``` + diff --git a/doc/models/invoice-payment.md b/doc/models/invoice-payment.md index 22122ebe..46a1876b 100644 --- a/doc/models/invoice-payment.md +++ b/doc/models/invoice-payment.md @@ -22,21 +22,27 @@ | `receivedOn` | `?DateTime` | Optional | Date reflecting when the payment was received from a customer. Must be in the past. Applicable only to
`external` payments. | getReceivedOn(): ?\DateTime | setReceivedOn(?\DateTime receivedOn): void | | `uid` | `?string` | Optional | - | getUid(): ?string | setUid(?string uid): void | -## Example (as JSON) - -```json -{ - "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo6", - "original_amount": "original_amount6", - "applied_amount": "applied_amount6", - "payment_method": { - "details": "details0", - "kind": "kind8", - "memo": "memo4", - "type": "type0", - "card_brand": "card_brand6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePaymentBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoicePaymentMethodBuilder; + +$invoicePayment = InvoicePaymentBuilder::init() + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo6') + ->originalAmount('original_amount6') + ->appliedAmount('applied_amount6') + ->paymentMethod( + InvoicePaymentMethodBuilder::init() + ->details('details0') + ->kind('kind8') + ->memo('memo4') + ->type('type0') + ->cardBrand('card_brand6') + ->build() + ) + ->build(); ``` diff --git a/doc/models/invoice-pre-payment.md b/doc/models/invoice-pre-payment.md index f56b81b8..a92688cf 100644 --- a/doc/models/invoice-pre-payment.md +++ b/doc/models/invoice-pre-payment.md @@ -13,13 +13,15 @@ | `amountInCents` | `?int` | Optional | The amount in cents of the prepayment that was created as a result of this payment. | getAmountInCents(): ?int | setAmountInCents(?int amountInCents): void | | `endingBalanceInCents` | `?int` | Optional | The total balance of the prepayment account for this subscription including any prior prepayments | getEndingBalanceInCents(): ?int | setEndingBalanceInCents(?int endingBalanceInCents): void | -## Example (as JSON) - -```json -{ - "subscription_id": 180, - "amount_in_cents": 100, - "ending_balance_in_cents": 60 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePrePaymentBuilder; + +$invoicePrePayment = InvoicePrePaymentBuilder::init() + ->subscriptionId(252) + ->amountInCents(28) + ->endingBalanceInCents(244) + ->build(); ``` diff --git a/doc/models/invoice-previous-balance.md b/doc/models/invoice-previous-balance.md index 1f2bfc70..ef4bc1a3 100644 --- a/doc/models/invoice-previous-balance.md +++ b/doc/models/invoice-previous-balance.md @@ -12,18 +12,34 @@ | `capturedAt` | `?DateTime` | Optional | - | getCapturedAt(): ?\DateTime | setCapturedAt(?\DateTime capturedAt): void | | `invoices` | [`?(InvoiceBalanceItem[])`](../../doc/models/invoice-balance-item.md) | Optional | - | getInvoices(): ?array | setInvoices(?array invoices): void | -## Example (as JSON) - -```json -{ - "captured_at": "2016-03-13T12:52:32.123Z", - "invoices": [ - { - "uid": "uid6", - "number": "number6", - "outstanding_amount": "outstanding_amount8" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoicePreviousBalanceBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBalanceItemBuilder; + +$invoicePreviousBalance = InvoicePreviousBalanceBuilder::init() + ->capturedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->invoices( + [ + InvoiceBalanceItemBuilder::init() + ->uid('uid6') + ->number('number6') + ->outstandingAmount('outstanding_amount8') + ->build(), + InvoiceBalanceItemBuilder::init() + ->uid('uid6') + ->number('number6') + ->outstandingAmount('outstanding_amount8') + ->build(), + InvoiceBalanceItemBuilder::init() + ->uid('uid6') + ->number('number6') + ->outstandingAmount('outstanding_amount8') + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/invoice-refund.md b/doc/models/invoice-refund.md index c9e7bc4b..3e770f12 100644 --- a/doc/models/invoice-refund.md +++ b/doc/models/invoice-refund.md @@ -19,15 +19,17 @@ | `gatewayHandle` | `?string` | Optional | - | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | | `achLateReject` | `?bool` | Optional | - | getAchLateReject(): ?bool | setAchLateReject(?bool achLateReject): void | -## Example (as JSON) - -```json -{ - "transaction_id": 172, - "payment_id": 42, - "memo": "memo6", - "original_amount": "original_amount6", - "applied_amount": "applied_amount6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceRefundBuilder; + +$invoiceRefund = InvoiceRefundBuilder::init() + ->transactionId(166) + ->paymentId(36) + ->memo('memo6') + ->originalAmount('original_amount6') + ->appliedAmount('applied_amount6') + ->build(); ``` diff --git a/doc/models/invoice-response.md b/doc/models/invoice-response.md index 8de5e0aa..43d955c7 100644 --- a/doc/models/invoice-response.md +++ b/doc/models/invoice-response.md @@ -11,21 +11,25 @@ | --- | --- | --- | --- | --- | --- | | `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - | getInvoice(): Invoice | setInvoice(Invoice invoice): void | -## Example (as JSON) - -```json -{ - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceResponseBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$invoiceResponse = InvoiceResponseBuilder::init( + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build() +)->build(); ``` diff --git a/doc/models/invoice-role.md b/doc/models/invoice-role.md index c40d4a0f..824d8cc5 100644 --- a/doc/models/invoice-role.md +++ b/doc/models/invoice-role.md @@ -20,3 +20,11 @@ | `BACKPORT` | | `BACKPORTBALANCERECONCILIATION` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceRole; + +$invoiceRole = InvoiceRole::RENEWAL; +``` + diff --git a/doc/models/invoice-seller.md b/doc/models/invoice-seller.md index 5d79dfdd..341196cc 100644 --- a/doc/models/invoice-seller.md +++ b/doc/models/invoice-seller.md @@ -16,20 +16,25 @@ Information about the seller (merchant) listed on the masthead of the invoice. | `phone` | `?string` | Optional | - | getPhone(): ?string | setPhone(?string phone): void | | `logoUrl` | `?string` | Optional | - | getLogoUrl(): ?string | setLogoUrl(?string logoUrl): void | -## Example (as JSON) - -```json -{ - "name": "name0", - "address": { - "street": "street6", - "line2": "line20", - "city": "city6", - "state": "state2", - "zip": "zip0" - }, - "phone": "phone0", - "logo_url": "logo_url0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceSellerBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceAddressBuilder; + +$invoiceSeller = InvoiceSellerBuilder::init() + ->name('name4') + ->address( + InvoiceAddressBuilder::init() + ->street('street6') + ->line2('line20') + ->city('city6') + ->state('state2') + ->zip('zip0') + ->build() + ) + ->phone('phone6') + ->logoUrl('logo_url6') + ->build(); ``` diff --git a/doc/models/invoice-sort-field.md b/doc/models/invoice-sort-field.md index 83fcdee2..c341fce2 100644 --- a/doc/models/invoice-sort-field.md +++ b/doc/models/invoice-sort-field.md @@ -20,7 +20,9 @@ ## Example -``` -total_amount +```php +use AdvancedBillingLib\Models\InvoiceSortField; + +$invoiceSortField = InvoiceSortField::UPDATED_AT; ``` diff --git a/doc/models/invoice-status.md b/doc/models/invoice-status.md index 87ba0765..306a7cd1 100644 --- a/doc/models/invoice-status.md +++ b/doc/models/invoice-status.md @@ -19,3 +19,11 @@ The current status of the invoice. See [Invoice Statuses](https://maxio.zendesk. | `CANCELED` | | `PROCESSING` | +## Example + +```php +use AdvancedBillingLib\Models\InvoiceStatus; + +$invoiceStatus = InvoiceStatus::PAID; +``` + diff --git a/doc/models/invoice-tax-breakout.md b/doc/models/invoice-tax-breakout.md index efac2a7b..234cae87 100644 --- a/doc/models/invoice-tax-breakout.md +++ b/doc/models/invoice-tax-breakout.md @@ -14,14 +14,16 @@ | `taxAmount` | `?string` | Optional | - | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | | `taxExemptAmount` | `?string` | Optional | - | getTaxExemptAmount(): ?string | setTaxExemptAmount(?string taxExemptAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid2", - "taxable_amount": "taxable_amount6", - "tax_amount": "tax_amount6", - "tax_exempt_amount": "tax_exempt_amount2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceTaxBreakoutBuilder; + +$invoiceTaxBreakout = InvoiceTaxBreakoutBuilder::init() + ->uid('uid4') + ->taxableAmount('taxable_amount8') + ->taxAmount('tax_amount2') + ->taxExemptAmount('tax_exempt_amount4') + ->build(); ``` diff --git a/doc/models/invoice-tax-component-breakout.md b/doc/models/invoice-tax-component-breakout.md index e84e5625..16d3271e 100644 --- a/doc/models/invoice-tax-component-breakout.md +++ b/doc/models/invoice-tax-component-breakout.md @@ -24,15 +24,17 @@ | `stateAssignedNo` | `?string` | Optional | - | getStateAssignedNo(): ?string | setStateAssignedNo(?string stateAssignedNo): void | | `taxSubType` | `?string` | Optional | - | getTaxSubType(): ?string | setTaxSubType(?string taxSubType): void | -## Example (as JSON) - -```json -{ - "tax_rule_id": 226, - "percentage": "percentage0", - "country_code": "country_code8", - "subdivision_code": "subdivision_code6", - "tax_amount": "tax_amount4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceTaxComponentBreakoutBuilder; + +$invoiceTaxComponentBreakout = InvoiceTaxComponentBreakoutBuilder::init() + ->taxRuleId(66) + ->percentage('percentage0') + ->countryCode('country_code2') + ->subdivisionCode('subdivision_code6') + ->taxAmount('tax_amount4') + ->build(); ``` diff --git a/doc/models/invoice-tax.md b/doc/models/invoice-tax.md index 22c11c9d..7f13c078 100644 --- a/doc/models/invoice-tax.md +++ b/doc/models/invoice-tax.md @@ -24,15 +24,18 @@ | `type` | `?string` | Optional | - | getType(): ?string | setType(?string type): void | | `taxExemptAmount` | `?string` | Optional | - | getTaxExemptAmount(): ?string | setTaxExemptAmount(?string taxExemptAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "title": "title6", - "description": "description2", - "source_type": "Tax", - "source_id": 164 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\InvoiceTaxBuilder; +use AdvancedBillingLib\Models\ProformaInvoiceTaxSourceType; + +$invoiceTax = InvoiceTaxBuilder::init() + ->uid('uid2') + ->title('title8') + ->description('description2') + ->sourceType(ProformaInvoiceTaxSourceType::TAX) + ->sourceId(86) + ->build(); ``` diff --git a/doc/models/invoice.md b/doc/models/invoice.md index ebc0d9d3..b0e0a21a 100644 --- a/doc/models/invoice.md +++ b/doc/models/invoice.md @@ -15,11 +15,11 @@ | `customerId` | `?int` | Optional | ID of the customer to which the invoice belongs. | getCustomerId(): ?int | setCustomerId(?int customerId): void | | `subscriptionId` | `?int` | Optional | ID of the subscription that generated the invoice. | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `number` | `?string` | Optional | A unique, identifying string that appears on the invoice and in places the invoice is referenced.

While the UID is long and not appropriate to show to customers, the number is usually shorter and consumable by the customer and the merchant alike. | getNumber(): ?string | setNumber(?string number): void | -| `sequenceNumber` | `?int` | Optional | A monotonically increasing number assigned to invoices as they are created. This number is unique within a site and can be used to sort and order invoices. | getSequenceNumber(): ?int | setSequenceNumber(?int sequenceNumber): void | +| `sequenceNumber` | `?int` | Optional | A monotonically increasing number assigned to invoices as they are created. This number is unique within a site and can be used to sort and order invoices. | getSequenceNumber(): ?int | setSequenceNumber(?int sequenceNumber): void | | `transactionTime` | `?DateTime` | Optional | - | getTransactionTime(): ?\DateTime | setTransactionTime(?\DateTime transactionTime): void | | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -| `issueDate` | `?DateTime` | Optional | Date the invoice was issued to the customer. This is the date that the invoice was made available for payment.

The format is `"YYYY-MM-DD"`. | getIssueDate(): ?\DateTime | setIssueDate(?\DateTime issueDate): void | +| `issueDate` | `?DateTime` | Optional | Date the invoice was issued to the customer. This is the date that the invoice was made available for payment.

The format is `"YYYY-MM-DD"`. | getIssueDate(): ?\DateTime | setIssueDate(?\DateTime issueDate): void | | `dueDate` | `?DateTime` | Optional | Date the invoice is due.

The format is `"YYYY-MM-DD"`. | getDueDate(): ?\DateTime | setDueDate(?\DateTime dueDate): void | | `paidDate` | `?DateTime` | Optional | Date the invoice became fully paid.

If partial payments are applied to the invoice, this date will not be present until payment has been made in full.

The format is `"YYYY-MM-DD"`. | getPaidDate(): ?\DateTime | setPaidDate(?\DateTime paidDate): void | | `status` | [`?string(InvoiceStatus)`](../../doc/models/invoice-status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview#invoice-statuses) for more. | getStatus(): ?string | setStatus(?string status): void | @@ -28,7 +28,7 @@ | `collectionMethod` | [`?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`. | getCollectionMethod(): ?string | setCollectionMethod(?string collectionMethod): void | | `paymentInstructions` | `?string` | Optional | A message that is printed on the invoice when it is marked for remittance collection. It is intended to describe to the customer how they may make payment, and is configured by the merchant. | getPaymentInstructions(): ?string | setPaymentInstructions(?string paymentInstructions): void | | `currency` | `?string` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | getCurrency(): ?string | setCurrency(?string currency): void | -| `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | +| `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | | `parentInvoiceUid` | `?string` | Optional | For invoices with `consolidation_level` of `child`, this specifies the UID of the parent (consolidated) invoice. | getParentInvoiceUid(): ?string | setParentInvoiceUid(?string parentInvoiceUid): void | | `subscriptionGroupId` | `?int` | Optional | - | getSubscriptionGroupId(): ?int | setSubscriptionGroupId(?int subscriptionGroupId): void | | `parentInvoiceNumber` | `?int` | Optional | For invoices with `consolidation_level` of `child`, this specifies the number of the parent (consolidated) invoice. | getParentInvoiceNumber(): ?int | setParentInvoiceNumber(?int parentInvoiceNumber): void | @@ -36,17 +36,17 @@ | `productName` | `?string` | Optional | The name of the product subscribed when the invoice was generated. | getProductName(): ?string | setProductName(?string productName): void | | `productFamilyName` | `?string` | Optional | The name of the product family subscribed when the invoice was generated. | getProductFamilyName(): ?string | setProductFamilyName(?string productFamilyName): void | | `seller` | [`?InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the invoice. | getSeller(): ?InvoiceSeller | setSeller(?InvoiceSeller seller): void | -| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the invoiced subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | +| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient of the invoiced subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | | `payer` | [`?InvoicePayer`](../../doc/models/invoice-payer.md) | Optional | - | getPayer(): ?InvoicePayer | setPayer(?InvoicePayer payer): void | | `recipientEmails` | `?(string[])` | Optional | **Constraints**: *Maximum Items*: `5` | getRecipientEmails(): ?array | setRecipientEmails(?array recipientEmails): void | | `netTerms` | `?int` | Optional | - | getNetTerms(): ?int | setNetTerms(?int netTerms): void | -| `memo` | `?string` | Optional | The memo printed on invoices of any collection type. This message is in control of the merchant. | getMemo(): ?string | setMemo(?string memo): void | +| `memo` | `?string` | Optional | The memo printed on invoices of any collection type. This message is in control of the merchant. | getMemo(): ?string | setMemo(?string memo): void | | `billingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The invoice billing address. | getBillingAddress(): ?InvoiceAddress | setBillingAddress(?InvoiceAddress billingAddress): void | | `shippingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | The invoice shipping address. | getShippingAddress(): ?InvoiceAddress | setShippingAddress(?InvoiceAddress shippingAddress): void | | `subtotalAmount` | `?string` | Optional | Subtotal of the invoice, which is the sum of all line items before discounts or taxes. | getSubtotalAmount(): ?string | setSubtotalAmount(?string subtotalAmount): void | | `discountAmount` | `?string` | Optional | Total discount applied to the invoice. | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | | `taxAmount` | `?string` | Optional | Total tax on the invoice. | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | -| `totalAmount` | `?string` | Optional | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.' | getTotalAmount(): ?string | setTotalAmount(?string totalAmount): void | +| `totalAmount` | `?string` | Optional | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`. | getTotalAmount(): ?string | setTotalAmount(?string totalAmount): void | | `creditAmount` | `?string` | Optional | The amount of credit (from credit notes) applied to this invoice.

Credits offset the amount due from the customer. | getCreditAmount(): ?string | setCreditAmount(?string creditAmount): void | | `debitAmount` | `?string` | Optional | - | getDebitAmount(): ?string | setDebitAmount(?string debitAmount): void | | `refundAmount` | `?string` | Optional | - | getRefundAmount(): ?string | setRefundAmount(?string refundAmount): void | @@ -65,20 +65,24 @@ | `publicUrl` | `?string` | Optional | The public URL of the invoice | getPublicUrl(): ?string | setPublicUrl(?string publicUrl): void | | `previousBalanceData` | [`?InvoicePreviousBalance`](../../doc/models/invoice-previous-balance.md) | Optional | - | getPreviousBalanceData(): ?InvoicePreviousBalance | setPreviousBalanceData(?InvoicePreviousBalance previousBalanceData): void | | `publicUrlExpiresOn` | `?DateTime` | Optional | The format is `"YYYY-MM-DD"`. | getPublicUrlExpiresOn(): ?\DateTime | setPublicUrlExpiresOn(?\DateTime publicUrlExpiresOn): void | +| `brandingThemeId` | `?int` | Optional | The ID of the Branding Theme associated with this invoice. This value represents the Branding Theme used for invoice theming, such as themed invoice rendering. Available only when Branding Themes are enabled for the site. | getBrandingThemeId(): ?int | setBrandingThemeId(?int brandingThemeId): void | -## Example (as JSON) +## Example -```json -{ - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 252, - "uid": "uid0", - "site_id": 178, - "customer_id": 34, - "subscription_id": 106 -} +```php +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$invoice = InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(); ``` diff --git a/doc/models/issue-advance-invoice-request.md b/doc/models/issue-advance-invoice-request.md index 75659fdb..5e58899e 100644 --- a/doc/models/issue-advance-invoice-request.md +++ b/doc/models/issue-advance-invoice-request.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `force` | `?bool` | Optional | - | getForce(): ?bool | setForce(?bool force): void | -## Example (as JSON) +## Example -```json -{ - "force": false -} +```php +use AdvancedBillingLib\Models\Builders\IssueAdvanceInvoiceRequestBuilder; + +$issueAdvanceInvoiceRequest = IssueAdvanceInvoiceRequestBuilder::init() + ->force(false) + ->build(); ``` diff --git a/doc/models/issue-invoice-event-data.md b/doc/models/issue-invoice-event-data.md index 6e1b1b71..05773e6e 100644 --- a/doc/models/issue-invoice-event-data.md +++ b/doc/models/issue-invoice-event-data.md @@ -11,21 +11,25 @@ Example schema for an `issue_invoice` event | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `consolidationLevel` | [`string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Required | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): string | setConsolidationLevel(string consolidationLevel): void | +| `consolidationLevel` | [`string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Required | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): string | setConsolidationLevel(string consolidationLevel): void | | `fromStatus` | [`string(InvoiceStatus)`](../../doc/models/invoice-status.md) | Required | The status of the invoice before event occurrence. See [Invoice Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview#invoice-statuses) for more. | getFromStatus(): string | setFromStatus(string fromStatus): void | | `toStatus` | [`string(InvoiceStatus)`](../../doc/models/invoice-status.md) | Required | The status of the invoice after event occurrence. See [Invoice Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview#invoice-statuses) for more. | getToStatus(): string | setToStatus(string toStatus): void | | `dueAmount` | `string` | Required | Amount due on the invoice, which is `total_amount - credit_amount - paid_amount`. | getDueAmount(): string | setDueAmount(string dueAmount): void | | `totalAmount` | `string` | Required | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.' | getTotalAmount(): string | setTotalAmount(string totalAmount): void | -## Example (as JSON) +## Example -```json -{ - "consolidation_level": "none", - "from_status": "voided", - "to_status": "draft", - "due_amount": "due_amount6", - "total_amount": "total_amount0" -} +```php +use AdvancedBillingLib\Models\Builders\IssueInvoiceEventDataBuilder; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; +use AdvancedBillingLib\Models\InvoiceStatus; + +$issueInvoiceEventData = IssueInvoiceEventDataBuilder::init( + InvoiceConsolidationLevel::CHILD, + InvoiceStatus::DRAFT, + InvoiceStatus::VOIDED, + 'due_amount6', + 'total_amount0' +)->build(); ``` diff --git a/doc/models/issue-invoice-event.md b/doc/models/issue-invoice-event.md index 4a2d922a..71a8bf10 100644 --- a/doc/models/issue-invoice-event.md +++ b/doc/models/issue-invoice-event.md @@ -15,31 +15,39 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::ISSUE_INVOICE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`IssueInvoiceEventData`](../../doc/models/issue-invoice-event-data.md) | Required | Example schema for an `issue_invoice` event | getEventData(): IssueInvoiceEventData | setEventData(IssueInvoiceEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 130, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "issue_invoice", - "event_data": { - "consolidation_level": "child", - "from_status": "open", - "to_status": "pending", - "due_amount": "due_amount8", - "total_amount": "total_amount2" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\IssueInvoiceEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceStatus; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\IssueInvoiceEventDataBuilder; + +$issueInvoiceEvent = IssueInvoiceEventBuilder::init( + 144, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::ISSUE_INVOICE, + IssueInvoiceEventDataBuilder::init( + InvoiceConsolidationLevel::CHILD, + InvoiceStatus::OPEN, + InvoiceStatus::PENDING, + 'due_amount8', + 'total_amount2' + )->build() +)->build(); ``` diff --git a/doc/models/issue-invoice-request.md b/doc/models/issue-invoice-request.md index 809b416e..46930de2 100644 --- a/doc/models/issue-invoice-request.md +++ b/doc/models/issue-invoice-request.md @@ -9,13 +9,16 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `onFailedPayment` | [`?string(FailedPaymentAction)`](../../doc/models/failed-payment-action.md) | Optional | Action taken when payment for an invoice fails:

- `leave_open_invoice` - prepayments and credits applied to invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history. This is the default option.
- `rollback_to_pending` - prepayments and credits not applied; invoice remains in "pending" status; no email sent to the customer; payment failure recorded in the invoice history.
- `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending upon net terms and dunning settings).

**Default**: `FailedPaymentAction::LEAVE_OPEN_INVOICE` | getOnFailedPayment(): ?string | setOnFailedPayment(?string onFailedPayment): void | +| `onFailedPayment` | [`?string(FailedPaymentAction)`](../../doc/models/failed-payment-action.md) | Optional | Action taken when payment for an invoice fails:

- `leave_open_invoice` - prepayments and credits applied to invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history. This is the default option.
- `rollback_to_pending` - prepayments and credits not applied; invoice remains in "pending" status; no email sent to the customer; payment failure recorded in the invoice history.
- `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending upon net terms and dunning settings).

**Default**: `FailedPaymentAction::LEAVE_OPEN_INVOICE` | getOnFailedPayment(): ?string | setOnFailedPayment(?string onFailedPayment): void | -## Example (as JSON) +## Example -```json -{ - "on_failed_payment": "leave_open_invoice" -} +```php +use AdvancedBillingLib\Models\Builders\IssueInvoiceRequestBuilder; +use AdvancedBillingLib\Models\FailedPaymentAction; + +$issueInvoiceRequest = IssueInvoiceRequestBuilder::init() + ->onFailedPayment(FailedPaymentAction::LEAVE_OPEN_INVOICE) + ->build(); ``` diff --git a/doc/models/issue-service-credit-request.md b/doc/models/issue-service-credit-request.md index 434b3b51..d246316c 100644 --- a/doc/models/issue-service-credit-request.md +++ b/doc/models/issue-service-credit-request.md @@ -11,14 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `serviceCredit` | [`IssueServiceCredit`](../../doc/models/issue-service-credit.md) | Required | - | getServiceCredit(): IssueServiceCredit | setServiceCredit(IssueServiceCredit serviceCredit): void | -## Example (as JSON) - -```json -{ - "service_credit": { - "amount": 31.42, - "memo": "memo0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\IssueServiceCreditRequestBuilder; +use AdvancedBillingLib\Models\Builders\IssueServiceCreditBuilder; + +$issueServiceCreditRequest = IssueServiceCreditRequestBuilder::init( + IssueServiceCreditBuilder::init( + 31.42 + ) + ->memo('memo0') + ->build() +)->build(); ``` diff --git a/doc/models/issue-service-credit.md b/doc/models/issue-service-credit.md index c9a45708..e29e8fa4 100644 --- a/doc/models/issue-service-credit.md +++ b/doc/models/issue-service-credit.md @@ -12,12 +12,15 @@ | `amount` | float\|string | Required | This is a container for one-of cases. | getAmount(): | setAmount( amount): void | | `memo` | `?string` | Optional | - | getMemo(): ?string | setMemo(?string memo): void | -## Example (as JSON) +## Example -```json -{ - "amount": 5.82, - "memo": "memo4" -} +```php +use AdvancedBillingLib\Models\Builders\IssueServiceCreditBuilder; + +$issueServiceCredit = IssueServiceCreditBuilder::init( + 44.88 +) + ->memo('memo6') + ->build(); ``` diff --git a/doc/models/item-category.md b/doc/models/item-category.md index 8a73b8c3..b85a8194 100644 --- a/doc/models/item-category.md +++ b/doc/models/item-category.md @@ -19,7 +19,9 @@ One of the following: Business Software, Consumer Software, Digital Services, Ph ## Example -``` -Business Software +```php +use AdvancedBillingLib\Models\ItemCategory; + +$itemCategory = ItemCategory::OTHER; ``` diff --git a/doc/models/item-price-point-changed.md b/doc/models/item-price-point-changed.md index 4575f4e1..8e818630 100644 --- a/doc/models/item-price-point-changed.md +++ b/doc/models/item-price-point-changed.md @@ -16,24 +16,27 @@ | `previousPricePoint` | [`ItemPricePointData`](../../doc/models/item-price-point-data.md) | Required | - | getPreviousPricePoint(): ItemPricePointData | setPreviousPricePoint(ItemPricePointData previousPricePoint): void | | `currentPricePoint` | [`ItemPricePointData`](../../doc/models/item-price-point-data.md) | Required | - | getCurrentPricePoint(): ItemPricePointData | setCurrentPricePoint(ItemPricePointData currentPricePoint): void | -## Example (as JSON) - -```json -{ - "item_id": 66, - "item_type": "item_type6", - "item_handle": "item_handle4", - "item_name": "item_name8", - "previous_price_point": { - "id": 216, - "handle": "handle6", - "name": "name0" - }, - "current_price_point": { - "id": 218, - "handle": "handle6", - "name": "name0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ItemPricePointChangedBuilder; +use AdvancedBillingLib\Models\Builders\ItemPricePointDataBuilder; + +$itemPricePointChanged = ItemPricePointChangedBuilder::init( + 30, + 'item_type6', + 'item_handle4', + 'item_name8', + ItemPricePointDataBuilder::init() + ->id(216) + ->handle('handle6') + ->name('name0') + ->build(), + ItemPricePointDataBuilder::init() + ->id(218) + ->handle('handle6') + ->name('name0') + ->build() +)->build(); ``` diff --git a/doc/models/item-price-point-data.md b/doc/models/item-price-point-data.md index 212f7a7f..09e5bc15 100644 --- a/doc/models/item-price-point-data.md +++ b/doc/models/item-price-point-data.md @@ -13,13 +13,15 @@ | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | -## Example (as JSON) - -```json -{ - "id": 192, - "handle": "handle6", - "name": "name0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ItemPricePointDataBuilder; + +$itemPricePointData = ItemPricePointDataBuilder::init() + ->id(80) + ->handle('handle8') + ->name('name2') + ->build(); ``` diff --git a/doc/models/line-item-kind.md b/doc/models/line-item-kind.md index 380d29ea..9610be17 100644 --- a/doc/models/line-item-kind.md +++ b/doc/models/line-item-kind.md @@ -22,3 +22,11 @@ A handle for the line item kind | `COUPON` | | `TAX` | +## Example + +```php +use AdvancedBillingLib\Models\LineItemKind; + +$lineItemKind = LineItemKind::PREPAID_USAGE_COMPONENT; +``` + diff --git a/doc/models/line-item-transaction-type.md b/doc/models/line-item-transaction-type.md index f5847f6b..0a50431e 100644 --- a/doc/models/line-item-transaction-type.md +++ b/doc/models/line-item-transaction-type.md @@ -19,3 +19,11 @@ A handle for the line item transaction type | `INFO_TRANSACTION` | | `PAYMENT_AUTHORIZATION` | +## Example + +```php +use AdvancedBillingLib\Models\LineItemTransactionType; + +$lineItemTransactionType = LineItemTransactionType::PAYMENT; +``` + diff --git a/doc/models/list-components-filter.md b/doc/models/list-components-filter.md index 2d1ad2d9..c2aa1776 100644 --- a/doc/models/list-components-filter.md +++ b/doc/models/list-components-filter.md @@ -12,16 +12,20 @@ | `ids` | `?(int[])` | Optional | Allows fetching components with matching id based on provided value. Use in query `filter[ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | getIds(): ?array | setIds(?array ids): void | | `useSiteExchangeRate` | `?bool` | Optional | Allows fetching components with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query `filter[use_site_exchange_rate]=true`. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | -## Example (as JSON) - -```json -{ - "ids": [ - 1, - 2, - 3 - ], - "use_site_exchange_rate": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListComponentsFilterBuilder; + +$listComponentsFilter = ListComponentsFilterBuilder::init() + ->ids( + [ + 1, + 2, + 3 + ] + ) + ->useSiteExchangeRate(false) + ->build(); ``` diff --git a/doc/models/list-components-price-points-include.md b/doc/models/list-components-price-points-include.md index 31cc7ea7..5fbe8e2b 100644 --- a/doc/models/list-components-price-points-include.md +++ b/doc/models/list-components-price-points-include.md @@ -13,7 +13,9 @@ ## Example -``` -currency_prices +```php +use AdvancedBillingLib\Models\ListComponentsPricePointsInclude; + +$listComponentsPricePointsInclude = ListComponentsPricePointsInclude::CURRENCY_PRICES; ``` diff --git a/doc/models/list-components-price-points-response.md b/doc/models/list-components-price-points-response.md index 934054f5..28f2dcc1 100644 --- a/doc/models/list-components-price-points-response.md +++ b/doc/models/list-components-price-points-response.md @@ -11,19 +11,24 @@ | --- | --- | --- | --- | --- | --- | | `pricePoints` | [`ComponentPricePoint[]`](../../doc/models/component-price-point.md) | Required | - | getPricePoints(): array | setPricePoints(array pricePoints): void | -## Example (as JSON) - -```json -{ - "price_points": [ - { - "id": 40, - "type": "default", - "default": false, - "name": "name2", - "pricing_scheme": "per_unit" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListComponentsPricePointsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricePointType; +use AdvancedBillingLib\Models\PricingScheme; + +$listComponentsPricePointsResponse = ListComponentsPricePointsResponseBuilder::init( + [ + ComponentPricePointBuilder::init() + ->id(40) + ->type(PricePointType::DEFAULT_) + ->default(false) + ->name('name2') + ->pricingScheme(PricingScheme::PER_UNIT) + ->build() + ] +)->build(); ``` diff --git a/doc/models/list-coupons-filter.md b/doc/models/list-coupons-filter.md index ac5b3a19..f40c1033 100644 --- a/doc/models/list-coupons-filter.md +++ b/doc/models/list-coupons-filter.md @@ -19,24 +19,32 @@ | `useSiteExchangeRate` | `?bool` | Optional | If true, restricts the list to coupons whose pricing is recalculated from the site’s current exchange rates, so their currency_prices array contains on-the-fly conversions rather than stored price records. If false, restricts the list to coupons that have manually defined amounts for each currency, ensuring the response includes the saved currency_prices entries instead of exchange-rate-derived values. Use in query `filter[use_site_exchange_rate]=true`. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | | `includeArchived` | `?bool` | Optional | Controls returning archived coupons. | getIncludeArchived(): ?bool | setIncludeArchived(?bool includeArchived): void | -## Example (as JSON) - -```json -{ - "start_date": "2011-12-17", - "end_date": "2011-12-15", - "start_datetime": "12/19/2011 09:15:30", - "end_datetime": "06/07/2019 17:20:06", - "ids": [ - 1, - 2, - 3 - ], - "codes": [ - "free", - "free_trial" - ], - "date_field": "updated_at" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListCouponsFilterBuilder; +use AdvancedBillingLib\Models\BasicDateField; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$listCouponsFilter = ListCouponsFilterBuilder::init() + ->dateField(BasicDateField::UPDATED_AT) + ->startDate(DateTimeHelper::fromSimpleDate('2011-12-17')) + ->endDate(DateTimeHelper::fromSimpleDate('2011-12-15')) + ->startDatetime(DateTimeHelper::fromRfc3339DateTime('2011-12-19T09:15:30+00:00')) + ->endDatetime(DateTimeHelper::fromRfc3339DateTime('2019-06-07T17:20:06Z')) + ->ids( + [ + 1, + 2, + 3 + ] + ) + ->codes( + [ + 'free', + 'free_trial' + ] + ) + ->build(); ``` diff --git a/doc/models/list-credit-notes-response.md b/doc/models/list-credit-notes-response.md index 6b2c2bdf..b1089fad 100644 --- a/doc/models/list-credit-notes-response.md +++ b/doc/models/list-credit-notes-response.md @@ -11,19 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `creditNotes` | [`CreditNote[]`](../../doc/models/credit-note.md) | Required | - | getCreditNotes(): array | setCreditNotes(array creditNotes): void | -## Example (as JSON) - -```json -{ - "credit_notes": [ - { - "uid": "uid2", - "site_id": 112, - "customer_id": 224, - "subscription_id": 40, - "number": "number0" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListCreditNotesResponseBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; + +$listCreditNotesResponse = ListCreditNotesResponseBuilder::init( + [ + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(112) + ->customerId(224) + ->subscriptionId(40) + ->number('number0') + ->build() + ] +)->build(); ``` diff --git a/doc/models/list-events-date-field.md b/doc/models/list-events-date-field.md index 7ac6c5f0..2d253221 100644 --- a/doc/models/list-events-date-field.md +++ b/doc/models/list-events-date-field.md @@ -13,7 +13,9 @@ ## Example -``` -created_at +```php +use AdvancedBillingLib\Models\ListEventsDateField; + +$listEventsDateField = ListEventsDateField::CREATED_AT; ``` diff --git a/doc/models/list-invoice-events-response.md b/doc/models/list-invoice-events-response.md index 80353b68..fc95a5d9 100644 --- a/doc/models/list-invoice-events-response.md +++ b/doc/models/list-invoice-events-response.md @@ -14,52 +14,145 @@ | `perPage` | `?int` | Optional | - | getPerPage(): ?int | setPerPage(?int perPage): void | | `totalPages` | `?int` | Optional | - | getTotalPages(): ?int | setTotalPages(?int totalPages): void | -## Example (as JSON) +## Example -```json -{ - "events": [ - { - "event_type": "apply_credit_note", - "id": 214, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_data": { - "uid": "uid6", - "credit_note_number": "credit_note_number0", - "credit_note_uid": "credit_note_uid0", - "original_amount": "original_amount0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z", - "memo": "memo0", - "role": "role0", - "consolidated_invoice": false, - "applied_credit_notes": [ - { - "uid": "uid4", - "number": "number8" - }, - { - "uid": "uid4", - "number": "number8" - }, - { - "uid": "uid4", - "number": "number8" - } +```php +use AdvancedBillingLib\Models\Builders\ListInvoiceEventsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ApplyCreditNoteEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\ApplyCreditNoteEventDataBuilder; +use AdvancedBillingLib\Models\Builders\AppliedCreditNoteDataBuilder; + +$listInvoiceEventsResponse = ListInvoiceEventsResponseBuilder::init() + ->events( + [ + ApplyCreditNoteEventBuilder::init( + 214, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->build(), + InvoiceEventType::APPLY_CREDIT_NOTE, + ApplyCreditNoteEventDataBuilder::init( + 'uid6', + 'credit_note_number0', + 'credit_note_uid0', + 'original_amount0', + 'applied_amount2' + ) + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo0') + ->role('role0') + ->consolidatedInvoice(false) + ->appliedCreditNotes( + [ + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build() + ] + ) + ->build() + )->build(), + ApplyCreditNoteEventBuilder::init( + 214, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->build(), + InvoiceEventType::APPLY_CREDIT_NOTE, + ApplyCreditNoteEventDataBuilder::init( + 'uid6', + 'credit_note_number0', + 'credit_note_uid0', + 'original_amount0', + 'applied_amount2' + ) + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo0') + ->role('role0') + ->consolidatedInvoice(false) + ->appliedCreditNotes( + [ + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build() + ] + ) + ->build() + )->build(), + ApplyCreditNoteEventBuilder::init( + 214, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->build(), + InvoiceEventType::APPLY_CREDIT_NOTE, + ApplyCreditNoteEventDataBuilder::init( + 'uid6', + 'credit_note_number0', + 'credit_note_uid0', + 'original_amount0', + 'applied_amount2' + ) + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->memo('memo0') + ->role('role0') + ->consolidatedInvoice(false) + ->appliedCreditNotes( + [ + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build(), + AppliedCreditNoteDataBuilder::init() + ->uid('uid4') + ->number('number8') + ->build() + ] + ) + ->build() + )->build() ] - } - } - ], - "page": 184, - "per_page": 96, - "total_pages": 194 -} + ) + ->page(28) + ->perPage(196) + ->totalPages(94) + ->build(); ``` diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md index 44178731..02932145 100644 --- a/doc/models/list-invoices-response.md +++ b/doc/models/list-invoices-response.md @@ -11,23 +11,27 @@ | --- | --- | --- | --- | --- | --- | | `invoices` | [`Invoice[]`](../../doc/models/invoice.md) | Required | - | getInvoices(): array | setInvoices(array invoices): void | -## Example (as JSON) - -```json -{ - "invoices": [ - { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 196, - "uid": "uid6", - "site_id": 122, - "customer_id": 234, - "subscription_id": 50 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListInvoicesResponseBuilder; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$listInvoicesResponse = ListInvoicesResponseBuilder::init( + [ + InvoiceBuilder::init() + ->id(196) + ->uid('uid6') + ->siteId(122) + ->customerId(234) + ->subscriptionId(50) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build() + ] +)->build(); ``` diff --git a/doc/models/list-metafields-response.md b/doc/models/list-metafields-response.md index 526edbac..2c68656d 100644 --- a/doc/models/list-metafields-response.md +++ b/doc/models/list-metafields-response.md @@ -15,29 +15,69 @@ | `perPage` | `?int` | Optional | - | getPerPage(): ?int | setPerPage(?int perPage): void | | `metafields` | [`?(Metafield[])`](../../doc/models/metafield.md) | Optional | - | getMetafields(): ?array | setMetafields(?array metafields): void | -## Example (as JSON) - -```json -{ - "total_count": 210, - "current_page": 186, - "total_pages": 198, - "per_page": 92, - "metafields": [ - { - "id": 22, - "name": "name2", - "scope": { - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0" - }, - "data_count": 10, - "input_type": "balance_tracker" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListMetafieldsResponseBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; +use AdvancedBillingLib\Models\MetafieldInput; + +$listMetafieldsResponse = ListMetafieldsResponseBuilder::init() + ->totalCount(228) + ->currentPage(204) + ->totalPages(216) + ->perPage(74) + ->metafields( + [ + MetafieldBuilder::init() + ->id(22) + ->name('name2') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build() + ) + ->dataCount(10) + ->inputType(MetafieldInput::BALANCE_TRACKER) + ->build(), + MetafieldBuilder::init() + ->id(22) + ->name('name2') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build() + ) + ->dataCount(10) + ->inputType(MetafieldInput::BALANCE_TRACKER) + ->build(), + MetafieldBuilder::init() + ->id(22) + ->name('name2') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build() + ) + ->dataCount(10) + ->inputType(MetafieldInput::BALANCE_TRACKER) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/list-mrr-filter.md b/doc/models/list-mrr-filter.md index 4f15e9d4..cc9cc42b 100644 --- a/doc/models/list-mrr-filter.md +++ b/doc/models/list-mrr-filter.md @@ -11,15 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionIds` | `?(int[])` | Optional | Submit ids in order to limit results. Use in query: `filter[subscription_ids]=1,2,3`.

**Constraints**: *Minimum Items*: `1` | getSubscriptionIds(): ?array | setSubscriptionIds(?array subscriptionIds): void | -## Example (as JSON) - -```json -{ - "subscription_ids": [ - 1, - 2, - 3 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListMrrFilterBuilder; + +$listMrrFilter = ListMrrFilterBuilder::init() + ->subscriptionIds( + [ + 1, + 2, + 3 + ] + ) + ->build(); ``` diff --git a/doc/models/list-mrr-response-result.md b/doc/models/list-mrr-response-result.md index 55a0ce99..3bdfd8ff 100644 --- a/doc/models/list-mrr-response-result.md +++ b/doc/models/list-mrr-response-result.md @@ -17,15 +17,17 @@ | `currencySymbol` | `?string` | Optional | - | getCurrencySymbol(): ?string | setCurrencySymbol(?string currencySymbol): void | | `movements` | [`?(Movement[])`](../../doc/models/movement.md) | Optional | - | getMovements(): ?array | setMovements(?array movements): void | -## Example (as JSON) - -```json -{ - "page": 150, - "per_page": 238, - "total_pages": 16, - "total_entries": 112, - "currency": "currency8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListMRRResponseResultBuilder; + +$listMRRResponseResult = ListMRRResponseResultBuilder::init() + ->page(40) + ->perPage(208) + ->totalPages(82) + ->totalEntries(78) + ->currency('currency6') + ->build(); ``` diff --git a/doc/models/list-mrr-response.md b/doc/models/list-mrr-response.md index a451a6d9..3d4d6d73 100644 --- a/doc/models/list-mrr-response.md +++ b/doc/models/list-mrr-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `mrr` | [`ListMRRResponseResult`](../../doc/models/list-mrr-response-result.md) | Required | - | getMrr(): ListMRRResponseResult | setMrr(ListMRRResponseResult mrr): void | -## Example (as JSON) - -```json -{ - "mrr": { - "page": 30, - "per_page": 198, - "total_pages": 92, - "total_entries": 188, - "currency": "currency4" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListMRRResponseBuilder; +use AdvancedBillingLib\Models\Builders\ListMRRResponseResultBuilder; + +$listMRRResponse = ListMRRResponseBuilder::init( + ListMRRResponseResultBuilder::init() + ->page(30) + ->perPage(198) + ->totalPages(92) + ->totalEntries(188) + ->currency('currency4') + ->build() +)->build(); ``` diff --git a/doc/models/list-offers-response.md b/doc/models/list-offers-response.md index 303ebf69..1a85913a 100644 --- a/doc/models/list-offers-response.md +++ b/doc/models/list-offers-response.md @@ -11,33 +11,24 @@ | --- | --- | --- | --- | --- | --- | | `offers` | [`?(Offer[])`](../../doc/models/offer.md) | Optional | - | getOffers(): ?array | setOffers(?array offers): void | -## Example (as JSON) - -```json -{ - "offers": [ - { - "id": 12, - "site_id": 194, - "product_family_id": 16, - "product_id": 210, - "product_price_point_id": 134 - }, - { - "id": 12, - "site_id": 194, - "product_family_id": 16, - "product_id": 210, - "product_price_point_id": 134 - }, - { - "id": 12, - "site_id": 194, - "product_family_id": 16, - "product_id": 210, - "product_price_point_id": 134 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListOffersResponseBuilder; +use AdvancedBillingLib\Models\Builders\OfferBuilder; + +$listOffersResponse = ListOffersResponseBuilder::init() + ->offers( + [ + OfferBuilder::init() + ->id(12) + ->siteId(194) + ->productFamilyId(16) + ->productId(210) + ->productPricePointId(134) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/list-prepayment-date-field.md b/doc/models/list-prepayment-date-field.md index fb729cda..b767d5f5 100644 --- a/doc/models/list-prepayment-date-field.md +++ b/doc/models/list-prepayment-date-field.md @@ -14,7 +14,9 @@ ## Example -``` -created_at +```php +use AdvancedBillingLib\Models\ListPrepaymentDateField; + +$listPrepaymentDateField = ListPrepaymentDateField::CREATED_AT; ``` diff --git a/doc/models/list-prepayments-filter.md b/doc/models/list-prepayments-filter.md index d98b4dd9..c8fef635 100644 --- a/doc/models/list-prepayments-filter.md +++ b/doc/models/list-prepayments-filter.md @@ -13,13 +13,17 @@ | `startDate` | `?DateTime` | Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns prepayments with a timestamp at or after midnight (12:00:00 AM) in your site's time zone on the date specified. Use in query: `filter[start_date]=2011-12-15`. | getStartDate(): ?\DateTime | setStartDate(?\DateTime startDate): void | | `endDate` | `?DateTime` | Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns prepayments with a timestamp up to and including 11:59:59PM in your site's time zone on the date specified. Use in query: `filter[end_date]=2011-12-15`. | getEndDate(): ?\DateTime | setEndDate(?\DateTime endDate): void | -## Example (as JSON) - -```json -{ - "date_field": "created_at", - "start_date": "2024-01-01", - "end_date": "2024-01-31" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListPrepaymentsFilterBuilder; +use AdvancedBillingLib\Models\ListPrepaymentDateField; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$listPrepaymentsFilter = ListPrepaymentsFilterBuilder::init() + ->dateField(ListPrepaymentDateField::CREATED_AT) + ->startDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->endDate(DateTimeHelper::fromSimpleDate('2024-01-31')) + ->build(); ``` diff --git a/doc/models/list-price-points-filter.md b/doc/models/list-price-points-filter.md index 7cd283cc..2647c400 100644 --- a/doc/models/list-price-points-filter.md +++ b/doc/models/list-price-points-filter.md @@ -18,25 +18,34 @@ | `ids` | `?(int[])` | Optional | Allows fetching price points with matching id based on provided values. Use in query: `filter[ids]=1,2,3`. | getIds(): ?array | setIds(?array ids): void | | `archivedAt` | [`?string(IncludeNullOrNotNull)`](../../doc/models/include-null-or-not-null.md) | Optional | Allows fetching price points only if archived_at is present or not. Use in query: `filter[archived_at]=not_null`. | getArchivedAt(): ?string | setArchivedAt(?string archivedAt): void | -## Example (as JSON) - -```json -{ - "start_date": "2011-12-17", - "end_date": "2011-12-15", - "start_datetime": "12/19/2011 09:15:30", - "end_datetime": "06/07/2019 17:20:06", - "type": [ - "catalog", - "default", - "custom" - ], - "ids": [ - 1, - 2, - 3 - ], - "date_field": "updated_at" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListPricePointsFilterBuilder; +use AdvancedBillingLib\Models\BasicDateField; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\PricePointType; + +$listPricePointsFilter = ListPricePointsFilterBuilder::init() + ->dateField(BasicDateField::UPDATED_AT) + ->startDate(DateTimeHelper::fromSimpleDate('2011-12-17')) + ->endDate(DateTimeHelper::fromSimpleDate('2011-12-15')) + ->startDatetime(DateTimeHelper::fromRfc3339DateTime('2011-12-19T09:15:30+00:00')) + ->endDatetime(DateTimeHelper::fromRfc3339DateTime('2019-06-07T17:20:06Z')) + ->type( + [ + PricePointType::CATALOG, + PricePointType::DEFAULT_, + PricePointType::CUSTOM + ] + ) + ->ids( + [ + 1, + 2, + 3 + ] + ) + ->build(); ``` diff --git a/doc/models/list-product-price-points-response.md b/doc/models/list-product-price-points-response.md index e28f6bd4..bf648429 100644 --- a/doc/models/list-product-price-points-response.md +++ b/doc/models/list-product-price-points-response.md @@ -11,19 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `pricePoints` | [`ProductPricePoint[]`](../../doc/models/product-price-point.md) | Required | - | getPricePoints(): array | setPricePoints(array pricePoints): void | -## Example (as JSON) - -```json -{ - "price_points": [ - { - "id": 40, - "name": "name2", - "handle": "handle8", - "price_in_cents": 108, - "interval": 92 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListProductPricePointsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ProductPricePointBuilder; + +$listProductPricePointsResponse = ListProductPricePointsResponseBuilder::init( + [ + ProductPricePointBuilder::init() + ->id(40) + ->name('name2') + ->handle('handle8') + ->priceInCents(108) + ->interval(92) + ->build() + ] +)->build(); ``` diff --git a/doc/models/list-products-filter.md b/doc/models/list-products-filter.md index 259c337d..366d5754 100644 --- a/doc/models/list-products-filter.md +++ b/doc/models/list-products-filter.md @@ -13,19 +13,24 @@ | `prepaidProductPricePoint` | [`?PrepaidProductPricePointFilter`](../../doc/models/prepaid-product-price-point-filter.md) | Optional | Allows fetching products only if a prepaid product price point is present or not. To use this filter you also have to include the following param in the request `include=prepaid_product_price_point`. Use in query `filter[prepaid_product_price_point][product_price_point_id]=not_null`. | getPrepaidProductPricePoint(): ?PrepaidProductPricePointFilter | setPrepaidProductPricePoint(?PrepaidProductPricePointFilter prepaidProductPricePoint): void | | `useSiteExchangeRate` | `?bool` | Optional | Allows fetching products with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query `filter[use_site_exchange_rate]=true`. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | -## Example (as JSON) - -```json -{ - "ids": [ - 1, - 2, - 3 - ], - "prepaid_product_price_point": { - "product_price_point_id": "product_price_point_id2" - }, - "use_site_exchange_rate": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListProductsFilterBuilder; +use AdvancedBillingLib\Models\Builders\PrepaidProductPricePointFilterBuilder; + +$listProductsFilter = ListProductsFilterBuilder::init() + ->ids( + [ + 1, + 2, + 3 + ] + ) + ->prepaidProductPricePoint( + PrepaidProductPricePointFilterBuilder::init()->build() + ) + ->useSiteExchangeRate(false) + ->build(); ``` diff --git a/doc/models/list-products-include.md b/doc/models/list-products-include.md index f2847330..318bd37a 100644 --- a/doc/models/list-products-include.md +++ b/doc/models/list-products-include.md @@ -13,7 +13,9 @@ ## Example -``` -prepaid_product_price_point +```php +use AdvancedBillingLib\Models\ListProductsInclude; + +$listProductsInclude = ListProductsInclude::PREPAID_PRODUCT_PRICE_POINT; ``` diff --git a/doc/models/list-products-price-points-include.md b/doc/models/list-products-price-points-include.md index 99e40235..b928532e 100644 --- a/doc/models/list-products-price-points-include.md +++ b/doc/models/list-products-price-points-include.md @@ -13,7 +13,9 @@ ## Example -``` -currency_prices +```php +use AdvancedBillingLib\Models\ListProductsPricePointsInclude; + +$listProductsPricePointsInclude = ListProductsPricePointsInclude::CURRENCY_PRICES; ``` diff --git a/doc/models/list-proforma-invoices-meta.md b/doc/models/list-proforma-invoices-meta.md index 4ba22b61..6a5a1d6f 100644 --- a/doc/models/list-proforma-invoices-meta.md +++ b/doc/models/list-proforma-invoices-meta.md @@ -14,14 +14,16 @@ | `totalPages` | `?int` | Optional | - | getTotalPages(): ?int | setTotalPages(?int totalPages): void | | `statusCode` | `?int` | Optional | - | getStatusCode(): ?int | setStatusCode(?int statusCode): void | -## Example (as JSON) - -```json -{ - "total_count": 226, - "current_page": 202, - "total_pages": 214, - "status_code": 244 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListProformaInvoicesMetaBuilder; + +$listProformaInvoicesMeta = ListProformaInvoicesMetaBuilder::init() + ->totalCount(50) + ->currentPage(26) + ->totalPages(38) + ->statusCode(68) + ->build(); ``` diff --git a/doc/models/list-proforma-invoices-response.md b/doc/models/list-proforma-invoices-response.md index d4445409..279fb7f5 100644 --- a/doc/models/list-proforma-invoices-response.md +++ b/doc/models/list-proforma-invoices-response.md @@ -12,39 +12,47 @@ | `proformaInvoices` | [`?(ProformaInvoice[])`](../../doc/models/proforma-invoice.md) | Optional | - | getProformaInvoices(): ?array | setProformaInvoices(?array proformaInvoices): void | | `meta` | [`?ListProformaInvoicesMeta`](../../doc/models/list-proforma-invoices-meta.md) | Optional | - | getMeta(): ?ListProformaInvoicesMeta | setMeta(?ListProformaInvoicesMeta meta): void | -## Example (as JSON) - -```json -{ - "proforma_invoices": [ - { - "uid": "uid0", - "site_id": 140, - "customer_id": 252, - "subscription_id": 68, - "number": 56 - }, - { - "uid": "uid0", - "site_id": 140, - "customer_id": 252, - "subscription_id": 68, - "number": 56 - }, - { - "uid": "uid0", - "site_id": 140, - "customer_id": 252, - "subscription_id": 68, - "number": 56 - } - ], - "meta": { - "total_count": 150, - "current_page": 126, - "total_pages": 138, - "status_code": 168 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListProformaInvoicesResponseBuilder; +use AdvancedBillingLib\Models\Builders\ProformaInvoiceBuilder; +use AdvancedBillingLib\Models\Builders\ListProformaInvoicesMetaBuilder; + +$listProformaInvoicesResponse = ListProformaInvoicesResponseBuilder::init() + ->proformaInvoices( + [ + ProformaInvoiceBuilder::init() + ->uid('uid0') + ->siteId(140) + ->customerId(252) + ->subscriptionId(68) + ->number(56) + ->build(), + ProformaInvoiceBuilder::init() + ->uid('uid0') + ->siteId(140) + ->customerId(252) + ->subscriptionId(68) + ->number(56) + ->build(), + ProformaInvoiceBuilder::init() + ->uid('uid0') + ->siteId(140) + ->customerId(252) + ->subscriptionId(68) + ->number(56) + ->build() + ] + ) + ->meta( + ListProformaInvoicesMetaBuilder::init() + ->totalCount(150) + ->currentPage(126) + ->totalPages(138) + ->statusCode(168) + ->build() + ) + ->build(); ``` diff --git a/doc/models/list-public-keys-meta.md b/doc/models/list-public-keys-meta.md index 420f841e..6e1fce51 100644 --- a/doc/models/list-public-keys-meta.md +++ b/doc/models/list-public-keys-meta.md @@ -14,14 +14,16 @@ | `totalPages` | `?int` | Optional | - | getTotalPages(): ?int | setTotalPages(?int totalPages): void | | `perPage` | `?int` | Optional | - | getPerPage(): ?int | setPerPage(?int perPage): void | -## Example (as JSON) - -```json -{ - "total_count": 22, - "current_page": 254, - "total_pages": 10, - "per_page": 24 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListPublicKeysMetaBuilder; + +$listPublicKeysMeta = ListPublicKeysMetaBuilder::init() + ->totalCount(232) + ->currentPage(208) + ->totalPages(220) + ->perPage(70) + ->build(); ``` diff --git a/doc/models/list-public-keys-response.md b/doc/models/list-public-keys-response.md index 8a6299a2..4d69263d 100644 --- a/doc/models/list-public-keys-response.md +++ b/doc/models/list-public-keys-response.md @@ -12,28 +12,32 @@ | `chargifyJsKeys` | [`?(PublicKey[])`](../../doc/models/public-key.md) | Optional | - | getChargifyJsKeys(): ?array | setChargifyJsKeys(?array chargifyJsKeys): void | | `meta` | [`?ListPublicKeysMeta`](../../doc/models/list-public-keys-meta.md) | Optional | - | getMeta(): ?ListPublicKeysMeta | setMeta(?ListPublicKeysMeta meta): void | -## Example (as JSON) - -```json -{ - "chargify_js_keys": [ - { - "public_key": "public_key8", - "requires_security_token": false, - "created_at": "2016-03-13T12:52:32.123Z" - }, - { - "public_key": "public_key8", - "requires_security_token": false, - "created_at": "2016-03-13T12:52:32.123Z" - } - ], - "meta": { - "total_count": 150, - "current_page": 126, - "total_pages": 138, - "per_page": 152 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListPublicKeysResponseBuilder; +use AdvancedBillingLib\Models\Builders\PublicKeyBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\ListPublicKeysMetaBuilder; + +$listPublicKeysResponse = ListPublicKeysResponseBuilder::init() + ->chargifyJsKeys( + [ + PublicKeyBuilder::init() + ->publicKey('public_key8') + ->requiresSecurityToken(false) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ] + ) + ->meta( + ListPublicKeysMetaBuilder::init() + ->totalCount(150) + ->currentPage(126) + ->totalPages(138) + ->perPage(152) + ->build() + ) + ->build(); ``` diff --git a/doc/models/list-sale-rep-item.md b/doc/models/list-sale-rep-item.md index da20d921..064a85be 100644 --- a/doc/models/list-sale-rep-item.md +++ b/doc/models/list-sale-rep-item.md @@ -15,31 +15,36 @@ | `mrrData` | [`?array`](../../doc/models/sale-rep-item-mrr.md) | Optional | - | getMrrData(): ?array | setMrrData(?array mrrData): void | | `testMode` | `?bool` | Optional | - | getTestMode(): ?bool | setTestMode(?bool testMode): void | -## Example (as JSON) - -```json -{ - "mrr_data": { - "november_2019": { - "mrr": "$0.00", - "usage": "$0.00", - "recurring": "$0.00" - }, - "december_2019": { - "mrr": "$0.00", - "usage": "$0.00", - "recurring": "$0.00" - }, - "january_2020": { - "mrr": "$400.00", - "usage": "$0.00", - "recurring": "$400.00" - } - }, - "id": 26, - "full_name": "full_name8", - "subscriptions_count": 154, - "test_mode": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSaleRepItemBuilder; +use AdvancedBillingLib\Models\Builders\SaleRepItemMrrBuilder; + +$listSaleRepItem = ListSaleRepItemBuilder::init() + ->id(54) + ->fullName('full_name2') + ->subscriptionsCount(126) + ->mrrData( + [ + 'november_2019' => SaleRepItemMrrBuilder::init() + ->mrr('$0.00') + ->usage('$0.00') + ->recurring('$0.00') + ->build(), + 'december_2019' => SaleRepItemMrrBuilder::init() + ->mrr('$0.00') + ->usage('$0.00') + ->recurring('$0.00') + ->build(), + 'january_2020' => SaleRepItemMrrBuilder::init() + ->mrr('$400.00') + ->usage('$0.00') + ->recurring('$400.00') + ->build() + ] + ) + ->testMode(false) + ->build(); ``` diff --git a/doc/models/list-segments-filter.md b/doc/models/list-segments-filter.md index 224f7f60..2ba0f2a9 100644 --- a/doc/models/list-segments-filter.md +++ b/doc/models/list-segments-filter.md @@ -14,14 +14,16 @@ | `segmentProperty3Value` | `?string` | Optional | The value passed here would be used to filter segments. Pass a value related to `segment_property_3` on attached Metric. If empty string is passed, this filter would be rejected. | getSegmentProperty3Value(): ?string | setSegmentProperty3Value(?string segmentProperty3Value): void | | `segmentProperty4Value` | `?string` | Optional | The value passed here would be used to filter segments. Pass a value related to `segment_property_4` on attached Metric. If empty string is passed, this filter would be rejected. | getSegmentProperty4Value(): ?string | setSegmentProperty4Value(?string segmentProperty4Value): void | -## Example (as JSON) - -```json -{ - "segment_property_1_value": "EU", - "segment_property_2_value": "segment_property_2_value4", - "segment_property_3_value": "segment_property_3_value2", - "segment_property_4_value": "segment_property_4_value6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSegmentsFilterBuilder; + +$listSegmentsFilter = ListSegmentsFilterBuilder::init() + ->segmentProperty1Value('EU') + ->segmentProperty2Value('segment_property_2_value6') + ->segmentProperty3Value('segment_property_3_value6') + ->segmentProperty4Value('segment_property_4_value8') + ->build(); ``` diff --git a/doc/models/list-segments-response.md b/doc/models/list-segments-response.md index 73e87c19..e4adc3dd 100644 --- a/doc/models/list-segments-response.md +++ b/doc/models/list-segments-response.md @@ -11,19 +11,32 @@ | --- | --- | --- | --- | --- | --- | | `segments` | [`?(Segment[])`](../../doc/models/segment.md) | Optional | - | getSegments(): ?array | setSegments(?array segments): void | -## Example (as JSON) - -```json -{ - "segments": [ - { - "id": 50, - "component_id": 160, - "price_point_id": 184, - "event_based_billing_metric_id": 244, - "pricing_scheme": "stairstep" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSegmentsResponseBuilder; +use AdvancedBillingLib\Models\Builders\SegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; + +$listSegmentsResponse = ListSegmentsResponseBuilder::init() + ->segments( + [ + SegmentBuilder::init() + ->id(50) + ->componentId(160) + ->pricePointId(184) + ->eventBasedBillingMetricId(244) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->build(), + SegmentBuilder::init() + ->id(50) + ->componentId(160) + ->pricePointId(184) + ->eventBasedBillingMetricId(244) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/list-service-credits-response.md b/doc/models/list-service-credits-response.md index 00db1c2f..a2dff467 100644 --- a/doc/models/list-service-credits-response.md +++ b/doc/models/list-service-credits-response.md @@ -11,26 +11,39 @@ | --- | --- | --- | --- | --- | --- | | `serviceCredits` | [`?(ServiceCredit1[])`](../../doc/models/service-credit-1.md) | Optional | - | getServiceCredits(): ?array | setServiceCredits(?array serviceCredits): void | -## Example (as JSON) - -```json -{ - "service_credits": [ - { - "id": 224, - "amount_in_cents": 54, - "ending_balance_in_cents": 94, - "entry_type": "Credit", - "memo": "memo2" - }, - { - "id": 224, - "amount_in_cents": 54, - "ending_balance_in_cents": 94, - "entry_type": "Credit", - "memo": "memo2" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListServiceCreditsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ServiceCredit1Builder; +use AdvancedBillingLib\Models\ServiceCreditType; + +$listServiceCreditsResponse = ListServiceCreditsResponseBuilder::init() + ->serviceCredits( + [ + ServiceCredit1Builder::init() + ->id(224) + ->amountInCents(54) + ->endingBalanceInCents(94) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo2') + ->build(), + ServiceCredit1Builder::init() + ->id(224) + ->amountInCents(54) + ->endingBalanceInCents(94) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo2') + ->build(), + ServiceCredit1Builder::init() + ->id(224) + ->amountInCents(54) + ->endingBalanceInCents(94) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo2') + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/list-subscription-components-filter.md b/doc/models/list-subscription-components-filter.md index 55df8022..86ef9494 100644 --- a/doc/models/list-subscription-components-filter.md +++ b/doc/models/list-subscription-components-filter.md @@ -12,15 +12,19 @@ | `currencies` | `?(string[])` | Optional | Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=EUR,USD`.

**Constraints**: *Minimum Items*: `1` | getCurrencies(): ?array | setCurrencies(?array currencies): void | | `useSiteExchangeRate` | `?bool` | Optional | Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | -## Example (as JSON) - -```json -{ - "currencies": [ - "EUR", - "USD" - ], - "use_site_exchange_rate": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionComponentsFilterBuilder; + +$listSubscriptionComponentsFilter = ListSubscriptionComponentsFilterBuilder::init() + ->currencies( + [ + 'EUR', + 'USD' + ] + ) + ->useSiteExchangeRate(false) + ->build(); ``` diff --git a/doc/models/list-subscription-components-for-site-filter.md b/doc/models/list-subscription-components-for-site-filter.md index 723d6472..2572c5b8 100644 --- a/doc/models/list-subscription-components-for-site-filter.md +++ b/doc/models/list-subscription-components-for-site-filter.md @@ -13,26 +13,38 @@ | `useSiteExchangeRate` | `?bool` | Optional | Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | | `subscription` | [`?SubscriptionFilter`](../../doc/models/subscription-filter.md) | Optional | Nested filter used for List Subscription Components For Site Filter | getSubscription(): ?SubscriptionFilter | setSubscription(?SubscriptionFilter subscription): void | -## Example (as JSON) - -```json -{ - "currencies": [ - "EUR", - "USD" - ], - "use_site_exchange_rate": false, - "subscription": { - "states": [ - "active", - "canceled", - "expired" - ], - "date_field": "updated_at", - "start_date": "2016-03-13", - "end_date": "2016-03-13", - "start_datetime": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionComponentsForSiteFilterBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionFilterBuilder; +use AdvancedBillingLib\Models\SubscriptionStateFilter; +use AdvancedBillingLib\Models\SubscriptionListDateField; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$listSubscriptionComponentsForSiteFilter = ListSubscriptionComponentsForSiteFilterBuilder::init() + ->currencies( + [ + 'EUR', + 'USD' + ] + ) + ->useSiteExchangeRate(false) + ->subscription( + SubscriptionFilterBuilder::init() + ->states( + [ + SubscriptionStateFilter::TRIALING, + SubscriptionStateFilter::UNPAID, + SubscriptionStateFilter::ACTIVE + ] + ) + ->dateField(SubscriptionListDateField::UPDATED_AT) + ->startDate(DateTimeHelper::fromSimpleDate('2016-03-13')) + ->endDate(DateTimeHelper::fromSimpleDate('2016-03-13')) + ->startDatetime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build(); ``` diff --git a/doc/models/list-subscription-components-include.md b/doc/models/list-subscription-components-include.md index 4bb14dd1..5d8782ac 100644 --- a/doc/models/list-subscription-components-include.md +++ b/doc/models/list-subscription-components-include.md @@ -14,7 +14,9 @@ ## Example -``` -subscription +```php +use AdvancedBillingLib\Models\ListSubscriptionComponentsInclude; + +$listSubscriptionComponentsInclude = ListSubscriptionComponentsInclude::SUBSCRIPTION; ``` diff --git a/doc/models/list-subscription-components-response.md b/doc/models/list-subscription-components-response.md index 45fd9906..ce655cac 100644 --- a/doc/models/list-subscription-components-response.md +++ b/doc/models/list-subscription-components-response.md @@ -11,19 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionsComponents` | [`SubscriptionComponent[]`](../../doc/models/subscription-component.md) | Required | - | getSubscriptionsComponents(): array | setSubscriptionsComponents(array subscriptionsComponents): void | -## Example (as JSON) - -```json -{ - "subscriptions_components": [ - { - "id": 138, - "name": "name2", - "kind": "metered_component", - "unit_name": "unit_name4", - "enabled": false - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionComponentsResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionComponentBuilder; +use AdvancedBillingLib\Models\ComponentKind; + +$listSubscriptionComponentsResponse = ListSubscriptionComponentsResponseBuilder::init( + [ + SubscriptionComponentBuilder::init() + ->id(138) + ->name('name2') + ->kind(ComponentKind::METERED_COMPONENT) + ->unitName('unit_name4') + ->enabled(false) + ->build() + ] +)->build(); ``` diff --git a/doc/models/list-subscription-components-sort.md b/doc/models/list-subscription-components-sort.md index 03af5d15..e4d88462 100644 --- a/doc/models/list-subscription-components-sort.md +++ b/doc/models/list-subscription-components-sort.md @@ -14,7 +14,9 @@ ## Example -``` -updated_at +```php +use AdvancedBillingLib\Models\ListSubscriptionComponentsSort; + +$listSubscriptionComponentsSort = ListSubscriptionComponentsSort::ID; ``` diff --git a/doc/models/list-subcription-group-prepayment-item.md b/doc/models/list-subscription-group-prepayment-item.md similarity index 73% rename from doc/models/list-subcription-group-prepayment-item.md rename to doc/models/list-subscription-group-prepayment-item.md index bc98c37b..baf65b7d 100644 --- a/doc/models/list-subcription-group-prepayment-item.md +++ b/doc/models/list-subscription-group-prepayment-item.md @@ -1,9 +1,9 @@ -# List Subcription Group Prepayment Item +# List Subscription Group Prepayment Item ## Structure -`ListSubcriptionGroupPrepaymentItem` +`ListSubscriptionGroupPrepaymentItem` ## Fields @@ -19,15 +19,17 @@ | `paymentType` | [`?string(PrepaymentMethod)`](../../doc/models/prepayment-method.md) | Optional | - | getPaymentType(): ?string | setPaymentType(?string paymentType): void | | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | -## Example (as JSON) +## Example -```json -{ - "id": 254, - "subscription_group_uid": "subscription_group_uid6", - "amount_in_cents": 172, - "remaining_amount_in_cents": 142, - "details": "details2" -} +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupPrepaymentItemBuilder; + +$listSubscriptionGroupPrepaymentItem = ListSubscriptionGroupPrepaymentItemBuilder::init() + ->id(72) + ->subscriptionGroupUid('subscription_group_uid6') + ->amountInCents(98) + ->remainingAmountInCents(216) + ->details('details2') + ->build(); ``` diff --git a/doc/models/list-subscription-group-prepayment-response.md b/doc/models/list-subscription-group-prepayment-response.md index 9f8ae6f0..6ebcc655 100644 --- a/doc/models/list-subscription-group-prepayment-response.md +++ b/doc/models/list-subscription-group-prepayment-response.md @@ -11,21 +11,25 @@ | --- | --- | --- | --- | --- | --- | | `prepayments` | [`ListSubscriptionGroupPrepayment[]`](../../doc/models/list-subscription-group-prepayment.md) | Required | - | getPrepayments(): array | setPrepayments(array prepayments): void | -## Example (as JSON) - -```json -{ - "prepayments": [ - { - "prepayment": { - "id": 38, - "subscription_group_uid": "subscription_group_uid2", - "amount_in_cents": 124, - "remaining_amount_in_cents": 182, - "details": "details8" - } - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupPrepaymentResponseBuilder; +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupPrepaymentBuilder; +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupPrepaymentItemBuilder; + +$listSubscriptionGroupPrepaymentResponse = ListSubscriptionGroupPrepaymentResponseBuilder::init( + [ + ListSubscriptionGroupPrepaymentBuilder::init( + ListSubscriptionGroupPrepaymentItemBuilder::init() + ->id(38) + ->subscriptionGroupUid('subscription_group_uid2') + ->amountInCents(124) + ->remainingAmountInCents(182) + ->details('details8') + ->build() + )->build() + ] +)->build(); ``` diff --git a/doc/models/list-subscription-group-prepayment.md b/doc/models/list-subscription-group-prepayment.md index dc62dbb6..f27f8a73 100644 --- a/doc/models/list-subscription-group-prepayment.md +++ b/doc/models/list-subscription-group-prepayment.md @@ -9,19 +9,22 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `prepayment` | [`ListSubcriptionGroupPrepaymentItem`](../../doc/models/list-subcription-group-prepayment-item.md) | Required | - | getPrepayment(): ListSubcriptionGroupPrepaymentItem | setPrepayment(ListSubcriptionGroupPrepaymentItem prepayment): void | - -## Example (as JSON) - -```json -{ - "prepayment": { - "id": 38, - "subscription_group_uid": "subscription_group_uid2", - "amount_in_cents": 124, - "remaining_amount_in_cents": 182, - "details": "details8" - } -} +| `prepayment` | [`ListSubscriptionGroupPrepaymentItem`](../../doc/models/list-subscription-group-prepayment-item.md) | Required | - | getPrepayment(): ListSubscriptionGroupPrepaymentItem | setPrepayment(ListSubscriptionGroupPrepaymentItem prepayment): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupPrepaymentBuilder; +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupPrepaymentItemBuilder; + +$listSubscriptionGroupPrepayment = ListSubscriptionGroupPrepaymentBuilder::init( + ListSubscriptionGroupPrepaymentItemBuilder::init() + ->id(38) + ->subscriptionGroupUid('subscription_group_uid2') + ->amountInCents(124) + ->remainingAmountInCents(182) + ->details('details8') + ->build() +)->build(); ``` diff --git a/doc/models/list-subscription-groups-item.md b/doc/models/list-subscription-groups-item.md index 82eb3b4e..2e9c2d33 100644 --- a/doc/models/list-subscription-groups-item.md +++ b/doc/models/list-subscription-groups-item.md @@ -21,17 +21,22 @@ | `accountBalances` | [`?SubscriptionGroupBalances`](../../doc/models/subscription-group-balances.md) | Optional | - | getAccountBalances(): ?SubscriptionGroupBalances | setAccountBalances(?SubscriptionGroupBalances accountBalances): void | | `groupType` | [`?string(GroupType)`](../../doc/models/group-type.md) | Optional | - | getGroupType(): ?string | setGroupType(?string groupType): void | -## Example (as JSON) - -```json -{ - "uid": "uid0", - "scheme": 124, - "customer_id": 144, - "payment_profile_id": 52, - "subscription_ids": [ - 254 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupsItemBuilder; + +$listSubscriptionGroupsItem = ListSubscriptionGroupsItemBuilder::init() + ->uid('uid0') + ->scheme(228) + ->customerId(248) + ->paymentProfileId(100) + ->subscriptionIds( + [ + 102, + 103 + ] + ) + ->build(); ``` diff --git a/doc/models/list-subscription-groups-meta.md b/doc/models/list-subscription-groups-meta.md index e985664e..670302af 100644 --- a/doc/models/list-subscription-groups-meta.md +++ b/doc/models/list-subscription-groups-meta.md @@ -12,12 +12,14 @@ | `currentPage` | `?int` | Optional | - | getCurrentPage(): ?int | setCurrentPage(?int currentPage): void | | `totalCount` | `?int` | Optional | - | getTotalCount(): ?int | setTotalCount(?int totalCount): void | -## Example (as JSON) +## Example -```json -{ - "current_page": 14, - "total_count": 38 -} +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupsMetaBuilder; + +$listSubscriptionGroupsMeta = ListSubscriptionGroupsMetaBuilder::init() + ->currentPage(104) + ->totalCount(128) + ->build(); ``` diff --git a/doc/models/list-subscription-groups-response.md b/doc/models/list-subscription-groups-response.md index c3a6af9f..50bd39c5 100644 --- a/doc/models/list-subscription-groups-response.md +++ b/doc/models/list-subscription-groups-response.md @@ -12,43 +12,35 @@ | `subscriptionGroups` | [`?(ListSubscriptionGroupsItem[])`](../../doc/models/list-subscription-groups-item.md) | Optional | - | getSubscriptionGroups(): ?array | setSubscriptionGroups(?array subscriptionGroups): void | | `meta` | [`?ListSubscriptionGroupsMeta`](../../doc/models/list-subscription-groups-meta.md) | Optional | - | getMeta(): ?ListSubscriptionGroupsMeta | setMeta(?ListSubscriptionGroupsMeta meta): void | -## Example (as JSON) - -```json -{ - "subscription_groups": [ - { - "uid": "uid2", - "scheme": 166, - "customer_id": 186, - "payment_profile_id": 162, - "subscription_ids": [ - 40 - ] - }, - { - "uid": "uid2", - "scheme": 166, - "customer_id": 186, - "payment_profile_id": 162, - "subscription_ids": [ - 40 - ] - }, - { - "uid": "uid2", - "scheme": 166, - "customer_id": 186, - "payment_profile_id": 162, - "subscription_ids": [ - 40 - ] - } - ], - "meta": { - "current_page": 126, - "total_count": 150 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupsItemBuilder; +use AdvancedBillingLib\Models\Builders\ListSubscriptionGroupsMetaBuilder; + +$listSubscriptionGroupsResponse = ListSubscriptionGroupsResponseBuilder::init() + ->subscriptionGroups( + [ + ListSubscriptionGroupsItemBuilder::init() + ->uid('uid2') + ->scheme(166) + ->customerId(186) + ->paymentProfileId(162) + ->subscriptionIds( + [ + 40 + ] + ) + ->build() + ] + ) + ->meta( + ListSubscriptionGroupsMetaBuilder::init() + ->currentPage(126) + ->totalCount(150) + ->build() + ) + ->build(); ``` diff --git a/doc/models/metadata.md b/doc/models/metadata.md index d3a636d6..7ffc2619 100644 --- a/doc/models/metadata.md +++ b/doc/models/metadata.md @@ -16,15 +16,18 @@ | `deletedAt` | `?DateTime` | Optional | - | getDeletedAt(): ?\DateTime | setDeletedAt(?\DateTime deletedAt): void | | `metafieldId` | `?int` | Optional | - | getMetafieldId(): ?int | setMetafieldId(?int metafieldId): void | -## Example (as JSON) - -```json -{ - "id": 12, - "value": "value0", - "resource_id": 96, - "name": "name8", - "deleted_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MetadataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$metadata = MetadataBuilder::init() + ->id(50) + ->value('value8') + ->resourceId(134) + ->name('name6') + ->deletedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/metafield-input.md b/doc/models/metafield-input.md index 75443bd3..00021a24 100644 --- a/doc/models/metafield-input.md +++ b/doc/models/metafield-input.md @@ -1,7 +1,7 @@ # Metafield Input -Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. +Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. ## Enumeration @@ -16,3 +16,11 @@ Indicates the type of metafield. A text metafield allows any string value. Dropd | `RADIO` | | `DROPDOWN` | +## Example + +```php +use AdvancedBillingLib\Models\MetafieldInput; + +$metafieldInput = MetafieldInput::BALANCE_TRACKER; +``` + diff --git a/doc/models/metafield-scope.md b/doc/models/metafield-scope.md index 818e94b7..e2aa656a 100644 --- a/doc/models/metafield-scope.md +++ b/doc/models/metafield-scope.md @@ -19,15 +19,18 @@ Warning: When updating a metafield's scope attribute, all scope attributes must | `publicEdit` | [`?string(IncludeOption)`](../../doc/models/include-option.md) | Optional | Include (1) or exclude (0) metafields used in [Embeddable Components](page:development-tools/embeddable-components/overview) from being editable by your ecosystem. | getPublicEdit(): ?string | setPublicEdit(?string publicEdit): void | | `hosted` | `?(string[])` | Optional | - | getHosted(): ?array | setHosted(?array hosted): void | -## Example (as JSON) - -```json -{ - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; + +$metafieldScope = MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build(); ``` diff --git a/doc/models/metafield.md b/doc/models/metafield.md index 71b49ab7..7e29283e 100644 --- a/doc/models/metafield.md +++ b/doc/models/metafield.md @@ -13,24 +13,31 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `scope` | [`?MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | getScope(): ?MetafieldScope | setScope(?MetafieldScope scope): void | | `dataCount` | `?int` | Optional | The amount of subscriptions this metafield has been applied to in Advanced Billing. | getDataCount(): ?int | setDataCount(?int dataCount): void | -| `inputType` | [`?string(MetafieldInput)`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | getInputType(): ?string | setInputType(?string inputType): void | +| `inputType` | [`?string(MetafieldInput)`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | getInputType(): ?string | setInputType(?string inputType): void | | `enum` | string\|string[]\|null | Optional | This is a container for one-of cases. | getEnum(): | setEnum( enum): void | -## Example (as JSON) - -```json -{ - "id": 52, - "name": "name8", - "scope": { - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0" - }, - "data_count": 216, - "input_type": "radio" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MetafieldBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; +use AdvancedBillingLib\Models\MetafieldInput; + +$metafield = MetafieldBuilder::init() + ->id(242) + ->name('name4') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build() + ) + ->dataCount(26) + ->inputType(MetafieldInput::BALANCE_TRACKER) + ->build(); ``` diff --git a/doc/models/metered-component.md b/doc/models/metered-component.md index 70d587e7..fb531fd3 100644 --- a/doc/models/metered-component.md +++ b/doc/models/metered-component.md @@ -9,10 +9,10 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes". | getName(): string | setName(string name): void | -| `unitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item | getUnitName(): string | setUnitName(string unitName): void | +| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, e.g., "Minutes". | getName(): string | setName(string name): void | +| `unitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on a subscription’s component line-item | getUnitName(): string | setUnitName(string unitName): void | | `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 | +| `handle` | `?string` | Optional | A unique identifier for your use that can be used to retrieve this component in 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 | | `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 | @@ -23,35 +23,73 @@ | `displayOnHostedPage` | `?bool` | Optional | - | getDisplayOnHostedPage(): ?bool | setDisplayOnHostedPage(?bool displayOnHostedPage): void | | `allowFractionalQuantities` | `?bool` | Optional | - | getAllowFractionalQuantities(): ?bool | setAllowFractionalQuantities(?bool allowFractionalQuantities): void | | `publicSignupPageIds` | `?(int[])` | Optional | - | getPublicSignupPageIds(): ?array | setPublicSignupPageIds(?array publicSignupPageIds): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | -## Example (as JSON) - -```json -{ - "name": "name4", - "unit_name": "unit_name6", - "description": "description6", - "handle": "handle0", - "taxable": false, - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "price_points": [ - { - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "interval": 92, - "interval_unit": "day" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MeteredComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\ComponentPricePointItemBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$meteredComponent = MeteredComponentBuilder::init( + 'name6', + 'unit_name8', + PricingScheme::STAIRSTEP +) + ->description('description4') + ->handle('handle2') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->pricePoints( + [ + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build(), + ComponentPricePointItemBuilder::init() + ->name('name2') + ->handle('handle8') + ->pricingScheme(PricingScheme::PER_UNIT) + ->interval(92) + ->intervalUnit(IntervalUnit::DAY) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/metered-usage.md b/doc/models/metered-usage.md index f9547e84..30c01950 100644 --- a/doc/models/metered-usage.md +++ b/doc/models/metered-usage.md @@ -10,22 +10,24 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `previousUnitBalance` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getPreviousUnitBalance(): string | setPreviousUnitBalance(string previousUnitBalance): void | -| `newUnitBalance` | `int` | Required | - | getNewUnitBalance(): int | setNewUnitBalance(int newUnitBalance): void | +| `newUnitBalance` | int\|string | Required | This is a container for one-of cases. | getNewUnitBalance(): | setNewUnitBalance( newUnitBalance): void | | `usageQuantity` | `int` | Required | - | getUsageQuantity(): int | setUsageQuantity(int usageQuantity): void | | `componentId` | `int` | Required | - | getComponentId(): int | setComponentId(int componentId): void | | `componentHandle` | `string` | Required | - | getComponentHandle(): string | setComponentHandle(string componentHandle): void | | `memo` | `string` | Required | - | getMemo(): string | setMemo(string memo): void | -## Example (as JSON) - -```json -{ - "previous_unit_balance": "previous_unit_balance6", - "new_unit_balance": 80, - "usage_quantity": 42, - "component_id": 4, - "component_handle": "component_handle8", - "memo": "memo2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MeteredUsageBuilder; + +$meteredUsage = MeteredUsageBuilder::init( + 'previous_unit_balance6', + 66, + 106, + 68, + 'component_handle0', + 'memo4' +)->build(); ``` diff --git a/doc/models/movement-line-item.md b/doc/models/movement-line-item.md index 4120778c..4095c54b 100644 --- a/doc/models/movement-line-item.md +++ b/doc/models/movement-line-item.md @@ -19,15 +19,17 @@ | `prevQuantity` | `?int` | Optional | - | getPrevQuantity(): ?int | setPrevQuantity(?int prevQuantity): void | | `recurring` | `?bool` | Optional | When `true`, the line item's MRR value will contribute to the `plan` breakout. When `false`, the line item contributes to the `usage` breakout. | getRecurring(): ?bool | setRecurring(?bool recurring): void | -## Example (as JSON) - -```json -{ - "product_id": 156, - "component_id": 68, - "price_point_id": 164, - "name": "name6", - "mrr": 154 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MovementLineItemBuilder; + +$movementLineItem = MovementLineItemBuilder::init() + ->productId(146) + ->componentId(58) + ->pricePointId(82) + ->name('name8') + ->mrr(92) + ->build(); ``` diff --git a/doc/models/movement.md b/doc/models/movement.md index eeed8ae3..7b95170f 100644 --- a/doc/models/movement.md +++ b/doc/models/movement.md @@ -19,15 +19,18 @@ | `subscriptionId` | `?int` | Optional | - | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `subscriberName` | `?string` | Optional | - | getSubscriberName(): ?string | setSubscriberName(?string subscriberName): void | -## Example (as JSON) - -```json -{ - "timestamp": "2016-03-13T12:52:32.123Z", - "amount_in_cents": 174, - "amount_formatted": "amount_formatted4", - "description": "description2", - "category": "category0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MovementBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$movement = MovementBuilder::init() + ->timestamp(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->amountInCents(34) + ->amountFormatted('amount_formatted6') + ->description('description4') + ->category('category2') + ->build(); ``` diff --git a/doc/models/mrr-movement.md b/doc/models/mrr-movement.md index 6a6af042..1b2beef9 100644 --- a/doc/models/mrr-movement.md +++ b/doc/models/mrr-movement.md @@ -14,14 +14,16 @@ | `subscriberDelta` | `?int` | Optional | - | getSubscriberDelta(): ?int | setSubscriberDelta(?int subscriberDelta): void | | `leadDelta` | `?int` | Optional | - | getLeadDelta(): ?int | setLeadDelta(?int leadDelta): void | -## Example (as JSON) - -```json -{ - "amount": 210, - "category": "category0", - "subscriber_delta": 170, - "lead_delta": 198 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MRRMovementBuilder; + +$mRRMovement = MRRMovementBuilder::init() + ->amount(116) + ->category('category4') + ->subscriberDelta(100) + ->leadDelta(128) + ->build(); ``` diff --git a/doc/models/mrr-response.md b/doc/models/mrr-response.md index f6ec0688..89000922 100644 --- a/doc/models/mrr-response.md +++ b/doc/models/mrr-response.md @@ -11,22 +11,28 @@ | --- | --- | --- | --- | --- | --- | | `mrr` | [`MRR`](../../doc/models/mrr.md) | Required | - | getMrr(): MRR | setMrr(MRR mrr): void | -## Example (as JSON) - -```json -{ - "mrr": { - "amount_in_cents": 198, - "amount_formatted": "amount_formatted6", - "currency": "currency4", - "currency_symbol": "currency_symbol2", - "breakouts": { - "plan_amount_in_cents": 254, - "plan_amount_formatted": "plan_amount_formatted0", - "usage_amount_in_cents": 106, - "usage_amount_formatted": "usage_amount_formatted8" - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MRRResponseBuilder; +use AdvancedBillingLib\Models\Builders\MRRBuilder; +use AdvancedBillingLib\Models\Builders\BreakoutsBuilder; + +$mRRResponse = MRRResponseBuilder::init( + MRRBuilder::init() + ->amountInCents(198) + ->amountFormatted('amount_formatted6') + ->currency('currency4') + ->currencySymbol('currency_symbol2') + ->breakouts( + BreakoutsBuilder::init() + ->planAmountInCents(254) + ->planAmountFormatted('plan_amount_formatted0') + ->usageAmountInCents(106) + ->usageAmountFormatted('usage_amount_formatted8') + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/mrr.md b/doc/models/mrr.md index 38ba4a4f..e28a9343 100644 --- a/doc/models/mrr.md +++ b/doc/models/mrr.md @@ -16,20 +16,25 @@ | `breakouts` | [`?Breakouts`](../../doc/models/breakouts.md) | Optional | - | getBreakouts(): ?Breakouts | setBreakouts(?Breakouts breakouts): void | | `atTime` | `?DateTime` | Optional | ISO8601 timestamp | getAtTime(): ?\DateTime | setAtTime(?\DateTime atTime): void | -## Example (as JSON) - -```json -{ - "amount_in_cents": 208, - "amount_formatted": "amount_formatted2", - "currency": "currency0", - "currency_symbol": "currency_symbol8", - "breakouts": { - "plan_amount_in_cents": 254, - "plan_amount_formatted": "plan_amount_formatted0", - "usage_amount_in_cents": 106, - "usage_amount_formatted": "usage_amount_formatted8" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MRRBuilder; +use AdvancedBillingLib\Models\Builders\BreakoutsBuilder; + +$mRR = MRRBuilder::init() + ->amountInCents(122) + ->amountFormatted('amount_formatted4') + ->currency('currency2') + ->currencySymbol('currency_symbol0') + ->breakouts( + BreakoutsBuilder::init() + ->planAmountInCents(254) + ->planAmountFormatted('plan_amount_formatted0') + ->usageAmountInCents(106) + ->usageAmountFormatted('usage_amount_formatted8') + ->build() + ) + ->build(); ``` diff --git a/doc/models/multi-invoice-payment-response.md b/doc/models/multi-invoice-payment-response.md index 9e567220..4d175052 100644 --- a/doc/models/multi-invoice-payment-response.md +++ b/doc/models/multi-invoice-payment-response.md @@ -11,32 +11,38 @@ | --- | --- | --- | --- | --- | --- | | `payment` | [`MultiInvoicePayment`](../../doc/models/multi-invoice-payment.md) | Required | - | getPayment(): MultiInvoicePayment | setPayment(MultiInvoicePayment payment): void | -## Example (as JSON) - -```json -{ - "payment": { - "transaction_id": 224, - "total_amount": "total_amount2", - "currency_code": "currency_code2", - "applications": [ - { - "invoice_uid": "invoice_uid8", - "application_uid": "application_uid8", - "applied_amount": "applied_amount0" - }, - { - "invoice_uid": "invoice_uid8", - "application_uid": "application_uid8", - "applied_amount": "applied_amount0" - }, - { - "invoice_uid": "invoice_uid8", - "application_uid": "application_uid8", - "applied_amount": "applied_amount0" - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MultiInvoicePaymentResponseBuilder; +use AdvancedBillingLib\Models\Builders\MultiInvoicePaymentBuilder; +use AdvancedBillingLib\Models\Builders\InvoicePaymentApplicationBuilder; + +$multiInvoicePaymentResponse = MultiInvoicePaymentResponseBuilder::init( + MultiInvoicePaymentBuilder::init() + ->transactionId(224) + ->totalAmount('total_amount2') + ->currencyCode('currency_code2') + ->applications( + [ + InvoicePaymentApplicationBuilder::init() + ->invoiceUid('invoice_uid8') + ->applicationUid('application_uid8') + ->appliedAmount('applied_amount0') + ->build(), + InvoicePaymentApplicationBuilder::init() + ->invoiceUid('invoice_uid8') + ->applicationUid('application_uid8') + ->appliedAmount('applied_amount0') + ->build(), + InvoicePaymentApplicationBuilder::init() + ->invoiceUid('invoice_uid8') + ->applicationUid('application_uid8') + ->appliedAmount('applied_amount0') + ->build() + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/multi-invoice-payment.md b/doc/models/multi-invoice-payment.md index 0f1542dd..6caeb109 100644 --- a/doc/models/multi-invoice-payment.md +++ b/doc/models/multi-invoice-payment.md @@ -14,20 +14,30 @@ | `currencyCode` | `?string` | Optional | The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. | getCurrencyCode(): ?string | setCurrencyCode(?string currencyCode): void | | `applications` | [`?(InvoicePaymentApplication[])`](../../doc/models/invoice-payment-application.md) | Optional | - | getApplications(): ?array | setApplications(?array applications): void | -## Example (as JSON) - -```json -{ - "transaction_id": 144, - "total_amount": "total_amount2", - "currency_code": "currency_code2", - "applications": [ - { - "invoice_uid": "invoice_uid8", - "application_uid": "application_uid8", - "applied_amount": "applied_amount0" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\MultiInvoicePaymentBuilder; +use AdvancedBillingLib\Models\Builders\InvoicePaymentApplicationBuilder; + +$multiInvoicePayment = MultiInvoicePaymentBuilder::init() + ->transactionId(246) + ->totalAmount('total_amount0') + ->currencyCode('currency_code0') + ->applications( + [ + InvoicePaymentApplicationBuilder::init() + ->invoiceUid('invoice_uid8') + ->applicationUid('application_uid8') + ->appliedAmount('applied_amount0') + ->build(), + InvoicePaymentApplicationBuilder::init() + ->invoiceUid('invoice_uid8') + ->applicationUid('application_uid8') + ->appliedAmount('applied_amount0') + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/nested-subscription-group.md b/doc/models/nested-subscription-group.md index 55f69195..6bf3b462 100644 --- a/doc/models/nested-subscription-group.md +++ b/doc/models/nested-subscription-group.md @@ -14,14 +14,16 @@ | `primarySubscriptionId` | `?int` | Optional | The subscription ID of the primary within the group. Applicable to scheme 1. | getPrimarySubscriptionId(): ?int | setPrimarySubscriptionId(?int primarySubscriptionId): void | | `primary` | `?bool` | Optional | A boolean indicating whether the subscription is the primary in the group. Applicable to scheme 1. | getPrimary(): ?bool | setPrimary(?bool primary): void | -## Example (as JSON) - -```json -{ - "uid": "uid2", - "scheme": 62, - "primary_subscription_id": 10, - "primary": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\NestedSubscriptionGroupBuilder; + +$nestedSubscriptionGroup = NestedSubscriptionGroupBuilder::init() + ->uid('uid6') + ->scheme(106) + ->primarySubscriptionId(54) + ->primary(false) + ->build(); ``` diff --git a/doc/models/net-terms.md b/doc/models/net-terms.md index 66fe8c4e..1653d94e 100644 --- a/doc/models/net-terms.md +++ b/doc/models/net-terms.md @@ -15,15 +15,17 @@ | `netTermsOnRemittanceSignupsEnabled` | `?bool` | Optional | **Default**: `false` | getNetTermsOnRemittanceSignupsEnabled(): ?bool | setNetTermsOnRemittanceSignupsEnabled(?bool netTermsOnRemittanceSignupsEnabled): void | | `customNetTermsEnabled` | `?bool` | Optional | **Default**: `false` | getCustomNetTermsEnabled(): ?bool | setCustomNetTermsEnabled(?bool customNetTermsEnabled): void | -## Example (as JSON) - -```json -{ - "default_net_terms": 0, - "automatic_net_terms": 0, - "remittance_net_terms": 0, - "net_terms_on_remittance_signups_enabled": false, - "custom_net_terms_enabled": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\NetTermsBuilder; + +$netTerms = NetTermsBuilder::init() + ->defaultNetTerms(0) + ->automaticNetTerms(0) + ->remittanceNetTerms(0) + ->netTermsOnRemittanceSignupsEnabled(false) + ->customNetTermsEnabled(false) + ->build(); ``` diff --git a/doc/models/offer-discount.md b/doc/models/offer-discount.md index 87497c8d..0d477380 100644 --- a/doc/models/offer-discount.md +++ b/doc/models/offer-discount.md @@ -13,13 +13,15 @@ | `couponId` | `?int` | Optional | - | getCouponId(): ?int | setCouponId(?int couponId): void | | `couponName` | `?string` | Optional | - | getCouponName(): ?string | setCouponName(?string couponName): void | -## Example (as JSON) - -```json -{ - "coupon_code": "coupon_code8", - "coupon_id": 86, - "coupon_name": "coupon_name4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OfferDiscountBuilder; + +$offerDiscount = OfferDiscountBuilder::init() + ->couponCode('coupon_code6') + ->couponId(202) + ->couponName('coupon_name6') + ->build(); ``` diff --git a/doc/models/offer-item.md b/doc/models/offer-item.md index a3eb9578..2fa6825a 100644 --- a/doc/models/offer-item.md +++ b/doc/models/offer-item.md @@ -17,18 +17,20 @@ | `componentName` | `?string` | Optional | - | getComponentName(): ?string | setComponentName(?string componentName): void | | `pricePointName` | `?string` | Optional | - | getPricePointName(): ?string | setPricePointName(?string pricePointName): void | | `currencyPrices` | [`?(CurrencyPrice[])`](../../doc/models/currency-price.md) | Optional | - | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): 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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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 | -## Example (as JSON) +## Example -```json -{ - "component_id": 216, - "price_point_id": 16, - "starting_quantity": "starting_quantity0", - "editable": false, - "component_unit_price": "component_unit_price8" -} +```php +use AdvancedBillingLib\Models\Builders\OfferItemBuilder; + +$offerItem = OfferItemBuilder::init() + ->componentId(234) + ->pricePointId(254) + ->startingQuantity('starting_quantity6') + ->editable(false) + ->componentUnitPrice('component_unit_price2') + ->build(); ``` diff --git a/doc/models/offer-response.md b/doc/models/offer-response.md index c6c3cd9d..4daf6b39 100644 --- a/doc/models/offer-response.md +++ b/doc/models/offer-response.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `offer` | [`?Offer`](../../doc/models/offer.md) | Optional | - | getOffer(): ?Offer | setOffer(?Offer offer): void | -## Example (as JSON) - -```json -{ - "offer": { - "id": 28, - "site_id": 210, - "product_family_id": 224, - "product_id": 30, - "product_price_point_id": 150 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OfferResponseBuilder; +use AdvancedBillingLib\Models\Builders\OfferBuilder; + +$offerResponse = OfferResponseBuilder::init() + ->offer( + OfferBuilder::init() + ->id(28) + ->siteId(210) + ->productFamilyId(224) + ->productId(30) + ->productPricePointId(150) + ->build() + ) + ->build(); ``` diff --git a/doc/models/offer-signup-page.md b/doc/models/offer-signup-page.md index a8df294f..f48d74e8 100644 --- a/doc/models/offer-signup-page.md +++ b/doc/models/offer-signup-page.md @@ -16,15 +16,17 @@ | `returnParams` | `?string` | Optional | - | getReturnParams(): ?string | setReturnParams(?string returnParams): void | | `url` | `?string` | Optional | - | getUrl(): ?string | setUrl(?string url): void | -## Example (as JSON) - -```json -{ - "id": 50, - "nickname": "nickname8", - "enabled": false, - "return_url": "return_url2", - "return_params": "return_params0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OfferSignupPageBuilder; + +$offerSignupPage = OfferSignupPageBuilder::init() + ->id(102) + ->nickname('nickname6') + ->enabled(false) + ->returnUrl('return_url6') + ->returnParams('return_params8') + ->build(); ``` diff --git a/doc/models/offer.md b/doc/models/offer.md index bfbe2f90..5e248bb5 100644 --- a/doc/models/offer.md +++ b/doc/models/offer.md @@ -29,15 +29,17 @@ | `productPriceInCents` | `?int` | Optional | - | getProductPriceInCents(): ?int | setProductPriceInCents(?int productPriceInCents): void | | `offerSignupPages` | [`?(OfferSignupPage[])`](../../doc/models/offer-signup-page.md) | Optional | - | getOfferSignupPages(): ?array | setOfferSignupPages(?array offerSignupPages): void | -## Example (as JSON) - -```json -{ - "id": 154, - "site_id": 80, - "product_family_id": 158, - "product_id": 96, - "product_price_point_id": 20 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OfferBuilder; + +$offer = OfferBuilder::init() + ->id(28) + ->siteId(210) + ->productFamilyId(224) + ->productId(30) + ->productPricePointId(150) + ->build(); ``` diff --git a/doc/models/ok-response.md b/doc/models/ok-response.md index ddd3207f..3f99c8b7 100644 --- a/doc/models/ok-response.md +++ b/doc/models/ok-response.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `ok` | `?string` | Optional | - | getOk(): ?string | setOk(?string ok): void | -## Example (as JSON) +## Example -```json -{ - "ok": "ok4" -} +```php +use AdvancedBillingLib\Models\Builders\OkResponseBuilder; + +$okResponse = OkResponseBuilder::init() + ->ok('ok8') + ->build(); ``` diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index f52047ea..632c07c5 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -9,9 +9,9 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes". | getName(): string | setName(string name): void | +| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, e.g., "Minutes". | getName(): string | setName(string name): void | | `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 | +| `handle` | `?string` | Optional | A unique identifier for your use that can be used to retrieve this component in 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. | 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 | @@ -22,20 +22,25 @@ | `displayOnHostedPage` | `?bool` | Optional | - | getDisplayOnHostedPage(): ?bool | setDisplayOnHostedPage(?bool displayOnHostedPage): void | | `allowFractionalQuantities` | `?bool` | Optional | - | getAllowFractionalQuantities(): ?bool | setAllowFractionalQuantities(?bool allowFractionalQuantities): void | | `publicSignupPageIds` | `?(int[])` | Optional | - | getPublicSignupPageIds(): ?array | setPublicSignupPageIds(?array publicSignupPageIds): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | - -## Example (as JSON) - -```json -{ - "name": "name2", - "description": "description2", - "handle": "handle8", - "taxable": false, - "upgrade_charge": "prorated", - "downgrade_credit": "prorated", - "unit_price": "String1" -} +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\OnOffComponentBuilder; +use AdvancedBillingLib\Models\CreditType; + +$onOffComponent = OnOffComponentBuilder::init( + 'name0', + 'String9' +) + ->description('description0') + ->handle('handle6') + ->taxable(false) + ->upgradeCharge(CreditType::FULL) + ->downgradeCredit(CreditType::FULL) + ->build(); ``` diff --git a/doc/models/organization-address.md b/doc/models/organization-address.md index d35d144f..a9d2e06c 100644 --- a/doc/models/organization-address.md +++ b/doc/models/organization-address.md @@ -18,15 +18,17 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `phone` | `?string` | Optional | - | getPhone(): ?string | setPhone(?string phone): void | -## Example (as JSON) - -```json -{ - "street": "street4", - "line2": "line28", - "city": "city4", - "state": "state0", - "zip": "zip2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OrganizationAddressBuilder; + +$organizationAddress = OrganizationAddressBuilder::init() + ->street('street2') + ->line2('line26') + ->city('city2') + ->state('state8') + ->zip('zip6') + ->build(); ``` diff --git a/doc/models/origin-invoice.md b/doc/models/origin-invoice.md index c58ba796..db06eafb 100644 --- a/doc/models/origin-invoice.md +++ b/doc/models/origin-invoice.md @@ -12,12 +12,14 @@ | `uid` | `?string` | Optional | The UID of the invoice serving as an origin invoice. | getUid(): ?string | setUid(?string uid): void | | `number` | `?string` | Optional | The number of the invoice serving as an origin invoice. | getNumber(): ?string | setNumber(?string number): void | -## Example (as JSON) +## Example -```json -{ - "uid": "uid0", - "number": "number8" -} +```php +use AdvancedBillingLib\Models\Builders\OriginInvoiceBuilder; + +$originInvoice = OriginInvoiceBuilder::init() + ->uid('uid8') + ->number('number4') + ->build(); ``` diff --git a/doc/models/overage-pricing.md b/doc/models/overage-pricing.md index 4c479556..558049f3 100644 --- a/doc/models/overage-pricing.md +++ b/doc/models/overage-pricing.md @@ -12,28 +12,36 @@ | `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 | - | getPrices(): ?array | setPrices(?array prices): void | -## Example (as JSON) - -```json -{ - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OveragePricingBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; + +$overagePricing = OveragePricingBuilder::init( + PricingScheme::PER_UNIT +) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/override-subscription-request.md b/doc/models/override-subscription-request.md index 06aa962d..f4a5cb5e 100644 --- a/doc/models/override-subscription-request.md +++ b/doc/models/override-subscription-request.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`OverrideSubscription`](../../doc/models/override-subscription.md) | Required | - | getSubscription(): OverrideSubscription | setSubscription(OverrideSubscription subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "activated_at": "2016-03-13T12:52:32.123Z", - "canceled_at": "2016-03-13T12:52:32.123Z", - "cancellation_message": "cancellation_message2", - "expires_at": "2016-03-13T12:52:32.123Z", - "current_period_starts_at": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OverrideSubscriptionRequestBuilder; +use AdvancedBillingLib\Models\Builders\OverrideSubscriptionBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$overrideSubscriptionRequest = OverrideSubscriptionRequestBuilder::init( + OverrideSubscriptionBuilder::init() + ->activatedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->canceledAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->cancellationMessage('cancellation_message2') + ->expiresAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->currentPeriodStartsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() +)->build(); ``` diff --git a/doc/models/override-subscription.md b/doc/models/override-subscription.md index 347885ba..3e31fb70 100644 --- a/doc/models/override-subscription.md +++ b/doc/models/override-subscription.md @@ -15,15 +15,18 @@ | `expiresAt` | `?DateTime` | Optional | Can be used to record an external expiration date. Chargify sets this field automatically when a subscription expires (ceases billing) after a prescribed amount of time. Only ISO8601 format is supported. This field is not supported when Multi-frequency is enabled for the Site. To change the Term End of a Subscription, use the Update Subscription endpoint. | getExpiresAt(): ?\DateTime | setExpiresAt(?\DateTime expiresAt): void | | `currentPeriodStartsAt` | `?DateTime` | Optional | Can only be used when a subscription is unbilled, which happens when a future initial billing date is passed at subscription creation. The value passed must be before the current date and time. Allows you to set when the period started so mid period component allocations have the correct proration. Only ISO8601 format is supported. | getCurrentPeriodStartsAt(): ?\DateTime | setCurrentPeriodStartsAt(?\DateTime currentPeriodStartsAt): void | -## Example (as JSON) - -```json -{ - "activated_at": "2016-03-13T12:52:32.123Z", - "canceled_at": "2016-03-13T12:52:32.123Z", - "cancellation_message": "cancellation_message4", - "expires_at": "2016-03-13T12:52:32.123Z", - "current_period_starts_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\OverrideSubscriptionBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$overrideSubscription = OverrideSubscriptionBuilder::init() + ->activatedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->canceledAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->cancellationMessage('cancellation_message8') + ->expiresAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->currentPeriodStartsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/paginated-metadata.md b/doc/models/paginated-metadata.md index 68349996..49fe3677 100644 --- a/doc/models/paginated-metadata.md +++ b/doc/models/paginated-metadata.md @@ -15,30 +15,29 @@ | `perPage` | `?int` | Optional | - | getPerPage(): ?int | setPerPage(?int perPage): void | | `metadata` | [`?(Metadata[])`](../../doc/models/metadata.md) | Optional | - | getMetadata(): ?array | setMetadata(?array metadata): void | -## Example (as JSON) - -```json -{ - "total_count": 26, - "current_page": 2, - "total_pages": 14, - "per_page": 20, - "metadata": [ - { - "id": 50, - "value": "value8", - "resource_id": 134, - "name": "name6", - "deleted_at": "2016-03-13T12:52:32.123Z" - }, - { - "id": 50, - "value": "value8", - "resource_id": 134, - "name": "name6", - "deleted_at": "2016-03-13T12:52:32.123Z" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaginatedMetadataBuilder; +use AdvancedBillingLib\Models\Builders\MetadataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$paginatedMetadata = PaginatedMetadataBuilder::init() + ->totalCount(166) + ->currentPage(142) + ->totalPages(154) + ->perPage(136) + ->metadata( + [ + MetadataBuilder::init() + ->id(50) + ->value('value8') + ->resourceId(134) + ->name('name6') + ->deletedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/paid-invoice.md b/doc/models/paid-invoice.md index 60c12a7c..0b632ee6 100644 --- a/doc/models/paid-invoice.md +++ b/doc/models/paid-invoice.md @@ -14,14 +14,17 @@ | `dueAmount` | `?string` | Optional | The remaining due amount on the invoice | getDueAmount(): ?string | setDueAmount(?string dueAmount): void | | `paidAmount` | `?string` | Optional | The total amount paid on this invoice (including any prior payments) | getPaidAmount(): ?string | setPaidAmount(?string paidAmount): void | -## Example (as JSON) - -```json -{ - "invoice_id": "invoice_id6", - "status": "open", - "due_amount": "due_amount8", - "paid_amount": "paid_amount8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaidInvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceStatus; + +$paidInvoice = PaidInvoiceBuilder::init() + ->invoiceId('invoice_id2') + ->status(InvoiceStatus::CANCELED) + ->dueAmount('due_amount4') + ->paidAmount('paid_amount6') + ->build(); ``` diff --git a/doc/models/pause-request.md b/doc/models/pause-request.md index f4106e0d..6e589456 100644 --- a/doc/models/pause-request.md +++ b/doc/models/pause-request.md @@ -1,7 +1,7 @@ # Pause Request -Allows to pause a Subscription +Allows you to pause a Subscription. ## Structure @@ -13,13 +13,19 @@ Allows to pause a Subscription | --- | --- | --- | --- | --- | --- | | `hold` | [`?AutoResume`](../../doc/models/auto-resume.md) | Optional | - | getHold(): ?AutoResume | setHold(?AutoResume hold): void | -## Example (as JSON) +## Example -```json -{ - "hold": { - "automatically_resume_at": "2016-03-13T12:52:32.123Z" - } -} +```php +use AdvancedBillingLib\Models\Builders\PauseRequestBuilder; +use AdvancedBillingLib\Models\Builders\AutoResumeBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$pauseRequest = PauseRequestBuilder::init() + ->hold( + AutoResumeBuilder::init() + ->automaticallyResumeAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build(); ``` diff --git a/doc/models/pay-pal-vault.md b/doc/models/pay-pal-vault.md index 00445c6c..a121fc9a 100644 --- a/doc/models/pay-pal-vault.md +++ b/doc/models/pay-pal-vault.md @@ -16,3 +16,11 @@ The vault that stores the payment profile with the provided vault_token. | `MODUSLINK` | | `PAYPAL_COMPLETE` | +## Example + +```php +use AdvancedBillingLib\Models\PayPalVault; + +$payPalVault = PayPalVault::MODUSLINK; +``` + diff --git a/doc/models/payer-attributes.md b/doc/models/payer-attributes.md index 1be174d6..20a3c21d 100644 --- a/doc/models/payer-attributes.md +++ b/doc/models/payer-attributes.md @@ -28,19 +28,23 @@ | `taxExemptReason` | `?string` | Optional | - | getTaxExemptReason(): ?string | setTaxExemptReason(?string taxExemptReason): 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 | -## Example (as JSON) - -```json -{ - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "first_name": "first_name4", - "last_name": "last_name2", - "email": "email2", - "cc_emails": "cc_emails4", - "organization": "organization8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PayerAttributesBuilder; + +$payerAttributes = PayerAttributesBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails8') + ->organization('organization4') + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->build(); ``` diff --git a/doc/models/payer-error.md b/doc/models/payer-error.md index e0e4f1a5..68a31465 100644 --- a/doc/models/payer-error.md +++ b/doc/models/payer-error.md @@ -13,22 +13,31 @@ | `firstName` | `?(string[])` | Optional | - | getFirstName(): ?array | setFirstName(?array firstName): void | | `email` | `?(string[])` | Optional | - | getEmail(): ?array | setEmail(?array email): void | -## Example (as JSON) - -```json -{ - "last_name": [ - "last_name1", - "last_name2", - "last_name3" - ], - "first_name": [ - "first_name4", - "first_name5" - ], - "email": [ - "email4" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PayerErrorBuilder; + +$payerError = PayerErrorBuilder::init() + ->lastName( + [ + 'last_name9' + ] + ) + ->firstName( + [ + 'first_name2', + 'first_name3', + 'first_name4' + ] + ) + ->email( + [ + 'email6', + 'email7', + 'email8' + ] + ) + ->build(); ``` diff --git a/doc/models/payment-collection-method-changed.md b/doc/models/payment-collection-method-changed.md index ee2fcb43..0fcaa801 100644 --- a/doc/models/payment-collection-method-changed.md +++ b/doc/models/payment-collection-method-changed.md @@ -12,12 +12,14 @@ | `previousValue` | `string` | Required | - | getPreviousValue(): string | setPreviousValue(string previousValue): void | | `currentValue` | `string` | Required | - | getCurrentValue(): string | setCurrentValue(string currentValue): void | -## Example (as JSON) +## Example -```json -{ - "previous_value": "previous_value4", - "current_value": "current_value2" -} +```php +use AdvancedBillingLib\Models\Builders\PaymentCollectionMethodChangedBuilder; + +$paymentCollectionMethodChanged = PaymentCollectionMethodChangedBuilder::init( + 'previous_value4', + 'current_value2' +)->build(); ``` diff --git a/doc/models/payment-for-allocation.md b/doc/models/payment-for-allocation.md index 268d6384..df1846e9 100644 --- a/doc/models/payment-for-allocation.md +++ b/doc/models/payment-for-allocation.md @@ -16,14 +16,16 @@ Information for captured payment, if applicable | `success` | `?bool` | Optional | - | getSuccess(): ?bool | setSuccess(?bool success): void | | `memo` | `?string` | Optional | - | getMemo(): ?string | setMemo(?string memo): void | -## Example (as JSON) - -```json -{ - "id": 72, - "amount_in_cents": 158, - "success": false, - "memo": "memo6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentForAllocationBuilder; + +$paymentForAllocation = PaymentForAllocationBuilder::init() + ->id(68) + ->amountInCents(102) + ->success(false) + ->memo('memo6') + ->build(); ``` diff --git a/doc/models/payment-method-apple-pay.md b/doc/models/payment-method-apple-pay.md index 4c819f34..d87409b8 100644 --- a/doc/models/payment-method-apple-pay.md +++ b/doc/models/payment-method-apple-pay.md @@ -11,11 +11,14 @@ | --- | --- | --- | --- | --- | --- | | `type` | [`string(InvoiceEventPaymentMethod)`](../../doc/models/invoice-event-payment-method.md) | Required | - | getType(): string | setType(string type): void | -## Example (as JSON) +## Example -```json -{ - "type": "apple_pay" -} +```php +use AdvancedBillingLib\Models\Builders\PaymentMethodApplePayBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$paymentMethodApplePay = PaymentMethodApplePayBuilder::init( + InvoiceEventPaymentMethod::APPLE_PAY +)->build(); ``` diff --git a/doc/models/payment-method-bank-account.md b/doc/models/payment-method-bank-account.md index 84917505..3700b274 100644 --- a/doc/models/payment-method-bank-account.md +++ b/doc/models/payment-method-bank-account.md @@ -13,13 +13,16 @@ | `maskedRoutingNumber` | `string` | Required | - | getMaskedRoutingNumber(): string | setMaskedRoutingNumber(string maskedRoutingNumber): void | | `type` | [`string(InvoiceEventPaymentMethod)`](../../doc/models/invoice-event-payment-method.md) | Required | - | getType(): string | setType(string type): void | -## Example (as JSON) - -```json -{ - "masked_account_number": "masked_account_number2", - "masked_routing_number": "masked_routing_number2", - "type": "bank_account" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentMethodBankAccountBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$paymentMethodBankAccount = PaymentMethodBankAccountBuilder::init( + 'masked_account_number4', + 'masked_routing_number4', + InvoiceEventPaymentMethod::BANK_ACCOUNT +)->build(); ``` diff --git a/doc/models/payment-method-credit-card.md b/doc/models/payment-method-credit-card.md index e351e5dc..be4b15e3 100644 --- a/doc/models/payment-method-credit-card.md +++ b/doc/models/payment-method-credit-card.md @@ -15,15 +15,19 @@ | `maskedCardNumber` | `string` | Required | - | getMaskedCardNumber(): string | setMaskedCardNumber(string maskedCardNumber): void | | `type` | [`string(InvoiceEventPaymentMethod)`](../../doc/models/invoice-event-payment-method.md) | Required | - | getType(): string | setType(string type): void | -## Example (as JSON) - -```json -{ - "card_brand": "card_brand4", - "masked_card_number": "masked_card_number0", - "type": "credit_card", - "card_expiration": "card_expiration2", - "last_four": "last_four4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentMethodCreditCardBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$paymentMethodCreditCard = PaymentMethodCreditCardBuilder::init( + 'card_brand4', + 'masked_card_number0', + InvoiceEventPaymentMethod::CREDIT_CARD +) + ->cardExpiration('card_expiration2') + ->lastFour('last_four6') + ->build(); ``` diff --git a/doc/models/payment-method-external.md b/doc/models/payment-method-external.md index 596df63c..5bd32c3d 100644 --- a/doc/models/payment-method-external.md +++ b/doc/models/payment-method-external.md @@ -14,14 +14,18 @@ | `memo` | `?string` | Required | - | getMemo(): ?string | setMemo(?string memo): void | | `type` | [`string(InvoiceEventPaymentMethod)`](../../doc/models/invoice-event-payment-method.md) | Required | - | getType(): string | setType(string type): void | -## Example (as JSON) - -```json -{ - "details": "details4", - "kind": "kind2", - "memo": "memo8", - "type": "external" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentMethodExternalBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$paymentMethodExternal = PaymentMethodExternalBuilder::init( + 'kind8', + InvoiceEventPaymentMethod::EXTERNAL +) + ->details('details0') + ->memo('memo4') + ->build(); ``` diff --git a/doc/models/payment-method-paypal.md b/doc/models/payment-method-paypal.md index 495189e1..9561563c 100644 --- a/doc/models/payment-method-paypal.md +++ b/doc/models/payment-method-paypal.md @@ -12,12 +12,15 @@ | `email` | `string` | Required | - | getEmail(): string | setEmail(string email): void | | `type` | [`string(InvoiceEventPaymentMethod)`](../../doc/models/invoice-event-payment-method.md) | Required | - | getType(): string | setType(string type): void | -## Example (as JSON) +## Example -```json -{ - "email": "email2", - "type": "paypal_account" -} +```php +use AdvancedBillingLib\Models\Builders\PaymentMethodPaypalBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$paymentMethodPaypal = PaymentMethodPaypalBuilder::init( + 'email8', + InvoiceEventPaymentMethod::PAYPAL_ACCOUNT +)->build(); ``` diff --git a/doc/models/payment-profile-attributes.md b/doc/models/payment-profile-attributes.md index c02659c4..b20e8b30 100644 --- a/doc/models/payment-profile-attributes.md +++ b/doc/models/payment-profile-attributes.md @@ -11,22 +11,22 @@ alias to credit_card_attributes | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `chargifyToken` | `?string` | Optional | (Optional) Token received after sending billing information using Maxio.js (formerly Chargify.js). This token must be passed as a sole attribute of `payment_profile_attributes` (i.e. tok_9g6hw85pnpt6knmskpwp4ttt) | getChargifyToken(): ?string | setChargifyToken(?string chargifyToken): void | +| `chargifyToken` | `?string` | Optional | (Optional) Token received after sending billing information using Maxio.js (formerly Chargify.js). This token must be passed as a sole attribute of `payment_profile_attributes` (e.g., tok_9g6hw85pnpt6knmskpwp4ttt). | getChargifyToken(): ?string | setChargifyToken(?string chargifyToken): void | | `id` | `?int` | Optional | - | getId(): ?int | setId(?int id): void | | `paymentType` | [`?string(PaymentType)`](../../doc/models/payment-type.md) | Optional | - | getPaymentType(): ?string | setPaymentType(?string paymentType): void | | `firstName` | `?string` | Optional | (Optional) First name on card or bank account. If omitted, the first_name from customer attributes will be used. | getFirstName(): ?string | setFirstName(?string firstName): void | | `lastName` | `?string` | Optional | (Optional) Last name on card or bank account. If omitted, the last_name from customer attributes will be used. | getLastName(): ?string | setLastName(?string lastName): void | | `maskedCardNumber` | `?string` | Optional | - | getMaskedCardNumber(): ?string | setMaskedCardNumber(?string maskedCardNumber): void | -| `fullNumber` | `?string` | Optional | The full credit card number (string representation, i.e. 5424000000000015) | getFullNumber(): ?string | setFullNumber(?string fullNumber): void | -| `cardType` | [`?string(CardType)`](../../doc/models/card-type.md) | Optional | (Optional, used only for Subscription Import) If you know the card type (i.e. Visa, MC, etc) you may supply it here so that we may display the card type in the UI. | getCardType(): ?string | setCardType(?string cardType): void | +| `fullNumber` | `?string` | Optional | The full credit card number (string representation, e.g., 5424000000000015) | getFullNumber(): ?string | setFullNumber(?string fullNumber): void | +| `cardType` | [`?string(CardType)`](../../doc/models/card-type.md) | Optional | (Optional, used only for Subscription Import) If you know the card type (e.g., Visa, MC, etc.) you may supply it here so that we may display the card type in the UI. | getCardType(): ?string | setCardType(?string cardType): void | | `expirationMonth` | int\|string\|null | Optional | This is a container for one-of cases. | getExpirationMonth(): | setExpirationMonth( expirationMonth): void | | `expirationYear` | int\|string\|null | Optional | This is a container for one-of cases. | getExpirationYear(): | setExpirationYear( expirationYear): void | -| `billingAddress` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the payment gateway. | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | -| `billingAddress2` | `?string` | Optional | (Optional) Second line of the customer’s billing address i.e. Apt. 100 | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | -| `billingCity` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | getBillingCity(): ?string | setBillingCity(?string billingCity): void | -| `billingState` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getBillingState(): ?string | setBillingState(?string billingState): void | -| `billingCountry` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | getBillingCountry(): ?string | setBillingCountry(?string billingCountry): void | -| `billingZip` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | getBillingZip(): ?string | setBillingZip(?string billingZip): void | +| `billingAddress` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely passed through to the payment gateway. | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | +| `billingAddress2` | `?string` | Optional | (Optional) Second line of the customer’s billing address, e.g., Apt. 100 | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | +| `billingCity` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed through to the payment gateway. | getBillingCity(): ?string | setBillingCity(?string billingCity): void | +| `billingState` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address state (e.g., MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getBillingState(): ?string | setBillingState(?string billingState): void | +| `billingCountry` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | getBillingCountry(): ?string | setBillingCountry(?string billingCountry): void | +| `billingZip` | `?string` | Optional | (Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed through to the payment gateway. | getBillingZip(): ?string | setBillingZip(?string billingZip): void | | `currentVault` | [`?string(AllVaults)`](../../doc/models/all-vaults.md) | Optional | (Optional, used only for Subscription Import) The vault that stores the payment profile with the provided vault_token. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `vaultToken` | `?string` | Optional | (Optional, used only for Subscription Import) The “token” provided by your vault storage for an already stored payment profile | getVaultToken(): ?string | setVaultToken(?string vaultToken): void | | `customerVaultToken` | `?string` | Optional | (Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | @@ -35,17 +35,20 @@ alias to credit_card_attributes | `paymentMethodNonce` | `?string` | Optional | (Required for Square unless importing with vault_token and customer_vault_token) The nonce generated by the Square Javascript library (SqPaymentForm) | getPaymentMethodNonce(): ?string | setPaymentMethodNonce(?string paymentMethodNonce): void | | `gatewayHandle` | `?string` | Optional | (Optional) This attribute is only available if MultiGateway feature is enabled for your Site. This feature is in the Private Beta currently. gateway_handle is used to directly select a gateway where a payment profile will be stored in. Every connected gateway must have a unique gateway handle specified. Read [Multigateway description](https://chargify.zendesk.com/hc/en-us/articles/4407761759643#connecting-with-multiple-gateways) to learn more about new concepts that MultiGateway introduces and the default behavior when this attribute is not passed. | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | | `cvv` | `?string` | Optional | (Optional, may be required by your gateway settings) The 3- or 4-digit Card Verification Value. This value is merely passed through to the payment gateway. | getCvv(): ?string | setCvv(?string cvv): void | -| `lastFour` | `?string` | Optional | (Optional, used only for Subscription Import) If you have the last 4 digits of the credit card number, you may supply them here so that we may create a masked card number (i.e. XXXX-XXXX-XXXX-1234) for display in the UI. Last 4 digits are required for refunds in Auth.Net. | getLastFour(): ?string | setLastFour(?string lastFour): void | - -## Example (as JSON) - -```json -{ - "chargify_token": "chargify_token8", - "id": 80, - "payment_type": "credit_card", - "first_name": "first_name0", - "last_name": "last_name8" -} +| `lastFour` | `?string` | Optional | (Optional, used only for Subscription Import) If you have the last 4 digits of the credit card number, you may supply them here so that we may create a masked card number (e.g., XXXX-XXXX-XXXX-1234) for display in the UI. Last 4 digits are required for refunds in Auth.Net. | getLastFour(): ?string | setLastFour(?string lastFour): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentProfileAttributesBuilder; +use AdvancedBillingLib\Models\PaymentType; + +$paymentProfileAttributes = PaymentProfileAttributesBuilder::init() + ->chargifyToken('chargify_token8') + ->id(14) + ->paymentType(PaymentType::PAYPAL_ACCOUNT) + ->firstName('first_name0') + ->lastName('last_name8') + ->build(); ``` diff --git a/doc/models/payment-profile-params.md b/doc/models/payment-profile-params.md index a35a0079..40a0563f 100644 --- a/doc/models/payment-profile-params.md +++ b/doc/models/payment-profile-params.md @@ -15,13 +15,15 @@ PCI-safe cardholder fields only. Full card numbers, CVV, and billing address are | `lastName` | `?string` | Optional | - | getLastName(): ?string | setLastName(?string lastName): void | | `cardType` | `?string` | Optional | - | getCardType(): ?string | setCardType(?string cardType): void | -## Example (as JSON) - -```json -{ - "first_name": "first_name2", - "last_name": "last_name0", - "card_type": "card_type8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentProfileParamsBuilder; + +$paymentProfileParams = PaymentProfileParamsBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->cardType('card_type2') + ->build(); ``` diff --git a/doc/models/payment-profile-response.md b/doc/models/payment-profile-response.md index 5a65f818..ee943453 100644 --- a/doc/models/payment-profile-response.md +++ b/doc/models/payment-profile-response.md @@ -11,18 +11,24 @@ | --- | --- | --- | --- | --- | --- | | `paymentProfile` | [ApplePayPaymentProfile](../../doc/models/apple-pay-payment-profile.md)\|[BankAccountPaymentProfile](../../doc/models/bank-account-payment-profile.md)\|[CreditCardPaymentProfile](../../doc/models/credit-card-payment-profile.md)\|[PaypalPaymentProfile](../../doc/models/paypal-payment-profile.md) | Required | - | getPaymentProfile(): | setPaymentProfile( paymentProfile): void | -## Example (as JSON) - -```json -{ - "payment_profile": { - "payment_type": "apple_pay", - "id": 60, - "first_name": "first_name2", - "last_name": "last_name0", - "customer_id": 98, - "current_vault": "braintree_blue" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaymentProfileResponseBuilder; +use AdvancedBillingLib\Models\Builders\ApplePayPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\ApplePayVault; + +$paymentProfileResponse = PaymentProfileResponseBuilder::init( + ApplePayPaymentProfileBuilder::init( + PaymentType::APPLE_PAY + ) + ->id(60) + ->firstName('first_name2') + ->lastName('last_name0') + ->customerId(98) + ->currentVault(ApplePayVault::BRAINTREE_BLUE) + ->build() +)->build(); ``` diff --git a/doc/models/payment-related-events.md b/doc/models/payment-related-events.md index d979b3fc..d699ed0f 100644 --- a/doc/models/payment-related-events.md +++ b/doc/models/payment-related-events.md @@ -12,12 +12,14 @@ | `productId` | `int` | Required | - | getProductId(): int | setProductId(int productId): void | | `accountTransactionId` | `int` | Required | - | getAccountTransactionId(): int | setAccountTransactionId(int accountTransactionId): void | -## Example (as JSON) +## Example -```json -{ - "product_id": 42, - "account_transaction_id": 58 -} +```php +use AdvancedBillingLib\Models\Builders\PaymentRelatedEventsBuilder; + +$paymentRelatedEvents = PaymentRelatedEventsBuilder::init( + 186, + 170 +)->build(); ``` diff --git a/doc/models/payment-type.md b/doc/models/payment-type.md index 44b7cba6..b123a20c 100644 --- a/doc/models/payment-type.md +++ b/doc/models/payment-type.md @@ -14,3 +14,11 @@ | `PAYPAL_ACCOUNT` | | `APPLE_PAY` | +## Example + +```php +use AdvancedBillingLib\Models\PaymentType; + +$paymentType = PaymentType::CREDIT_CARD; +``` + diff --git a/doc/models/paypal-payment-profile.md b/doc/models/paypal-payment-profile.md index 80019e1c..89e431d5 100644 --- a/doc/models/paypal-payment-profile.md +++ b/doc/models/paypal-payment-profile.md @@ -29,16 +29,21 @@ | `createdAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | A timestamp indicating when this payment profile was last updated | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -## Example (as JSON) - -```json -{ - "payment_type": "paypal_account", - "id": 10, - "first_name": "first_name0", - "last_name": "last_name8", - "customer_id": 48, - "current_vault": "moduslink" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PaypalPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\PayPalVault; + +$paypalPaymentProfile = PaypalPaymentProfileBuilder::init( + PaymentType::PAYPAL_ACCOUNT +) + ->id(214) + ->firstName('first_name0') + ->lastName('last_name8') + ->customerId(252) + ->currentVault(PayPalVault::MODUSLINK) + ->build(); ``` diff --git a/doc/models/pending-cancellation-change.md b/doc/models/pending-cancellation-change.md index 92b216c4..bd69aa31 100644 --- a/doc/models/pending-cancellation-change.md +++ b/doc/models/pending-cancellation-change.md @@ -12,12 +12,15 @@ | `cancellationState` | `string` | Required | - | getCancellationState(): string | setCancellationState(string cancellationState): void | | `cancelsAt` | `DateTime` | Required | - | getCancelsAt(): \DateTime | setCancelsAt(\DateTime cancelsAt): void | -## Example (as JSON) +## Example -```json -{ - "cancellation_state": "cancellation_state8", - "cancels_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\PendingCancellationChangeBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$pendingCancellationChange = PendingCancellationChangeBuilder::init( + 'cancellation_state0', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); ``` diff --git a/doc/models/portal-management-link.md b/doc/models/portal-management-link.md index ba0a08bf..6ff7e33f 100644 --- a/doc/models/portal-management-link.md +++ b/doc/models/portal-management-link.md @@ -16,15 +16,18 @@ | `expiresAt` | `?DateTime` | Optional | - | getExpiresAt(): ?\DateTime | setExpiresAt(?\DateTime expiresAt): void | | `lastInviteSentAt` | `?DateTime` | Optional | - | getLastInviteSentAt(): ?\DateTime | setLastInviteSentAt(?\DateTime lastInviteSentAt): void | -## Example (as JSON) - -```json -{ - "url": "url0", - "fetch_count": 222, - "created_at": "2016-03-13T12:52:32.123Z", - "new_link_available_at": "2016-03-13T12:52:32.123Z", - "expires_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PortalManagementLinkBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$portalManagementLink = PortalManagementLinkBuilder::init() + ->url('url8') + ->fetchCount(88) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->newLinkAvailableAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->expiresAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/prepaid-configuration-response.md b/doc/models/prepaid-configuration-response.md index a5e4cd56..c6bd490b 100644 --- a/doc/models/prepaid-configuration-response.md +++ b/doc/models/prepaid-configuration-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `prepaidConfiguration` | [`PrepaidConfiguration`](../../doc/models/prepaid-configuration.md) | Required | - | getPrepaidConfiguration(): PrepaidConfiguration | setPrepaidConfiguration(PrepaidConfiguration prepaidConfiguration): void | -## Example (as JSON) - -```json -{ - "prepaid_configuration": { - "id": 142, - "initial_funding_amount_in_cents": 74, - "replenish_to_amount_in_cents": 76, - "auto_replenish": false, - "replenish_threshold_amount_in_cents": 20 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaidConfigurationResponseBuilder; +use AdvancedBillingLib\Models\Builders\PrepaidConfigurationBuilder; + +$prepaidConfigurationResponse = PrepaidConfigurationResponseBuilder::init( + PrepaidConfigurationBuilder::init() + ->id(142) + ->initialFundingAmountInCents(74) + ->replenishToAmountInCents(76) + ->autoReplenish(false) + ->replenishThresholdAmountInCents(20) + ->build() +)->build(); ``` diff --git a/doc/models/prepaid-configuration.md b/doc/models/prepaid-configuration.md index 961be70b..0ffa76ae 100644 --- a/doc/models/prepaid-configuration.md +++ b/doc/models/prepaid-configuration.md @@ -15,15 +15,17 @@ | `autoReplenish` | `?bool` | Optional | - | getAutoReplenish(): ?bool | setAutoReplenish(?bool autoReplenish): void | | `replenishThresholdAmountInCents` | `?int` | Optional | - | getReplenishThresholdAmountInCents(): ?int | setReplenishThresholdAmountInCents(?int replenishThresholdAmountInCents): void | -## Example (as JSON) - -```json -{ - "id": 156, - "initial_funding_amount_in_cents": 88, - "replenish_to_amount_in_cents": 166, - "auto_replenish": false, - "replenish_threshold_amount_in_cents": 222 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaidConfigurationBuilder; + +$prepaidConfiguration = PrepaidConfigurationBuilder::init() + ->id(146) + ->initialFundingAmountInCents(78) + ->replenishToAmountInCents(80) + ->autoReplenish(false) + ->replenishThresholdAmountInCents(232) + ->build(); ``` diff --git a/doc/models/prepaid-product-price-point-filter.md b/doc/models/prepaid-product-price-point-filter.md index 9d90c0ed..1c9fee79 100644 --- a/doc/models/prepaid-product-price-point-filter.md +++ b/doc/models/prepaid-product-price-point-filter.md @@ -11,11 +11,11 @@ | --- | --- | --- | --- | --- | --- | | `productPricePointId` | `string` | Required, Constant | Passed as a parameter to list methods to return only non null values.

**Value**: `'not_null'` | getProductPricePointId(): string | setProductPricePointId(string productPricePointId): void | -## Example (as JSON) +## Example -```json -{ - "product_price_point_id": "not_null" -} +```php +use AdvancedBillingLib\Models\Builders\PrepaidProductPricePointFilterBuilder; + +$prepaidProductPricePointFilter = PrepaidProductPricePointFilterBuilder::init()->build(); ``` diff --git a/doc/models/prepaid-subscription-balance-changed.md b/doc/models/prepaid-subscription-balance-changed.md index f5ecdd65..db800470 100644 --- a/doc/models/prepaid-subscription-balance-changed.md +++ b/doc/models/prepaid-subscription-balance-changed.md @@ -14,14 +14,16 @@ | `prepaymentAccountBalanceInCents` | `int` | Required | - | getPrepaymentAccountBalanceInCents(): int | setPrepaymentAccountBalanceInCents(int prepaymentAccountBalanceInCents): void | | `currentUsageAmountInCents` | `int` | Required | - | getCurrentUsageAmountInCents(): int | setCurrentUsageAmountInCents(int currentUsageAmountInCents): void | -## Example (as JSON) - -```json -{ - "reason": "reason8", - "current_account_balance_in_cents": 250, - "prepayment_account_balance_in_cents": 44, - "current_usage_amount_in_cents": 242 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaidSubscriptionBalanceChangedBuilder; + +$prepaidSubscriptionBalanceChanged = PrepaidSubscriptionBalanceChangedBuilder::init( + 'reason6', + 194, + 100, + 186 +)->build(); ``` diff --git a/doc/models/prepaid-usage-allocation-detail.md b/doc/models/prepaid-usage-allocation-detail.md index 610ab6f7..c3f0d80b 100644 --- a/doc/models/prepaid-usage-allocation-detail.md +++ b/doc/models/prepaid-usage-allocation-detail.md @@ -13,13 +13,15 @@ | `chargeId` | `?int` | Optional | - | getChargeId(): ?int | setChargeId(?int chargeId): void | | `usageQuantity` | `?int` | Optional | - | getUsageQuantity(): ?int | setUsageQuantity(?int usageQuantity): void | -## Example (as JSON) - -```json -{ - "allocation_id": 72, - "charge_id": 30, - "usage_quantity": 212 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaidUsageAllocationDetailBuilder; + +$prepaidUsageAllocationDetail = PrepaidUsageAllocationDetailBuilder::init() + ->allocationId(144) + ->chargeId(214) + ->usageQuantity(140) + ->build(); ``` diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md index feb4d8f9..cbf1ea6f 100644 --- a/doc/models/prepaid-usage-component.md +++ b/doc/models/prepaid-usage-component.md @@ -9,10 +9,10 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes". | getName(): string | setName(string name): void | -| `unitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item | getUnitName(): string | setUnitName(string unitName): void | +| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, e.g., "Minutes". | getName(): string | setName(string name): void | +| `unitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on a subscription’s component line-item | getUnitName(): string | setUnitName(string unitName): void | | `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 | +| `handle` | `?string` | Optional | A unique identifier for your use that can be used to retrieve this component in 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 | | `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 | @@ -23,47 +23,77 @@ | `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 | | `hideDateRangeOnInvoice` | `?bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. | getHideDateRangeOnInvoice(): ?bool | setHideDateRangeOnInvoice(?bool hideDateRangeOnInvoice): void | | `overagePricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Required | - | getOveragePricing(): OveragePricing | setOveragePricing(OveragePricing overagePricing): void | -| `rolloverPrepaidRemainder` | `?bool` | Optional | Boolean which controls whether or not remaining units should be rolled over to the next period | getRolloverPrepaidRemainder(): ?bool | setRolloverPrepaidRemainder(?bool rolloverPrepaidRemainder): void | -| `renewPrepaidAllocation` | `?bool` | Optional | 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 | Boolean which controls whether or not remaining units should be rolled over to the next period. | getRolloverPrepaidRemainder(): ?bool | setRolloverPrepaidRemainder(?bool rolloverPrepaidRemainder): void | +| `renewPrepaidAllocation` | `?bool` | Optional | Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. | getRenewPrepaidAllocation(): ?bool | setRenewPrepaidAllocation(?bool renewPrepaidAllocation): void | | `expirationInterval` | `?float` | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire | getExpirationInterval(): ?float | setExpirationInterval(?float expirationInterval): void | | `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | - | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | | `displayOnHostedPage` | `?bool` | Optional | - | getDisplayOnHostedPage(): ?bool | setDisplayOnHostedPage(?bool displayOnHostedPage): void | | `allowFractionalQuantities` | `?bool` | Optional | - | getAllowFractionalQuantities(): ?bool | setAllowFractionalQuantities(?bool allowFractionalQuantities): void | | `publicSignupPageIds` | `?(int[])` | Optional | - | getPublicSignupPageIds(): ?array | setPublicSignupPageIds(?array publicSignupPageIds): void | +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | -## Example (as JSON) +## Example -```json -{ - "name": "name2", - "unit_name": "unit_name4", - "description": "description8", - "handle": "handle8", - "taxable": 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 - } - ], - "upgrade_charge": "prorated", - "overage_pricing": { - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - } -} +```php +use AdvancedBillingLib\Models\Builders\PrepaidUsageComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\OveragePricingBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\CreditType; + +$prepaidUsageComponent = PrepaidUsageComponentBuilder::init( + 'name2', + 'unit_name4', + PricingScheme::PER_UNIT, + OveragePricingBuilder::init( + PricingScheme::STAIRSTEP + ) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->build() +) + ->description('description8') + ->handle('handle8') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->upgradeCharge(CreditType::NONE) + ->build(); ``` diff --git a/doc/models/prepaid-usage.md b/doc/models/prepaid-usage.md index d88adb1a..00adc3b2 100644 --- a/doc/models/prepaid-usage.md +++ b/doc/models/prepaid-usage.md @@ -11,8 +11,8 @@ | --- | --- | --- | --- | --- | --- | | `previousUnitBalance` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getPreviousUnitBalance(): string | setPreviousUnitBalance(string previousUnitBalance): void | | `previousOverageUnitBalance` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getPreviousOverageUnitBalance(): string | setPreviousOverageUnitBalance(string previousOverageUnitBalance): void | -| `newUnitBalance` | `int` | Required | - | getNewUnitBalance(): int | setNewUnitBalance(int newUnitBalance): void | -| `newOverageUnitBalance` | `int` | Required | - | getNewOverageUnitBalance(): int | setNewOverageUnitBalance(int newOverageUnitBalance): void | +| `newUnitBalance` | int\|string | Required | This is a container for one-of cases. | getNewUnitBalance(): | setNewUnitBalance( newUnitBalance): void | +| `newOverageUnitBalance` | int\|string | Required | This is a container for one-of cases. | getNewOverageUnitBalance(): | setNewOverageUnitBalance( newOverageUnitBalance): void | | `usageQuantity` | `int` | Required | - | getUsageQuantity(): int | setUsageQuantity(int usageQuantity): void | | `overageUsageQuantity` | `int` | Required | - | getOverageUsageQuantity(): int | setOverageUsageQuantity(int overageUsageQuantity): void | | `componentId` | `int` | Required | - | getComponentId(): int | setComponentId(int componentId): void | @@ -20,26 +20,29 @@ | `memo` | `string` | Required | - | getMemo(): string | setMemo(string memo): void | | `allocationDetails` | [`PrepaidUsageAllocationDetail[]`](../../doc/models/prepaid-usage-allocation-detail.md) | Required | - | getAllocationDetails(): array | setAllocationDetails(array allocationDetails): void | -## Example (as JSON) - -```json -{ - "previous_unit_balance": "previous_unit_balance0", - "previous_overage_unit_balance": "previous_overage_unit_balance4", - "new_unit_balance": 252, - "new_overage_unit_balance": 224, - "usage_quantity": 214, - "overage_usage_quantity": 106, - "component_id": 176, - "component_handle": "component_handle4", - "memo": "memo8", - "allocation_details": [ - { - "allocation_id": 18, - "charge_id": 84, - "usage_quantity": 10 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaidUsageBuilder; +use AdvancedBillingLib\Models\Builders\PrepaidUsageAllocationDetailBuilder; + +$prepaidUsage = PrepaidUsageBuilder::init( + 'previous_unit_balance4', + 'previous_overage_unit_balance0', + 206, + 78, + 246, + 138, + 208, + 'component_handle0', + 'memo4', + [ + PrepaidUsageAllocationDetailBuilder::init() + ->allocationId(18) + ->chargeId(84) + ->usageQuantity(10) + ->build() + ] +)->build(); ``` diff --git a/doc/models/prepayment-account-balance-changed.md b/doc/models/prepayment-account-balance-changed.md index 893156ef..e4900cad 100644 --- a/doc/models/prepayment-account-balance-changed.md +++ b/doc/models/prepayment-account-balance-changed.md @@ -14,14 +14,16 @@ | `prepaymentBalanceChangeInCents` | `int` | Required | - | getPrepaymentBalanceChangeInCents(): int | setPrepaymentBalanceChangeInCents(int prepaymentBalanceChangeInCents): void | | `currencyCode` | `string` | Required | - | getCurrencyCode(): string | setCurrencyCode(string currencyCode): void | -## Example (as JSON) - -```json -{ - "reason": "reason4", - "prepayment_account_balance_in_cents": 182, - "prepayment_balance_change_in_cents": 206, - "currency_code": "currency_code4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaymentAccountBalanceChangedBuilder; + +$prepaymentAccountBalanceChanged = PrepaymentAccountBalanceChangedBuilder::init( + 'reason8', + 134, + 158, + 'currency_code8' +)->build(); ``` diff --git a/doc/models/prepayment-method.md b/doc/models/prepayment-method.md index adbddd85..dd05e6fc 100644 --- a/doc/models/prepayment-method.md +++ b/doc/models/prepayment-method.md @@ -17,3 +17,11 @@ | `CREDIT_CARD` | | `OTHER` | +## Example + +```php +use AdvancedBillingLib\Models\PrepaymentMethod; + +$prepaymentMethod = PrepaymentMethod::OTHER; +``` + diff --git a/doc/models/prepayment-response.md b/doc/models/prepayment-response.md index d257d5d0..cc6747c0 100644 --- a/doc/models/prepayment-response.md +++ b/doc/models/prepayment-response.md @@ -11,22 +11,28 @@ | --- | --- | --- | --- | --- | --- | | `prepayment` | [`Prepayment`](../../doc/models/prepayment.md) | Required | - | getPrepayment(): Prepayment | setPrepayment(Prepayment prepayment): void | -## Example (as JSON) - -```json -{ - "prepayment": { - "id": 38, - "subscription_id": 148, - "amount_in_cents": 124, - "remaining_amount_in_cents": 182, - "refunded_amount_in_cents": 132, - "details": "details8", - "external": false, - "memo": "memo2", - "payment_type": "credit_card", - "created_at": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaymentResponseBuilder; +use AdvancedBillingLib\Models\Builders\PrepaymentBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\PrepaymentMethod; + +$prepaymentResponse = PrepaymentResponseBuilder::init( + PrepaymentBuilder::init( + 38, + 148, + 124, + 182, + false, + 'memo2', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') + ) + ->refundedAmountInCents(132) + ->details('details8') + ->paymentType(PrepaymentMethod::CREDIT_CARD) + ->build() +)->build(); ``` diff --git a/doc/models/prepayment.md b/doc/models/prepayment.md index 181471f6..acce80b9 100644 --- a/doc/models/prepayment.md +++ b/doc/models/prepayment.md @@ -20,20 +20,25 @@ | `paymentType` | [`?string(PrepaymentMethod)`](../../doc/models/prepayment-method.md) | Optional | The payment type of the prepayment. | getPaymentType(): ?string | setPaymentType(?string paymentType): void | | `createdAt` | `DateTime` | Required | - | getCreatedAt(): \DateTime | setCreatedAt(\DateTime createdAt): void | -## Example (as JSON) - -```json -{ - "id": 50, - "subscription_id": 160, - "amount_in_cents": 120, - "remaining_amount_in_cents": 194, - "refunded_amount_in_cents": 144, - "details": "details4", - "external": false, - "memo": "memo8", - "payment_type": "cash", - "created_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaymentBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\PrepaymentMethod; + +$prepayment = PrepaymentBuilder::init( + 38, + 148, + 124, + 182, + false, + 'memo2', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +) + ->refundedAmountInCents(132) + ->details('details8') + ->paymentType(PrepaymentMethod::CREDIT_CARD) + ->build(); ``` diff --git a/doc/models/prepayments-response.md b/doc/models/prepayments-response.md index fac502b5..999585d3 100644 --- a/doc/models/prepayments-response.md +++ b/doc/models/prepayments-response.md @@ -11,36 +11,32 @@ | --- | --- | --- | --- | --- | --- | | `prepayments` | [`?(Prepayment[])`](../../doc/models/prepayment.md) | Optional | **Constraints**: *Unique Items Required* | getPrepayments(): ?array | setPrepayments(?array prepayments): void | -## Example (as JSON) - -```json -{ - "prepayments": [ - { - "id": 76, - "subscription_id": 186, - "amount_in_cents": 94, - "remaining_amount_in_cents": 220, - "refunded_amount_in_cents": 170, - "details": "details6", - "external": false, - "memo": "memo0", - "payment_type": "cash", - "created_at": "2016-03-13T12:52:32.123Z" - }, - { - "id": 76, - "subscription_id": 186, - "amount_in_cents": 94, - "remaining_amount_in_cents": 220, - "refunded_amount_in_cents": 170, - "details": "details6", - "external": false, - "memo": "memo0", - "payment_type": "cash", - "created_at": "2016-03-13T12:52:32.123Z" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PrepaymentsResponseBuilder; +use AdvancedBillingLib\Models\Builders\PrepaymentBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\PrepaymentMethod; + +$prepaymentsResponse = PrepaymentsResponseBuilder::init() + ->prepayments( + [ + PrepaymentBuilder::init( + 76, + 186, + 94, + 220, + false, + 'memo0', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') + ) + ->refundedAmountInCents(170) + ->details('details6') + ->paymentType(PrepaymentMethod::CASH) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/preview-allocations-request.md b/doc/models/preview-allocations-request.md index 283296ad..593009e6 100644 --- a/doc/models/preview-allocations-request.md +++ b/doc/models/preview-allocations-request.md @@ -14,23 +14,30 @@ | `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) - -```json -{ - "allocations": [ - { - "quantity": 26.48, - "decimal_quantity": "decimal_quantity8", - "previous_quantity": 55.5, - "decimal_previous_quantity": "decimal_previous_quantity2", - "component_id": 242, - "memo": "memo6" - } - ], - "effective_proration_date": "2023-12-01", - "upgrade_charge": "none", - "downgrade_credit": "prorated" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PreviewAllocationsRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreateAllocationBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\CreditType; + +$previewAllocationsRequest = PreviewAllocationsRequestBuilder::init( + [ + CreateAllocationBuilder::init( + 26.48 + ) + ->decimalQuantity('decimal_quantity8') + ->previousQuantity(55.5) + ->decimalPreviousQuantity('decimal_previous_quantity2') + ->componentId(242) + ->memo('memo6') + ->build() + ] +) + ->effectiveProrationDate(DateTimeHelper::fromSimpleDate('2023-12-01')) + ->upgradeCharge(CreditType::NONE) + ->downgradeCredit(CreditType::NONE) + ->build(); ``` diff --git a/doc/models/price-point-type.md b/doc/models/price-point-type.md index c436e57b..3a8dff7a 100644 --- a/doc/models/price-point-type.md +++ b/doc/models/price-point-type.md @@ -19,3 +19,11 @@ Price point type. We expose the following types: | `DEFAULT_` | | `CUSTOM` | +## Example + +```php +use AdvancedBillingLib\Models\PricePointType; + +$pricePointType = PricePointType::DEFAULT_; +``` + diff --git a/doc/models/price.md b/doc/models/price.md index 3f5581b0..c7436348 100644 --- a/doc/models/price.md +++ b/doc/models/price.md @@ -13,13 +13,18 @@ | `endingQuantity` | int\|string\|null | Optional | This is a container for one-of cases. | getEndingQuantity(): | setEndingQuantity( endingQuantity): void | | `unitPrice` | float\|string | Required | This is a container for one-of cases. | getUnitPrice(): | setUnitPrice( unitPrice): void | -## Example (as JSON) - -```json -{ - "starting_quantity": 40, - "ending_quantity": 14, - "unit_price": 125.12 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PriceBuilder; + +$price = PriceBuilder::init( + 132, + 70.44 +) + ->endingQuantity( + 6 + ) + ->build(); ``` diff --git a/doc/models/pricing-scheme.md b/doc/models/pricing-scheme.md index 6be09a7a..9831466b 100644 --- a/doc/models/pricing-scheme.md +++ b/doc/models/pricing-scheme.md @@ -16,3 +16,11 @@ The identifier for the pricing scheme. See [Product Components](https://help.cha | `PER_UNIT` | | `TIERED` | +## Example + +```php +use AdvancedBillingLib\Models\PricingScheme; + +$pricingScheme = PricingScheme::STAIRSTEP; +``` + diff --git a/doc/models/product-family-response.md b/doc/models/product-family-response.md index 4e78e0dd..904241dc 100644 --- a/doc/models/product-family-response.md +++ b/doc/models/product-family-response.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `productFamily` | [`?ProductFamily`](../../doc/models/product-family.md) | Optional | - | getProductFamily(): ?ProductFamily | setProductFamily(?ProductFamily productFamily): void | -## Example (as JSON) - -```json -{ - "product_family": { - "id": 14, - "name": "name0", - "handle": "handle6", - "accounting_code": "accounting_code6", - "description": "description0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProductFamilyResponseBuilder; +use AdvancedBillingLib\Models\Builders\ProductFamilyBuilder; + +$productFamilyResponse = ProductFamilyResponseBuilder::init() + ->productFamily( + ProductFamilyBuilder::init() + ->id(14) + ->name('name0') + ->handle('handle6') + ->accountingCode('accounting_code6') + ->description('description0') + ->build() + ) + ->build(); ``` diff --git a/doc/models/product-family.md b/doc/models/product-family.md index 6b42baf0..9ebccac8 100644 --- a/doc/models/product-family.md +++ b/doc/models/product-family.md @@ -14,19 +14,22 @@ | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | | `accountingCode` | `?string` | Optional | - | getAccountingCode(): ?string | setAccountingCode(?string accountingCode): void | | `description` | `?string` | Optional | - | getDescription(): ?string | setDescription(?string description): void | +| `surcharging` | `?bool` | Optional | Whether surcharging applies to this product family. Only included on sites where surcharging is enabled. | getSurcharging(): ?bool | setSurcharging(?bool surcharging): 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) +## Example -```json -{ - "id": 194, - "name": "name2", - "handle": "handle8", - "accounting_code": "accounting_code8", - "description": "description8" -} +```php +use AdvancedBillingLib\Models\Builders\ProductFamilyBuilder; + +$productFamily = ProductFamilyBuilder::init() + ->id(134) + ->name('name4') + ->handle('handle0') + ->accountingCode('accounting_code0') + ->description('description4') + ->build(); ``` diff --git a/doc/models/product-price-point-error-response-exception.md b/doc/models/product-price-point-error-response-exception.md index e1d58a6f..173fd5e0 100644 --- a/doc/models/product-price-point-error-response-exception.md +++ b/doc/models/product-price-point-error-response-exception.md @@ -11,31 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`ProductPricePointErrors`](../../doc/models/product-price-point-errors.md) | Required | - | getErrors(): ProductPricePointErrors | setErrors(ProductPricePointErrors errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "price_point": "can't be blank", - "interval": [ - "Recurring Interval: cannot be blank.", - "Recurring Interval: must be greater than or equal to 1." - ], - "interval_unit": [ - "Interval unit: cannot be blank.", - "Interval unit: must be 'month' or 'day'." - ], - "name": [ - "Name: cannot be blank." - ], - "price": [ - "Price: is not a number.", - "Price: must be greater than or equal to 0." - ], - "price_in_cents": [ - "Price in cents: cannot be blank." - ] - } +## Example + +```php +try { + // make the API call +} catch (ProductPricePointErrorResponseException $exp) { + echo 'Caught ProductPricePointErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/product-price-point-errors.md b/doc/models/product-price-point-errors.md index 28c69fde..a130ae1b 100644 --- a/doc/models/product-price-point-errors.md +++ b/doc/models/product-price-point-errors.md @@ -16,29 +16,41 @@ | `price` | `?(string[])` | Optional | - | getPrice(): ?array | setPrice(?array price): void | | `priceInCents` | `?(string[])` | Optional | - | getPriceInCents(): ?array | setPriceInCents(?array priceInCents): void | -## Example (as JSON) - -```json -{ - "price_point": "can't be blank", - "interval": [ - "Recurring Interval: cannot be blank.", - "Recurring Interval: must be greater than or equal to 1." - ], - "interval_unit": [ - "Interval unit: cannot be blank.", - "Interval unit: must be 'month' or 'day'." - ], - "name": [ - "Name: cannot be blank." - ], - "price": [ - "Price: is not a number.", - "Price: must be greater than or equal to 0." - ], - "price_in_cents": [ - "Price in cents: cannot be blank." - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProductPricePointErrorsBuilder; + +$productPricePointErrors = ProductPricePointErrorsBuilder::init() + ->pricePoint('can\'t be blank') + ->interval( + [ + 'Recurring Interval: cannot be blank.', + 'Recurring Interval: must be greater than or equal to 1.' + ] + ) + ->intervalUnit( + [ + 'Interval unit: cannot be blank.', + 'Interval unit: must be \'month\' or \'day\'.' + ] + ) + ->name( + [ + 'Name: cannot be blank.' + ] + ) + ->price( + [ + 'Price: is not a number.', + 'Price: must be greater than or equal to 0.' + ] + ) + ->priceInCents( + [ + 'Price in cents: cannot be blank.' + ] + ) + ->build(); ``` diff --git a/doc/models/product-price-point-response.md b/doc/models/product-price-point-response.md index 3419c0db..ba5a4097 100644 --- a/doc/models/product-price-point-response.md +++ b/doc/models/product-price-point-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `pricePoint` | [`ProductPricePoint`](../../doc/models/product-price-point.md) | Required | - | getPricePoint(): ProductPricePoint | setPricePoint(ProductPricePoint pricePoint): void | -## Example (as JSON) - -```json -{ - "price_point": { - "id": 248, - "name": "name0", - "handle": "handle6", - "price_in_cents": 196, - "interval": 44 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProductPricePointResponseBuilder; +use AdvancedBillingLib\Models\Builders\ProductPricePointBuilder; + +$productPricePointResponse = ProductPricePointResponseBuilder::init( + ProductPricePointBuilder::init() + ->id(248) + ->name('name0') + ->handle('handle6') + ->priceInCents(196) + ->interval(44) + ->build() +)->build(); ``` diff --git a/doc/models/product-price-point.md b/doc/models/product-price-point.md index 75fdd19b..ce6b4b83 100644 --- a/doc/models/product-price-point.md +++ b/doc/models/product-price-point.md @@ -13,16 +13,16 @@ | `name` | `?string` | Optional | The product price point name | getName(): ?string | setName(?string name): void | | `handle` | `?string` | Optional | The product price point API handle | getHandle(): ?string | setHandle(?string handle): void | | `priceInCents` | `?int` | Optional | The product price point price, in integer cents | getPriceInCents(): ?int | setPriceInCents(?int priceInCents): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this product price point would renew every 30 days | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this product price point would renew every 30 days. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this product price point, either month or day | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | | `trialPriceInCents` | `?int` | Optional | The product price point trial price, in integer cents | getTrialPriceInCents(): ?int | setTrialPriceInCents(?int trialPriceInCents): void | -| `trialInterval` | `?int` | Optional | The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | +| `trialInterval` | `?int` | Optional | The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day would mean this product price point trial would last 30 days. | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | | `trialIntervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product price point, either month or day | getTrialIntervalUnit(): ?string | setTrialIntervalUnit(?string trialIntervalUnit): void | -| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | +| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trial period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | | `introductoryOffer` | `?bool` | Optional | reserved for future use | getIntroductoryOffer(): ?bool | setIntroductoryOffer(?bool introductoryOffer): void | | `initialChargeInCents` | `?int` | Optional | The product price point initial charge, in integer cents | getInitialChargeInCents(): ?int | setInitialChargeInCents(?int initialChargeInCents): void | | `initialChargeAfterTrial` | `?bool` | Optional | - | getInitialChargeAfterTrial(): ?bool | setInitialChargeAfterTrial(?bool initialChargeAfterTrial): 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 | +| `expirationInterval` | `?int` | Optional | The numerical expiration interval. e.g., 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 | | `productId` | `?int` | Optional | The product id this price point belongs to | getProductId(): ?int | setProductId(?int productId): void | | `archivedAt` | `?DateTime` | Optional | Timestamp indicating when this price point was archived | getArchivedAt(): ?\DateTime | setArchivedAt(?\DateTime archivedAt): void | @@ -34,15 +34,17 @@ | `subscriptionId` | `?int` | Optional | The subscription id this price point belongs to | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `currencyPrices` | [`?(CurrencyPrice[])`](../../doc/models/currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. | getCurrencyPrices(): ?array | setCurrencyPrices(?array currencyPrices): void | -## Example (as JSON) +## Example -```json -{ - "id": 196, - "name": "name6", - "handle": "handle2", - "price_in_cents": 248, - "interval": 8 -} +```php +use AdvancedBillingLib\Models\Builders\ProductPricePointBuilder; + +$productPricePoint = ProductPricePointBuilder::init() + ->id(10) + ->name('name0') + ->handle('handle6') + ->priceInCents(178) + ->interval(194) + ->build(); ``` diff --git a/doc/models/product-response.md b/doc/models/product-response.md index 5db86977..3034dfcf 100644 --- a/doc/models/product-response.md +++ b/doc/models/product-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `product` | [`Product`](../../doc/models/product.md) | Required | - | getProduct(): Product | setProduct(Product product): void | -## Example (as JSON) - -```json -{ - "product": { - "id": 134, - "name": "name0", - "handle": "handle6", - "description": "description0", - "accounting_code": "accounting_code6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProductResponseBuilder; +use AdvancedBillingLib\Models\Builders\ProductBuilder; + +$productResponse = ProductResponseBuilder::init( + ProductBuilder::init() + ->id(134) + ->name('name0') + ->handle('handle6') + ->description('description0') + ->accountingCode('accounting_code6') + ->build() +)->build(); ``` diff --git a/doc/models/product.md b/doc/models/product.md index 3a5b7776..19e632f2 100644 --- a/doc/models/product.md +++ b/doc/models/product.md @@ -13,18 +13,18 @@ | `name` | `?string` | Optional | The product name | getName(): ?string | setName(?string name): void | | `handle` | `?string` | Optional | The product API handle | getHandle(): ?string | setHandle(?string handle): void | | `description` | `?string` | Optional | The product description | getDescription(): ?string | setDescription(?string description): void | -| `accountingCode` | `?string` | Optional | E.g. Internal ID or SKU Number | getAccountingCode(): ?string | setAccountingCode(?string accountingCode): void | +| `accountingCode` | `?string` | Optional | E.g., Internal ID or SKU Number | getAccountingCode(): ?string | setAccountingCode(?string accountingCode): void | | `requestCreditCard` | `?bool` | Optional | Deprecated value that can be ignored unless you have legacy hosted pages. For Public Signup Page users, read this attribute from under the signup page. | getRequestCreditCard(): ?bool | setRequestCreditCard(?bool requestCreditCard): void | -| `expirationInterval` | `?int` | Optional | A numerical interval for the length a subscription to this product will run before it expires. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval | getExpirationInterval(): ?int | setExpirationInterval(?int expirationInterval): void | +| `expirationInterval` | `?int` | Optional | A numerical interval for the length a subscription to this product will run before it expires. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval. | 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, either month, day or never | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | | `createdAt` | `?DateTime` | Optional | Timestamp indicating when this product was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | Timestamp indicating when this product was last updated | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | | `priceInCents` | `?int` | Optional | The product price, in integer cents | getPriceInCents(): ?int | setPriceInCents(?int priceInCents): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this product would renew every 30 days. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this product, either month or day | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | | `initialChargeInCents` | `?int` | Optional | The up front charge you have specified. | getInitialChargeInCents(): ?int | setInitialChargeInCents(?int initialChargeInCents): void | | `trialPriceInCents` | `?int` | Optional | The price of the trial period for a subscription to this product, in integer cents. | getTrialPriceInCents(): ?int | setTrialPriceInCents(?int trialPriceInCents): void | -| `trialInterval` | `?int` | Optional | A numerical interval for the length of the trial period of a subscription to this product. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | +| `trialInterval` | `?int` | Optional | A numerical interval for the length of the trial period of a subscription to this product. See the description of interval for a description of how this value is coupled with an interval unit to calculate the full interval. | getTrialInterval(): ?int | setTrialInterval(?int trialInterval): void | | `trialIntervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the trial interval unit for this product, either month or day | getTrialIntervalUnit(): ?string | setTrialIntervalUnit(?string trialIntervalUnit): void | | `archivedAt` | `?DateTime` | Optional | Timestamp indicating when this product was archived | getArchivedAt(): ?\DateTime | setArchivedAt(?\DateTime archivedAt): void | | `requireCreditCard` | `?bool` | Optional | Boolean that controls whether a payment profile is required to be entered for customers wishing to sign up on this product. | getRequireCreditCard(): ?bool | setRequireCreditCard(?bool requireCreditCard): void | @@ -33,7 +33,7 @@ | `updateReturnUrl` | `?string` | Optional | The url to which a customer will be returned after a successful account update | getUpdateReturnUrl(): ?string | setUpdateReturnUrl(?string updateReturnUrl): void | | `initialChargeAfterTrial` | `?bool` | Optional | - | getInitialChargeAfterTrial(): ?bool | setInitialChargeAfterTrial(?bool initialChargeAfterTrial): void | | `versionNumber` | `?int` | Optional | The version of the product | getVersionNumber(): ?int | setVersionNumber(?int versionNumber): void | -| `updateReturnParams` | `?string` | Optional | The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#return-parameters-after-account-update) | getUpdateReturnParams(): ?string | setUpdateReturnParams(?string updateReturnParams): void | +| `updateReturnParams` | `?string` | Optional | The parameters will append to the url after a successful account update. See [help documentation](https://help.chargify.com/products/product-editing.html#return-parameters-after-account-update). | getUpdateReturnParams(): ?string | setUpdateReturnParams(?string updateReturnParams): void | | `productFamily` | [`?ProductFamily`](../../doc/models/product-family.md) | Optional | - | getProductFamily(): ?ProductFamily | setProductFamily(?ProductFamily productFamily): void | | `publicSignupPages` | [`?(PublicSignupPage[])`](../../doc/models/public-signup-page.md) | Optional | - | getPublicSignupPages(): ?array | setPublicSignupPages(?array publicSignupPages): void | | `productPricePointName` | `?string` | Optional | - | getProductPricePointName(): ?string | setProductPricePointName(?string productPricePointName): void | @@ -46,16 +46,19 @@ | `itemCategory` | `?string` | Optional | One of the following: Business Software, Consumer Software, Digital Services, Physical Goods, Other | getItemCategory(): ?string | setItemCategory(?string itemCategory): void | | `productPricePointId` | `?int` | Optional | - | getProductPricePointId(): ?int | setProductPricePointId(?int productPricePointId): void | | `productPricePointHandle` | `?string` | Optional | - | getProductPricePointHandle(): ?string | setProductPricePointHandle(?string productPricePointHandle): void | +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this product instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | -## Example (as JSON) +## Example -```json -{ - "id": 180, - "name": "name4", - "handle": "handle0", - "description": "description4", - "accounting_code": "accounting_code0" -} +```php +use AdvancedBillingLib\Models\Builders\ProductBuilder; + +$product = ProductBuilder::init() + ->id(134) + ->name('name0') + ->handle('handle6') + ->description('description0') + ->accountingCode('accounting_code6') + ->build(); ``` diff --git a/doc/models/proforma-bad-request-error-response-exception.md b/doc/models/proforma-bad-request-error-response-exception.md index 963bd94f..35dac55e 100644 --- a/doc/models/proforma-bad-request-error-response-exception.md +++ b/doc/models/proforma-bad-request-error-response-exception.md @@ -11,18 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?ProformaError`](../../doc/models/proforma-error.md) | Optional | - | getErrors(): ?ProformaError | setErrors(?ProformaError errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "subscription": { - "base": [ - "base3", - "base4" - ] - } - } +## Example + +```php +try { + // make the API call +} catch (ProformaBadRequestErrorResponseException $exp) { + echo 'Caught ProformaBadRequestErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/proforma-error.md b/doc/models/proforma-error.md index 9f59dce4..e41f05d2 100644 --- a/doc/models/proforma-error.md +++ b/doc/models/proforma-error.md @@ -11,16 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`?BaseStringError`](../../doc/models/base-string-error.md) | Optional | The error is base if it is not directly associated with a single attribute. | getSubscription(): ?BaseStringError | setSubscription(?BaseStringError subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "base": [ - "base3", - "base4" - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProformaErrorBuilder; +use AdvancedBillingLib\Models\Builders\BaseStringErrorBuilder; + +$proformaError = ProformaErrorBuilder::init() + ->subscription( + BaseStringErrorBuilder::init() + ->base( + [ + 'base3', + 'base4' + ] + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/proforma-invoice-credit.md b/doc/models/proforma-invoice-credit.md index c587f155..4bb925ad 100644 --- a/doc/models/proforma-invoice-credit.md +++ b/doc/models/proforma-invoice-credit.md @@ -14,14 +14,16 @@ | `originalAmount` | `?string` | Optional | **Constraints**: *Minimum Length*: `1` | getOriginalAmount(): ?string | setOriginalAmount(?string originalAmount): void | | `appliedAmount` | `?string` | Optional | **Constraints**: *Minimum Length*: `1` | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "memo": "memo2", - "original_amount": "original_amount2", - "applied_amount": "applied_amount0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProformaInvoiceCreditBuilder; + +$proformaInvoiceCredit = ProformaInvoiceCreditBuilder::init() + ->uid('uid4') + ->memo('memo8') + ->originalAmount('original_amount8') + ->appliedAmount('applied_amount4') + ->build(); ``` diff --git a/doc/models/proforma-invoice-discount-source-type.md b/doc/models/proforma-invoice-discount-source-type.md index 9ca7d08f..5d2f320a 100644 --- a/doc/models/proforma-invoice-discount-source-type.md +++ b/doc/models/proforma-invoice-discount-source-type.md @@ -12,3 +12,11 @@ | `COUPON` | | `REFERRAL` | +## Example + +```php +use AdvancedBillingLib\Models\ProformaInvoiceDiscountSourceType; + +$proformaInvoiceDiscountSourceType = ProformaInvoiceDiscountSourceType::COUPON; +``` + diff --git a/doc/models/proforma-invoice-discount.md b/doc/models/proforma-invoice-discount.md index db60cbab..db85020e 100644 --- a/doc/models/proforma-invoice-discount.md +++ b/doc/models/proforma-invoice-discount.md @@ -18,15 +18,19 @@ | `discountAmount` | `?string` | Optional | **Constraints**: *Minimum Length*: `1` | getDiscountAmount(): ?string | setDiscountAmount(?string discountAmount): void | | `lineItemBreakouts` | [`?(InvoiceDiscountBreakout[])`](../../doc/models/invoice-discount-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | getLineItemBreakouts(): ?array | setLineItemBreakouts(?array lineItemBreakouts): void | -## Example (as JSON) - -```json -{ - "uid": "uid2", - "title": "title8", - "code": "code0", - "source_type": "Coupon", - "discount_type": "percentage" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProformaInvoiceDiscountBuilder; +use AdvancedBillingLib\Models\ProformaInvoiceDiscountSourceType; +use AdvancedBillingLib\Models\InvoiceDiscountType; + +$proformaInvoiceDiscount = ProformaInvoiceDiscountBuilder::init() + ->uid('uid2') + ->title('title8') + ->code('code0') + ->sourceType(ProformaInvoiceDiscountSourceType::COUPON) + ->discountType(InvoiceDiscountType::PERCENTAGE) + ->build(); ``` diff --git a/doc/models/proforma-invoice-issued.md b/doc/models/proforma-invoice-issued.md index 5bcaa809..691b2842 100644 --- a/doc/models/proforma-invoice-issued.md +++ b/doc/models/proforma-invoice-issued.md @@ -21,29 +21,33 @@ | `productName` | `string` | Required | - | getProductName(): string | setProductName(string productName): void | | `lineItems` | [`InvoiceLineItemEventData[]`](../../doc/models/invoice-line-item-event-data.md) | Required | - | getLineItems(): array | setLineItems(array lineItems): void | -## Example (as JSON) - -```json -{ - "uid": "uid0", - "number": "number2", - "role": "role6", - "delivery_date": "2016-03-13", - "created_at": "2016-03-13T12:52:32.123Z", - "due_amount": "due_amount2", - "paid_amount": "paid_amount8", - "tax_amount": "tax_amount6", - "total_amount": "total_amount6", - "product_name": "product_name6", - "line_items": [ - { - "uid": "uid8", - "title": "title4", - "description": "description8", - "quantity": 102, - "quantity_delta": 204 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProformaInvoiceIssuedBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceLineItemEventDataBuilder; + +$proformaInvoiceIssued = ProformaInvoiceIssuedBuilder::init( + 'uid6', + 'number4', + 'role0', + DateTimeHelper::fromSimpleDateRequired('2016-03-13'), + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + 'due_amount8', + 'paid_amount8', + 'tax_amount0', + 'total_amount2', + 'product_name2', + [ + InvoiceLineItemEventDataBuilder::init() + ->uid('uid8') + ->title('title4') + ->description('description8') + ->quantity(102) + ->quantityDelta(204) + ->build() + ] +)->build(); ``` diff --git a/doc/models/proforma-invoice-payment.md b/doc/models/proforma-invoice-payment.md index 8d460b4e..def6bc00 100644 --- a/doc/models/proforma-invoice-payment.md +++ b/doc/models/proforma-invoice-payment.md @@ -14,14 +14,16 @@ | `appliedAmount` | `?string` | Optional | **Constraints**: *Minimum Length*: `1` | getAppliedAmount(): ?string | setAppliedAmount(?string appliedAmount): void | | `prepayment` | `?bool` | Optional | - | getPrepayment(): ?bool | setPrepayment(?bool prepayment): void | -## Example (as JSON) - -```json -{ - "memo": "memo4", - "original_amount": "original_amount4", - "applied_amount": "applied_amount8", - "prepayment": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProformaInvoicePaymentBuilder; + +$proformaInvoicePayment = ProformaInvoicePaymentBuilder::init() + ->memo('memo2') + ->originalAmount('original_amount2') + ->appliedAmount('applied_amount0') + ->prepayment(false) + ->build(); ``` diff --git a/doc/models/proforma-invoice-role.md b/doc/models/proforma-invoice-role.md index 67a30d10..1f451991 100644 --- a/doc/models/proforma-invoice-role.md +++ b/doc/models/proforma-invoice-role.md @@ -1,7 +1,7 @@ # Proforma Invoice Role -'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic +'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic. ## Enumeration @@ -16,3 +16,11 @@ | `PROFORMA_ADHOC` | | `PROFORMA_AUTOMATIC` | +## Example + +```php +use AdvancedBillingLib\Models\ProformaInvoiceRole; + +$proformaInvoiceRole = ProformaInvoiceRole::UNSET_; +``` + diff --git a/doc/models/proforma-invoice-status.md b/doc/models/proforma-invoice-status.md index 73e3ddef..a0b95485 100644 --- a/doc/models/proforma-invoice-status.md +++ b/doc/models/proforma-invoice-status.md @@ -13,3 +13,11 @@ | `VOIDED` | | `ARCHIVED` | +## Example + +```php +use AdvancedBillingLib\Models\ProformaInvoiceStatus; + +$proformaInvoiceStatus = ProformaInvoiceStatus::DRAFT; +``` + diff --git a/doc/models/proforma-invoice-tax-source-type.md b/doc/models/proforma-invoice-tax-source-type.md index fab176de..736b8f3f 100644 --- a/doc/models/proforma-invoice-tax-source-type.md +++ b/doc/models/proforma-invoice-tax-source-type.md @@ -12,3 +12,11 @@ | `TAX` | | `AVALARA` | +## Example + +```php +use AdvancedBillingLib\Models\ProformaInvoiceTaxSourceType; + +$proformaInvoiceTaxSourceType = ProformaInvoiceTaxSourceType::TAX; +``` + diff --git a/doc/models/proforma-invoice-tax.md b/doc/models/proforma-invoice-tax.md index 1b4638ba..c0a04d3d 100644 --- a/doc/models/proforma-invoice-tax.md +++ b/doc/models/proforma-invoice-tax.md @@ -17,15 +17,18 @@ | `taxAmount` | `?string` | Optional | **Constraints**: *Minimum Length*: `1` | getTaxAmount(): ?string | setTaxAmount(?string taxAmount): void | | `lineItemBreakouts` | [`?(InvoiceTaxBreakout[])`](../../doc/models/invoice-tax-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | getLineItemBreakouts(): ?array | setLineItemBreakouts(?array lineItemBreakouts): void | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "title": "title4", - "source_type": "Tax", - "percentage": "percentage6", - "taxable_amount": "taxable_amount2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ProformaInvoiceTaxBuilder; +use AdvancedBillingLib\Models\ProformaInvoiceTaxSourceType; + +$proformaInvoiceTax = ProformaInvoiceTaxBuilder::init() + ->uid('uid4') + ->title('title0') + ->sourceType(ProformaInvoiceTaxSourceType::TAX) + ->percentage('percentage2') + ->taxableAmount('taxable_amount8') + ->build(); ``` diff --git a/doc/models/proforma-invoice.md b/doc/models/proforma-invoice.md index 5ee1cb77..66ed9e17 100644 --- a/doc/models/proforma-invoice.md +++ b/doc/models/proforma-invoice.md @@ -21,12 +21,12 @@ | `collectionMethod` | [`?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`. | getCollectionMethod(): ?string | setCollectionMethod(?string collectionMethod): void | | `paymentInstructions` | `?string` | Optional | - | getPaymentInstructions(): ?string | setPaymentInstructions(?string paymentInstructions): void | | `currency` | `?string` | Optional | - | getCurrency(): ?string | setCurrency(?string currency): void | -| `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | +| `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | | `productName` | `?string` | Optional | - | getProductName(): ?string | setProductName(?string productName): void | | `productFamilyName` | `?string` | Optional | - | getProductFamilyName(): ?string | setProductFamilyName(?string productFamilyName): void | -| `role` | [`?string(ProformaInvoiceRole)`](../../doc/models/proforma-invoice-role.md) | Optional | 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic | getRole(): ?string | setRole(?string role): void | +| `role` | [`?string(ProformaInvoiceRole)`](../../doc/models/proforma-invoice-role.md) | Optional | 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic. | getRole(): ?string | setRole(?string role): void | | `seller` | [`?InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the invoice. | getSeller(): ?InvoiceSeller | setSeller(?InvoiceSeller seller): void | -| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the invoiced subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | +| `customer` | [`?InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient of the invoiced subscription. | getCustomer(): ?InvoiceCustomer | setCustomer(?InvoiceCustomer customer): void | | `memo` | `?string` | Optional | - | getMemo(): ?string | setMemo(?string memo): void | | `billingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | - | getBillingAddress(): ?InvoiceAddress | setBillingAddress(?InvoiceAddress billingAddress): void | | `shippingAddress` | [`?InvoiceAddress`](../../doc/models/invoice-address.md) | Optional | - | getShippingAddress(): ?InvoiceAddress | setShippingAddress(?InvoiceAddress shippingAddress): void | @@ -47,15 +47,17 @@ | `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) +## Example -```json -{ - "uid": "uid6", - "site_id": 196, - "customer_id": 52, - "subscription_id": 124, - "number": 0 -} +```php +use AdvancedBillingLib\Models\Builders\ProformaInvoiceBuilder; + +$proformaInvoice = ProformaInvoiceBuilder::init() + ->uid('uid8') + ->siteId(94) + ->customerId(206) + ->subscriptionId(22) + ->number(102) + ->build(); ``` diff --git a/doc/models/proration.md b/doc/models/proration.md index 50f3eee1..957e6ddb 100644 --- a/doc/models/proration.md +++ b/doc/models/proration.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `preservePeriod` | `?bool` | Optional | The alternative to sending preserve_period as a direct attribute to migration | getPreservePeriod(): ?bool | setPreservePeriod(?bool preservePeriod): void | -## Example (as JSON) +## Example -```json -{ - "preserve_period": false -} +```php +use AdvancedBillingLib\Models\Builders\ProrationBuilder; + +$proration = ProrationBuilder::init() + ->preservePeriod(false) + ->build(); ``` diff --git a/doc/models/public-key.md b/doc/models/public-key.md index 9de906bf..0b774193 100644 --- a/doc/models/public-key.md +++ b/doc/models/public-key.md @@ -13,13 +13,16 @@ | `requiresSecurityToken` | `?bool` | Optional | - | getRequiresSecurityToken(): ?bool | setRequiresSecurityToken(?bool requiresSecurityToken): void | | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | -## Example (as JSON) - -```json -{ - "public_key": "public_key8", - "requires_security_token": false, - "created_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\PublicKeyBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$publicKey = PublicKeyBuilder::init() + ->publicKey('public_key2') + ->requiresSecurityToken(false) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/public-signup-page.md b/doc/models/public-signup-page.md index cb72f7bb..675e87da 100644 --- a/doc/models/public-signup-page.md +++ b/doc/models/public-signup-page.md @@ -10,18 +10,20 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `id` | `?int` | Optional | The id of the signup page (public_signup_pages only) | getId(): ?int | setId(?int id): void | -| `returnUrl` | `?string` | Optional | The url to which a customer will be returned after a successful signup (public_signup_pages only) | getReturnUrl(): ?string | setReturnUrl(?string returnUrl): void | +| `returnUrl` | `?string` | Optional | The url to which a customer will be returned after a successful signup (public_signup_pages only). | getReturnUrl(): ?string | setReturnUrl(?string returnUrl): void | | `returnParams` | `?string` | Optional | The params to be appended to the return_url (public_signup_pages only) | getReturnParams(): ?string | setReturnParams(?string returnParams): void | -| `url` | `?string` | Optional | The url where the signup page can be viewed (public_signup_pages only) | getUrl(): ?string | setUrl(?string url): void | +| `url` | `?string` | Optional | The url where the signup page can be viewed (public_signup_pages only). | getUrl(): ?string | setUrl(?string url): void | -## Example (as JSON) +## Example -```json -{ - "id": 6, - "return_url": "return_url0", - "return_params": "return_params2", - "url": "url8" -} +```php +use AdvancedBillingLib\Models\Builders\PublicSignupPageBuilder; + +$publicSignupPage = PublicSignupPageBuilder::init() + ->id(20) + ->returnUrl('return_url0') + ->returnParams('return_params2') + ->url('url8') + ->build(); ``` diff --git a/doc/models/q-scope.md b/doc/models/q-scope.md new file mode 100644 index 00000000..271a0479 --- /dev/null +++ b/doc/models/q-scope.md @@ -0,0 +1,26 @@ + +# Q Scope + +## Enumeration + +`QScope` + +## Fields + +| Name | +| --- | +| `FULL_NAME` | +| `FIRST_NAME` | +| `LAST_NAME` | +| `ORGANIZATION` | +| `CUSTOMER_REFERENCE` | +| `SUBSCRIPTION_REFERENCE` | + +## Example + +```php +use AdvancedBillingLib\Models\QScope; + +$qScope = QScope::LAST_NAME; +``` + diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md index 9976538c..befbbd30 100644 --- a/doc/models/quantity-based-component.md +++ b/doc/models/quantity-based-component.md @@ -9,10 +9,10 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes". | getName(): string | setName(string name): void | -| `unitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item | getUnitName(): string | setUnitName(string unitName): void | +| `name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, e.g., "Minutes". | getName(): string | setName(string name): void | +| `unitName` | `string` | Required | “The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on a subscription’s component line-item.” | getUnitName(): string | setUnitName(string unitName): void | | `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 | +| `handle` | `?string` | Optional | A unique identifier for your use that can be used to retrieve this component in 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 | | `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 | @@ -26,27 +26,39 @@ | `displayOnHostedPage` | `?bool` | Optional | - | getDisplayOnHostedPage(): ?bool | setDisplayOnHostedPage(?bool displayOnHostedPage): void | | `allowFractionalQuantities` | `?bool` | Optional | - | getAllowFractionalQuantities(): ?bool | setAllowFractionalQuantities(?bool allowFractionalQuantities): void | | `publicSignupPageIds` | `?(int[])` | Optional | - | getPublicSignupPageIds(): ?array | setPublicSignupPageIds(?array publicSignupPageIds): void | -| `interval` | `?int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | +| `interval` | `?int` | Optional | The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean this component’s default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | getInterval(): ?int | setInterval(?int interval): void | | `intervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled. | getIntervalUnit(): ?string | setIntervalUnit(?string intervalUnit): void | +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | -## Example (as JSON) - -```json -{ - "name": "name8", - "unit_name": "unit_name0", - "description": "description8", - "handle": "handle4", - "taxable": false, - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "upgrade_charge": "full" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\QuantityBasedComponentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\CreditType; + +$quantityBasedComponent = QuantityBasedComponentBuilder::init( + 'name0', + 'unit_name2', + PricingScheme::PER_UNIT +) + ->description('description0') + ->handle('handle6') + ->taxable(false) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->upgradeCharge(CreditType::FULL) + ->build(); ``` diff --git a/doc/models/reactivate-subscription-group-request.md b/doc/models/reactivate-subscription-group-request.md index 258f0e84..a6be1706 100644 --- a/doc/models/reactivate-subscription-group-request.md +++ b/doc/models/reactivate-subscription-group-request.md @@ -12,12 +12,14 @@ | `resume` | `?bool` | Optional | - | getResume(): ?bool | setResume(?bool resume): void | | `resumeMembers` | `?bool` | Optional | - | getResumeMembers(): ?bool | setResumeMembers(?bool resumeMembers): void | -## Example (as JSON) +## Example -```json -{ - "resume": false, - "resume_members": false -} +```php +use AdvancedBillingLib\Models\Builders\ReactivateSubscriptionGroupRequestBuilder; + +$reactivateSubscriptionGroupRequest = ReactivateSubscriptionGroupRequestBuilder::init() + ->resume(false) + ->resumeMembers(false) + ->build(); ``` diff --git a/doc/models/reactivate-subscription-group-response.md b/doc/models/reactivate-subscription-group-response.md index 69fdc937..fca8c376 100644 --- a/doc/models/reactivate-subscription-group-response.md +++ b/doc/models/reactivate-subscription-group-response.md @@ -19,18 +19,23 @@ | `state` | `?string` | Optional | - | getState(): ?string | setState(?string state): void | | `cancelAtEndOfPeriod` | `?bool` | Optional | - | getCancelAtEndOfPeriod(): ?bool | setCancelAtEndOfPeriod(?bool cancelAtEndOfPeriod): void | -## Example (as JSON) - -```json -{ - "uid": "uid4", - "scheme": 66, - "customer_id": 86, - "payment_profile_id": 250, - "subscription_ids": [ - 196, - 197 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReactivateSubscriptionGroupResponseBuilder; + +$reactivateSubscriptionGroupResponse = ReactivateSubscriptionGroupResponseBuilder::init() + ->uid('uid0') + ->scheme(10) + ->customerId(30) + ->paymentProfileId(62) + ->subscriptionIds( + [ + 140, + 141, + 142 + ] + ) + ->build(); ``` diff --git a/doc/models/reactivate-subscription-request.md b/doc/models/reactivate-subscription-request.md index aff5d2b2..bb3bf89b 100644 --- a/doc/models/reactivate-subscription-request.md +++ b/doc/models/reactivate-subscription-request.md @@ -9,24 +9,30 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `calendarBilling` | [`?ReactivationBilling`](../../doc/models/reactivation-billing.md) | Optional | These values are only applicable to subscriptions using calendar billing | getCalendarBilling(): ?ReactivationBilling | setCalendarBilling(?ReactivationBilling calendarBilling): void | +| `calendarBilling` | [`?ReactivationBilling`](../../doc/models/reactivation-billing.md) | Optional | These values are only applicable to subscriptions using calendar billing. | getCalendarBilling(): ?ReactivationBilling | setCalendarBilling(?ReactivationBilling calendarBilling): void | | `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, 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) - -```json -{ - "calendar_billing": { - "reactivation_charge": "prorated" - }, - "include_trial": false, - "preserve_balance": false, - "coupon_code": "coupon_code6", - "use_credits_and_prepayments": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReactivateSubscriptionRequestBuilder; +use AdvancedBillingLib\Models\Builders\ReactivationBillingBuilder; +use AdvancedBillingLib\Models\ReactivationCharge; + +$reactivateSubscriptionRequest = ReactivateSubscriptionRequestBuilder::init() + ->calendarBilling( + ReactivationBillingBuilder::init() + ->reactivationCharge(ReactivationCharge::PRORATED) + ->build() + ) + ->includeTrial(false) + ->preserveBalance(false) + ->couponCode('coupon_code2') + ->useCreditsAndPrepayments(false) + ->build(); ``` diff --git a/doc/models/reactivation-billing.md b/doc/models/reactivation-billing.md index bcbd881d..d82103eb 100644 --- a/doc/models/reactivation-billing.md +++ b/doc/models/reactivation-billing.md @@ -1,7 +1,7 @@ # Reactivation Billing -These values are only applicable to subscriptions using calendar billing +These values are only applicable to subscriptions using calendar billing. ## Structure @@ -11,13 +11,16 @@ These values are only applicable to subscriptions using calendar billing | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `reactivationCharge` | [`?string(ReactivationCharge)`](../../doc/models/reactivation-charge.md) | Optional | You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated charge for the product price will be attempted for to complete the period 2) `immediate` A full-price charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the product price will be attempted at the next renewal

**Default**: `ReactivationCharge::PRORATED` | getReactivationCharge(): ?string | setReactivationCharge(?string reactivationCharge): void | +| `reactivationCharge` | [`?string(ReactivationCharge)`](../../doc/models/reactivation-charge.md) | Optional | You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated charge for the product price will be attempted to complete the period 2) `immediate` A full-price charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the product price will be attempted at the next renewal.

**Default**: `ReactivationCharge::PRORATED` | getReactivationCharge(): ?string | setReactivationCharge(?string reactivationCharge): void | -## Example (as JSON) +## Example -```json -{ - "reactivation_charge": "prorated" -} +```php +use AdvancedBillingLib\Models\Builders\ReactivationBillingBuilder; +use AdvancedBillingLib\Models\ReactivationCharge; + +$reactivationBilling = ReactivationBillingBuilder::init() + ->reactivationCharge(ReactivationCharge::PRORATED) + ->build(); ``` diff --git a/doc/models/reactivation-charge.md b/doc/models/reactivation-charge.md index dbe0bc6e..f37a696a 100644 --- a/doc/models/reactivation-charge.md +++ b/doc/models/reactivation-charge.md @@ -1,7 +1,7 @@ # Reactivation Charge -You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated charge for the product price will be attempted for to complete the period 2) `immediate` A full-price charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the product price will be attempted at the next renewal +You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated charge for the product price will be attempted to complete the period 2) `immediate` A full-price charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the product price will be attempted at the next renewal. ## Enumeration @@ -15,3 +15,11 @@ You may choose how to handle the reactivation charge for that subscription: 1) ` | `IMMEDIATE` | | `DELAYED` | +## Example + +```php +use AdvancedBillingLib\Models\ReactivationCharge; + +$reactivationCharge = ReactivationCharge::IMMEDIATE; +``` + diff --git a/doc/models/reason-code-response.md b/doc/models/reason-code-response.md index d0507635..8bbeadc4 100644 --- a/doc/models/reason-code-response.md +++ b/doc/models/reason-code-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `reasonCode` | [`ReasonCode`](../../doc/models/reason-code.md) | Required | - | getReasonCode(): ReasonCode | setReasonCode(ReasonCode reasonCode): void | -## Example (as JSON) - -```json -{ - "reason_code": { - "id": 240, - "site_id": 166, - "code": "code4", - "description": "description6", - "position": 14 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReasonCodeResponseBuilder; +use AdvancedBillingLib\Models\Builders\ReasonCodeBuilder; + +$reasonCodeResponse = ReasonCodeResponseBuilder::init( + ReasonCodeBuilder::init() + ->id(240) + ->siteId(166) + ->code('code4') + ->description('description6') + ->position(14) + ->build() +)->build(); ``` diff --git a/doc/models/reason-code.md b/doc/models/reason-code.md index 0d78d4aa..f0660c9a 100644 --- a/doc/models/reason-code.md +++ b/doc/models/reason-code.md @@ -17,15 +17,17 @@ | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -## Example (as JSON) - -```json -{ - "id": 164, - "site_id": 90, - "code": "code0", - "description": "description2", - "position": 194 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReasonCodeBuilder; + +$reasonCode = ReasonCodeBuilder::init() + ->id(174) + ->siteId(100) + ->code('code4') + ->description('description6') + ->position(204) + ->build(); ``` diff --git a/doc/models/record-payment-request.md b/doc/models/record-payment-request.md index 34974c7f..df35bb1d 100644 --- a/doc/models/record-payment-request.md +++ b/doc/models/record-payment-request.md @@ -11,16 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `payment` | [`CreatePayment`](../../doc/models/create-payment.md) | Required | - | getPayment(): CreatePayment | setPayment(CreatePayment payment): void | -## Example (as JSON) - -```json -{ - "payment": { - "amount": "amount8", - "memo": "memo0", - "payment_details": "payment_details6", - "payment_method": "cash" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RecordPaymentRequestBuilder; +use AdvancedBillingLib\Models\Builders\CreatePaymentBuilder; +use AdvancedBillingLib\Models\InvoicePaymentMethodType; + +$recordPaymentRequest = RecordPaymentRequestBuilder::init( + CreatePaymentBuilder::init( + 'amount8', + 'memo0', + 'payment_details6', + InvoicePaymentMethodType::CASH + )->build() +)->build(); ``` diff --git a/doc/models/record-payment-response.md b/doc/models/record-payment-response.md index 0e1586a3..04b1c533 100644 --- a/doc/models/record-payment-response.md +++ b/doc/models/record-payment-response.md @@ -12,35 +12,32 @@ | `paidInvoices` | [`?(PaidInvoice[])`](../../doc/models/paid-invoice.md) | Optional | - | getPaidInvoices(): ?array | setPaidInvoices(?array paidInvoices): void | | `prepayment` | [`?InvoicePrePayment`](../../doc/models/invoice-pre-payment.md) | Optional | - | getPrepayment(): ?InvoicePrePayment | setPrepayment(?InvoicePrePayment prepayment): void | -## Example (as JSON) - -```json -{ - "paid_invoices": [ - { - "invoice_id": "invoice_id8", - "status": "draft", - "due_amount": "due_amount0", - "paid_amount": "paid_amount0" - }, - { - "invoice_id": "invoice_id8", - "status": "draft", - "due_amount": "due_amount0", - "paid_amount": "paid_amount0" - }, - { - "invoice_id": "invoice_id8", - "status": "draft", - "due_amount": "due_amount0", - "paid_amount": "paid_amount0" - } - ], - "prepayment": { - "subscription_id": 148, - "amount_in_cents": 124, - "ending_balance_in_cents": 164 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RecordPaymentResponseBuilder; +use AdvancedBillingLib\Models\Builders\PaidInvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceStatus; +use AdvancedBillingLib\Models\Builders\InvoicePrePaymentBuilder; + +$recordPaymentResponse = RecordPaymentResponseBuilder::init() + ->paidInvoices( + [ + PaidInvoiceBuilder::init() + ->invoiceId('invoice_id8') + ->status(InvoiceStatus::DRAFT) + ->dueAmount('due_amount0') + ->paidAmount('paid_amount0') + ->build() + ] + ) + ->prepayment( + InvoicePrePaymentBuilder::init() + ->subscriptionId(148) + ->amountInCents(124) + ->endingBalanceInCents(164) + ->build() + ) + ->build(); ``` diff --git a/doc/models/recurring-scheme.md b/doc/models/recurring-scheme.md index 8e378217..249f22ab 100644 --- a/doc/models/recurring-scheme.md +++ b/doc/models/recurring-scheme.md @@ -13,3 +13,11 @@ | `RECUR_INDEFINITELY` | | `RECUR_WITH_DURATION` | +## Example + +```php +use AdvancedBillingLib\Models\RecurringScheme; + +$recurringScheme = RecurringScheme::RECUR_INDEFINITELY; +``` + diff --git a/doc/models/referral-code.md b/doc/models/referral-code.md index 7f853628..31a6f796 100644 --- a/doc/models/referral-code.md +++ b/doc/models/referral-code.md @@ -14,14 +14,16 @@ | `subscriptionId` | `?int` | Optional | - | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | | `code` | `?string` | Optional | - | getCode(): ?string | setCode(?string code): void | -## Example (as JSON) - -```json -{ - "id": 42, - "site_id": 224, - "subscription_id": 152, - "code": "code6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReferralCodeBuilder; + +$referralCode = ReferralCodeBuilder::init() + ->id(186) + ->siteId(112) + ->subscriptionId(40) + ->code('code6') + ->build(); ``` diff --git a/doc/models/referral-validation-response.md b/doc/models/referral-validation-response.md index c30825f3..76df4892 100644 --- a/doc/models/referral-validation-response.md +++ b/doc/models/referral-validation-response.md @@ -11,16 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `referralCode` | [`?ReferralCode`](../../doc/models/referral-code.md) | Optional | - | getReferralCode(): ?ReferralCode | setReferralCode(?ReferralCode referralCode): void | -## Example (as JSON) - -```json -{ - "referral_code": { - "id": 46, - "site_id": 228, - "subscription_id": 156, - "code": "code0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReferralValidationResponseBuilder; +use AdvancedBillingLib\Models\Builders\ReferralCodeBuilder; + +$referralValidationResponse = ReferralValidationResponseBuilder::init() + ->referralCode( + ReferralCodeBuilder::init() + ->id(46) + ->siteId(228) + ->subscriptionId(156) + ->code('code0') + ->build() + ) + ->build(); ``` diff --git a/doc/models/refund-consolidated-invoice.md b/doc/models/refund-consolidated-invoice.md index f9f1004a..ce3a3a1e 100644 --- a/doc/models/refund-consolidated-invoice.md +++ b/doc/models/refund-consolidated-invoice.md @@ -1,7 +1,7 @@ # Refund Consolidated Invoice -Refund consolidated invoice +Refund consolidated invoice. ## Structure @@ -18,19 +18,22 @@ Refund consolidated invoice | `applyCredit` | `?bool` | Optional | If set to true, creates credit and applies it to an invoice. Defaults to `false`. | getApplyCredit(): ?bool | setApplyCredit(?bool applyCredit): void | | `amount` | `?string` | Optional | The amount of payment to be refunded in decimal format. Example: "10.50". This will default to the full amount of the payment if not provided. | getAmount(): ?string | setAmount(?string amount): void | -## Example (as JSON) - -```json -{ - "memo": "memo0", - "payment_id": 46, - "segment_uids": [ - "String0", - "String1" - ], - "external": false, - "apply_credit": false, - "amount": "amount8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundConsolidatedInvoiceBuilder; + +$refundConsolidatedInvoice = RefundConsolidatedInvoiceBuilder::init( + 'memo0', + 138, + [ + 'String0', + 'String1' + ] +) + ->external(false) + ->applyCredit(false) + ->amount('amount8') + ->build(); ``` diff --git a/doc/models/refund-invoice-event-data.md b/doc/models/refund-invoice-event-data.md index 625c400c..f282292c 100644 --- a/doc/models/refund-invoice-event-data.md +++ b/doc/models/refund-invoice-event-data.md @@ -12,7 +12,7 @@ Example schema for an `refund_invoice` event | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `applyCredit` | `bool` | Required | If true, credit was created and applied it to the invoice. | getApplyCredit(): bool | setApplyCredit(bool applyCredit): void | -| `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | +| `consolidationLevel` | [`?string(InvoiceConsolidationLevel)`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:

* "none": A normal invoice with no consolidation.
* "child": An invoice segment which has been combined into a consolidated invoice.
* "parent": A consolidated invoice, whose contents are composed of invoice segments.

"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.

See also the [invoice consolidation documentation](https://maxio.zendesk.com/hc/en-us/articles/24252269909389-Invoice-Consolidation). | getConsolidationLevel(): ?string | setConsolidationLevel(?string consolidationLevel): void | | `creditNoteAttributes` | [`CreditNote`](../../doc/models/credit-note.md) | Required | - | getCreditNoteAttributes(): CreditNote | setCreditNoteAttributes(CreditNote creditNoteAttributes): void | | `memo` | `?string` | Optional | The refund memo. | getMemo(): ?string | setMemo(?string memo): void | | `originalAmount` | `?string` | Optional | The full, original amount of the refund. | getOriginalAmount(): ?string | setOriginalAmount(?string originalAmount): void | @@ -21,25 +21,31 @@ Example schema for an `refund_invoice` event | `refundId` | `int` | Required | The ID of the refund transaction. | getRefundId(): int | setRefundId(int refundId): void | | `transactionTime` | `DateTime` | Required | The time the refund was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" | getTransactionTime(): \DateTime | setTransactionTime(\DateTime transactionTime): void | -## Example (as JSON) - -```json -{ - "apply_credit": false, - "consolidation_level": "parent", - "credit_note_attributes": { - "uid": "uid2", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": "number0" - }, - "memo": "memo0", - "original_amount": "original_amount0", - "payment_id": 114, - "refund_amount": "refund_amount8", - "refund_id": 158, - "transaction_time": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundInvoiceEventDataBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; + +$refundInvoiceEventData = RefundInvoiceEventDataBuilder::init( + false, + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number('number0') + ->build(), + 140, + 'refund_amount8', + 184, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +) + ->consolidationLevel(InvoiceConsolidationLevel::PARENT_) + ->memo('memo0') + ->originalAmount('original_amount0') + ->build(); ``` diff --git a/doc/models/refund-invoice-event.md b/doc/models/refund-invoice-event.md index 5893f29a..72a0798b 100644 --- a/doc/models/refund-invoice-event.md +++ b/doc/models/refund-invoice-event.md @@ -15,41 +15,50 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::REFUND_INVOICE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`RefundInvoiceEventData`](../../doc/models/refund-invoice-event-data.md) | Required | Example schema for an `refund_invoice` event | getEventData(): RefundInvoiceEventData | setEventData(RefundInvoiceEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 54, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "refund_invoice", - "event_data": { - "apply_credit": false, - "consolidation_level": "child", - "credit_note_attributes": { - "uid": "uid2", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": "number0" - }, - "memo": "memo0", - "original_amount": "original_amount0", - "payment_id": 204, - "refund_amount": "refund_amount8", - "refund_id": 248, - "transaction_time": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundInvoiceEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceConsolidationLevel; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\RefundInvoiceEventDataBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; + +$refundInvoiceEvent = RefundInvoiceEventBuilder::init( + 132, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::REFUND_INVOICE, + RefundInvoiceEventDataBuilder::init( + false, + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number('number0') + ->build(), + 204, + 'refund_amount8', + 248, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') + ) + ->consolidationLevel(InvoiceConsolidationLevel::CHILD) + ->memo('memo0') + ->originalAmount('original_amount0') + ->build() +)->build(); ``` diff --git a/doc/models/refund-invoice-request.md b/doc/models/refund-invoice-request.md index ea1e9ff6..d03e6e19 100644 --- a/doc/models/refund-invoice-request.md +++ b/doc/models/refund-invoice-request.md @@ -11,18 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `refund` | [RefundInvoice](../../doc/models/refund-invoice.md)\|[RefundConsolidatedInvoice](../../doc/models/refund-consolidated-invoice.md) | Required | This is a container for any-of cases. | getRefund(): | setRefund( refund): void | -## Example (as JSON) - -```json -{ - "refund": { - "amount": "amount8", - "memo": "memo0", - "payment_id": 0, - "external": false, - "apply_credit": false, - "void_invoice": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundInvoiceRequestBuilder; +use AdvancedBillingLib\Models\Builders\RefundInvoiceBuilder; + +$refundInvoiceRequest = RefundInvoiceRequestBuilder::init( + RefundInvoiceBuilder::init( + 'amount8', + 'memo0', + 0 + ) + ->external(false) + ->applyCredit(false) + ->voidInvoice(false) + ->build() +)->build(); ``` diff --git a/doc/models/refund-invoice.md b/doc/models/refund-invoice.md index 48e1f03a..e654b903 100644 --- a/doc/models/refund-invoice.md +++ b/doc/models/refund-invoice.md @@ -16,18 +16,21 @@ Refund an invoice or a segment of a consolidated invoice. | `paymentId` | `int` | Required | The ID of the payment to be refunded | getPaymentId(): int | setPaymentId(int paymentId): void | | `external` | `?bool` | Optional | Flag that marks refund as external (no money is returned to the customer). Defaults to `false`. | getExternal(): ?bool | setExternal(?bool external): void | | `applyCredit` | `?bool` | Optional | If set to true, creates credit and applies it to an invoice. Defaults to `false`. | getApplyCredit(): ?bool | setApplyCredit(?bool applyCredit): void | -| `voidInvoice` | `?bool` | Optional | If `apply_credit` set to false and refunding full amount, if `void_invoice` set to true, invoice will be voided after refund. Defaults to `false`. | getVoidInvoice(): ?bool | setVoidInvoice(?bool voidInvoice): void | - -## Example (as JSON) - -```json -{ - "amount": "amount8", - "memo": "memo0", - "payment_id": 0, - "external": false, - "apply_credit": false, - "void_invoice": false -} +| `voidInvoice` | `?bool` | Optional | If `apply_credit` is set to false and refunding full amount, if `void_invoice` is set to true, invoice will be voided after refund. Defaults to `false`. | getVoidInvoice(): ?bool | setVoidInvoice(?bool voidInvoice): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundInvoiceBuilder; + +$refundInvoice = RefundInvoiceBuilder::init( + 'amount2', + 'memo4', + 36 +) + ->external(false) + ->applyCredit(false) + ->voidInvoice(false) + ->build(); ``` diff --git a/doc/models/refund-prepayment-base-errors-response-exception.md b/doc/models/refund-prepayment-base-errors-response-exception.md index fc35dc86..54f24c6c 100644 --- a/doc/models/refund-prepayment-base-errors-response-exception.md +++ b/doc/models/refund-prepayment-base-errors-response-exception.md @@ -13,20 +13,15 @@ Errors returned on creating a refund prepayment when bad request | --- | --- | --- | --- | --- | --- | | `errors` | [`?RefundPrepaymentBaseRefundError`](../../doc/models/refund-prepayment-base-refund-error.md) | Optional | - | getErrors(): ?RefundPrepaymentBaseRefundError | setErrors(?RefundPrepaymentBaseRefundError errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "refund": { - "base": [ - { - "key1": "val1", - "key2": "val2" - } - ] - } - } +## Example + +```php +try { + // make the API call +} catch (RefundPrepaymentBaseErrorsResponseException $exp) { + echo 'Caught RefundPrepaymentBaseErrorsResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/refund-prepayment-base-refund-error.md b/doc/models/refund-prepayment-base-refund-error.md index 5fa02edf..e7c4b90a 100644 --- a/doc/models/refund-prepayment-base-refund-error.md +++ b/doc/models/refund-prepayment-base-refund-error.md @@ -11,18 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `refund` | [`?BaseRefundError`](../../doc/models/base-refund-error.md) | Optional | - | getRefund(): ?BaseRefundError | setRefund(?BaseRefundError refund): void | -## Example (as JSON) - -```json -{ - "refund": { - "base": [ - { - "key1": "val1", - "key2": "val2" - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundPrepaymentBaseRefundErrorBuilder; +use AdvancedBillingLib\Models\Builders\BaseRefundErrorBuilder; +use AdvancedBillingLib\ApiHelper; + +$refundPrepaymentBaseRefundError = RefundPrepaymentBaseRefundErrorBuilder::init() + ->refund( + BaseRefundErrorBuilder::init() + ->base( + [ + ApiHelper::deserialize('{"key1":"val1","key2":"val2"}') + ] + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/refund-prepayment-request.md b/doc/models/refund-prepayment-request.md index 24d1912b..da697ca5 100644 --- a/doc/models/refund-prepayment-request.md +++ b/doc/models/refund-prepayment-request.md @@ -11,16 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `refund` | [`RefundPrepayment`](../../doc/models/refund-prepayment.md) | Required | - | getRefund(): RefundPrepayment | setRefund(RefundPrepayment refund): void | -## Example (as JSON) - -```json -{ - "refund": { - "amount_in_cents": 132, - "amount": "String1", - "memo": "memo2", - "external": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundPrepaymentRequestBuilder; +use AdvancedBillingLib\Models\Builders\RefundPrepaymentBuilder; + +$refundPrepaymentRequest = RefundPrepaymentRequestBuilder::init( + RefundPrepaymentBuilder::init( + 'String1', + 'memo2' + ) + ->amountInCents(132) + ->external(false) + ->build() +)->build(); ``` diff --git a/doc/models/refund-prepayment.md b/doc/models/refund-prepayment.md index 77058b58..db481f81 100644 --- a/doc/models/refund-prepayment.md +++ b/doc/models/refund-prepayment.md @@ -14,14 +14,17 @@ | `memo` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getMemo(): string | setMemo(string memo): void | | `external` | `?bool` | Optional | Specify the type of refund you wish to initiate. When the prepayment is external, the `external` flag is optional. But if the prepayment was made through a payment profile, the `external` flag is required. | getExternal(): ?bool | setExternal(?bool external): void | -## Example (as JSON) - -```json -{ - "amount_in_cents": 110, - "amount": "String3", - "memo": "memo4", - "external": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundPrepaymentBuilder; + +$refundPrepayment = RefundPrepaymentBuilder::init( + 'String1', + 'memo2' +) + ->amountInCents(22) + ->external(false) + ->build(); ``` diff --git a/doc/models/refund-success.md b/doc/models/refund-success.md index bb812e9b..360641f2 100644 --- a/doc/models/refund-success.md +++ b/doc/models/refund-success.md @@ -13,13 +13,15 @@ | `gatewayTransactionId` | `int` | Required | - | getGatewayTransactionId(): int | setGatewayTransactionId(int gatewayTransactionId): void | | `productId` | `int` | Required | - | getProductId(): int | setProductId(int productId): void | -## Example (as JSON) - -```json -{ - "refund_id": 12, - "gateway_transaction_id": 182, - "product_id": 168 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RefundSuccessBuilder; + +$refundSuccess = RefundSuccessBuilder::init( + 34, + 160, + 190 +)->build(); ``` diff --git a/doc/models/register.md b/doc/models/register.md index 7187939e..48cbeed9 100644 --- a/doc/models/register.md +++ b/doc/models/register.md @@ -12,16 +12,18 @@ | `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 | +| `currencyCode` | `?string` | Optional | The ISO 4217 currency code (3 character string) representing the currency of an invoice transaction. | getCurrencyCode(): ?string | setCurrencyCode(?string currencyCode): void | -## Example (as JSON) +## Example -```json -{ - "id": 90, - "maxio_id": "maxio_id0", - "name": "name6", - "currency_code": "currency_code2" -} +```php +use AdvancedBillingLib\Models\Builders\RegisterBuilder; + +$register = RegisterBuilder::init() + ->id(54) + ->maxioId('maxio_id4') + ->name('name2') + ->currencyCode('currency_code2') + ->build(); ``` diff --git a/doc/models/remove-payment-event-data.md b/doc/models/remove-payment-event-data.md index 2d6f8b0d..d3df6635 100644 --- a/doc/models/remove-payment-event-data.md +++ b/doc/models/remove-payment-event-data.md @@ -19,19 +19,25 @@ Example schema for an `remove_payment` event | `paymentMethod` | [PaymentMethodApplePay](../../doc/models/payment-method-apple-pay.md)\|[PaymentMethodBankAccount](../../doc/models/payment-method-bank-account.md)\|[PaymentMethodCreditCard](../../doc/models/payment-method-credit-card.md)\|[PaymentMethodExternal](../../doc/models/payment-method-external.md)\|[PaymentMethodPaypal](../../doc/models/payment-method-paypal.md) | Required | A nested data structure detailing the method of payment | getPaymentMethod(): | setPaymentMethod( paymentMethod): void | | `prepayment` | `bool` | Required | The flag that shows whether the original payment was a prepayment or not | getPrepayment(): bool | setPrepayment(bool prepayment): void | -## Example (as JSON) - -```json -{ - "transaction_id": 180, - "memo": "memo0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z", - "payment_method": { - "type": "apple_pay" - }, - "prepayment": false, - "original_amount": "original_amount0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RemovePaymentEventDataBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\PaymentMethodApplePayBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$removePaymentEventData = RemovePaymentEventDataBuilder::init( + 20, + 'memo4', + 'applied_amount8', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + PaymentMethodApplePayBuilder::init( + InvoiceEventPaymentMethod::APPLE_PAY + )->build(), + false +) + ->originalAmount('original_amount4') + ->build(); ``` diff --git a/doc/models/remove-payment-event.md b/doc/models/remove-payment-event.md index 47b7fe70..afd530d2 100644 --- a/doc/models/remove-payment-event.md +++ b/doc/models/remove-payment-event.md @@ -15,35 +15,44 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::REMOVE_PAYMENT` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`RemovePaymentEventData`](../../doc/models/remove-payment-event-data.md) | Required | Example schema for an `remove_payment` event | getEventData(): RemovePaymentEventData | setEventData(RemovePaymentEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 236, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "remove_payment", - "event_data": { - "transaction_id": 78, - "memo": "memo0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z", - "payment_method": { - "type": "apple_pay" - }, - "prepayment": false, - "original_amount": "original_amount0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RemovePaymentEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\RemovePaymentEventDataBuilder; +use AdvancedBillingLib\Models\Builders\PaymentMethodApplePayBuilder; +use AdvancedBillingLib\Models\InvoiceEventPaymentMethod; + +$removePaymentEvent = RemovePaymentEventBuilder::init( + 132, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::REMOVE_PAYMENT, + RemovePaymentEventDataBuilder::init( + 78, + 'memo0', + 'applied_amount2', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + PaymentMethodApplePayBuilder::init( + InvoiceEventPaymentMethod::APPLE_PAY + )->build(), + false + ) + ->originalAmount('original_amount0') + ->build() +)->build(); ``` diff --git a/doc/models/renewal-preview-component.md b/doc/models/renewal-preview-component.md index ed4a43c4..79d9eed9 100644 --- a/doc/models/renewal-preview-component.md +++ b/doc/models/renewal-preview-component.md @@ -13,13 +13,19 @@ | `quantity` | `?int` | Optional | The quantity for which you wish to preview billing. This is useful if you want to preview a predicted, higher usage value than is currently present on the subscription.

This quantity represents:

- Whether or not an on/off component is enabled - use 0 for disabled or 1 for enabled
- The desired allocated_quantity for a quantity-based component
- The desired unit_balance for a metered component
- The desired metric quantity for an events-based component | getQuantity(): ?int | setQuantity(?int quantity): void | | `pricePointId` | string\|int\|null | Optional | This is a container for one-of cases. | getPricePointId(): | setPricePointId( pricePointId): void | -## Example (as JSON) - -```json -{ - "component_id": "String7", - "quantity": 174, - "price_point_id": "String1" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RenewalPreviewComponentBuilder; + +$renewalPreviewComponent = RenewalPreviewComponentBuilder::init() + ->componentId( + 'String1' + ) + ->quantity(254) + ->pricePointId( + 'String7' + ) + ->build(); ``` diff --git a/doc/models/renewal-preview-line-item.md b/doc/models/renewal-preview-line-item.md index ef5a37c4..2b58561a 100644 --- a/doc/models/renewal-preview-line-item.md +++ b/doc/models/renewal-preview-line-item.md @@ -24,15 +24,19 @@ | `periodRangeStart` | `?string` | Optional | - | getPeriodRangeStart(): ?string | setPeriodRangeStart(?string periodRangeStart): void | | `periodRangeEnd` | `?string` | Optional | - | getPeriodRangeEnd(): ?string | setPeriodRangeEnd(?string periodRangeEnd): void | -## Example (as JSON) - -```json -{ - "transaction_type": "charge", - "kind": "prepaid_usage_component", - "amount_in_cents": 154, - "memo": "memo0", - "discount_amount_in_cents": 214 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RenewalPreviewLineItemBuilder; +use AdvancedBillingLib\Models\LineItemTransactionType; +use AdvancedBillingLib\Models\LineItemKind; + +$renewalPreviewLineItem = RenewalPreviewLineItemBuilder::init() + ->transactionType(LineItemTransactionType::ADJUSTMENT) + ->kind(LineItemKind::PREPAID_USAGE_COMPONENT) + ->amountInCents(32) + ->memo('memo0') + ->discountAmountInCents(228) + ->build(); ``` diff --git a/doc/models/renewal-preview-request.md b/doc/models/renewal-preview-request.md index a613d62b..3f84e857 100644 --- a/doc/models/renewal-preview-request.md +++ b/doc/models/renewal-preview-request.md @@ -9,29 +9,28 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `components` | [`?(RenewalPreviewComponent[])`](../../doc/models/renewal-preview-component.md) | Optional | An optional array of component definitions to preview. Providing any component definitions here will override the actual components on the subscription (and their quantities), and the billing preview will contain only these components (in addition to any product base fees). | getComponents(): ?array | setComponents(?array components): void | - -## Example (as JSON) - -```json -{ - "components": [ - { - "component_id": "String5", - "quantity": 210, - "price_point_id": "String3" - }, - { - "component_id": "String5", - "quantity": 210, - "price_point_id": "String3" - }, - { - "component_id": "String5", - "quantity": 210, - "price_point_id": "String3" - } - ] -} +| `components` | [`?(RenewalPreviewComponent[])`](../../doc/models/renewal-preview-component.md) | Optional | (Optional) Array of component definitions to preview. Providing any component definitions here will override the actual components on the subscription (and their quantities), and the billing preview will contain only these components (in addition to any product base fees). | getComponents(): ?array | setComponents(?array components): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\RenewalPreviewRequestBuilder; +use AdvancedBillingLib\Models\Builders\RenewalPreviewComponentBuilder; + +$renewalPreviewRequest = RenewalPreviewRequestBuilder::init() + ->components( + [ + RenewalPreviewComponentBuilder::init() + ->componentId( + 'String5' + ) + ->quantity(210) + ->pricePointId( + 'String3' + ) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/renewal-preview-response.md b/doc/models/renewal-preview-response.md index ecc79ef0..dbf795a2 100644 --- a/doc/models/renewal-preview-response.md +++ b/doc/models/renewal-preview-response.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `renewalPreview` | [`RenewalPreview`](../../doc/models/renewal-preview.md) | Required | - | getRenewalPreview(): RenewalPreview | setRenewalPreview(RenewalPreview renewalPreview): void | -## Example (as JSON) - -```json -{ - "renewal_preview": { - "next_assessment_at": "2016-03-13T12:52:32.123Z", - "subtotal_in_cents": 132, - "total_tax_in_cents": 0, - "total_discount_in_cents": 250, - "total_in_cents": 20 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RenewalPreviewResponseBuilder; +use AdvancedBillingLib\Models\Builders\RenewalPreviewBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$renewalPreviewResponse = RenewalPreviewResponseBuilder::init( + RenewalPreviewBuilder::init() + ->nextAssessmentAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->subtotalInCents(132) + ->totalTaxInCents(0) + ->totalDiscountInCents(250) + ->totalInCents(20) + ->build() +)->build(); ``` diff --git a/doc/models/renewal-preview.md b/doc/models/renewal-preview.md index ac382663..6fe2afd5 100644 --- a/doc/models/renewal-preview.md +++ b/doc/models/renewal-preview.md @@ -19,15 +19,18 @@ | `uncalculatedTaxes` | `?bool` | Optional | A boolean indicating whether or not additional taxes will be calculated at the time of renewal. This will be true if you are using Avalara and the address of the subscription is in one of your defined taxable regions. | getUncalculatedTaxes(): ?bool | setUncalculatedTaxes(?bool uncalculatedTaxes): void | | `lineItems` | [`?(RenewalPreviewLineItem[])`](../../doc/models/renewal-preview-line-item.md) | Optional | An array of objects representing the individual transactions that will be created at the next renewal | getLineItems(): ?array | setLineItems(?array lineItems): void | -## Example (as JSON) - -```json -{ - "next_assessment_at": "2016-03-13T12:52:32.123Z", - "subtotal_in_cents": 160, - "total_tax_in_cents": 28, - "total_discount_in_cents": 34, - "total_in_cents": 48 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RenewalPreviewBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$renewalPreview = RenewalPreviewBuilder::init() + ->nextAssessmentAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->subtotalInCents(102) + ->totalTaxInCents(226) + ->totalDiscountInCents(232) + ->totalInCents(246) + ->build(); ``` diff --git a/doc/models/replay-webhooks-request.md b/doc/models/replay-webhooks-request.md index e2e67572..32949c4d 100644 --- a/doc/models/replay-webhooks-request.md +++ b/doc/models/replay-webhooks-request.md @@ -11,13 +11,17 @@ | --- | --- | --- | --- | --- | --- | | `ids` | `int[]` | Required | - | getIds(): array | setIds(array ids): void | -## Example (as JSON) - -```json -{ - "ids": [ - 15 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ReplayWebhooksRequestBuilder; + +$replayWebhooksRequest = ReplayWebhooksRequestBuilder::init( + [ + 209, + 210, + 211 + ] +)->build(); ``` diff --git a/doc/models/replay-webhooks-response.md b/doc/models/replay-webhooks-response.md index a85c59fe..de8c080f 100644 --- a/doc/models/replay-webhooks-response.md +++ b/doc/models/replay-webhooks-response.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `status` | `?string` | Optional | - | getStatus(): ?string | setStatus(?string status): void | -## Example (as JSON) +## Example -```json -{ - "status": "status4" -} +```php +use AdvancedBillingLib\Models\Builders\ReplayWebhooksResponseBuilder; + +$replayWebhooksResponse = ReplayWebhooksResponseBuilder::init() + ->status('status6') + ->build(); ``` diff --git a/doc/models/resent-invitation.md b/doc/models/resent-invitation.md index 32e00952..c658b32d 100644 --- a/doc/models/resent-invitation.md +++ b/doc/models/resent-invitation.md @@ -16,16 +16,19 @@ | `lastInviteSentAt` | `?DateTime` | Optional | - | getLastInviteSentAt(): ?\DateTime | setLastInviteSentAt(?\DateTime lastInviteSentAt): void | | `lastInviteAcceptedAt` | `?DateTime` | Optional | - | getLastInviteAcceptedAt(): ?\DateTime | setLastInviteAcceptedAt(?\DateTime lastInviteAcceptedAt): void | -## Example (as JSON) - -```json -{ - "last_invite_sent_at": "01/01/2024 04:30:00", - "last_invite_accepted_at": "01/01/2024 04:35:00", - "last_sent_at": "last_sent_at8", - "last_accepted_at": "last_accepted_at8", - "send_invite_link_text": "send_invite_link_text6", - "uninvited_count": 6 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ResentInvitationBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$resentInvitation = ResentInvitationBuilder::init() + ->lastSentAt('last_sent_at0') + ->lastAcceptedAt('last_accepted_at0') + ->sendInviteLinkText('send_invite_link_text8') + ->uninvitedCount(178) + ->lastInviteSentAt(DateTimeHelper::fromRfc3339DateTime('2024-01-01T04:30:00+00:00')) + ->lastInviteAcceptedAt(DateTimeHelper::fromRfc3339DateTime('2024-01-01T04:35:00+00:00')) + ->build(); ``` diff --git a/doc/models/resource-type.md b/doc/models/resource-type.md index 1490b923..07a5783c 100644 --- a/doc/models/resource-type.md +++ b/doc/models/resource-type.md @@ -12,3 +12,11 @@ | `SUBSCRIPTIONS` | | `CUSTOMERS` | +## Example + +```php +use AdvancedBillingLib\Models\ResourceType; + +$resourceType = ResourceType::SUBSCRIPTIONS; +``` + diff --git a/doc/models/restriction-type.md b/doc/models/restriction-type.md index 816172f6..eb0a04f7 100644 --- a/doc/models/restriction-type.md +++ b/doc/models/restriction-type.md @@ -12,3 +12,11 @@ | `COMPONENT` | | `PRODUCT` | +## Example + +```php +use AdvancedBillingLib\Models\RestrictionType; + +$restrictionType = RestrictionType::COMPONENT; +``` + diff --git a/doc/models/resume-options.md b/doc/models/resume-options.md index 5b28fa2c..6eee17c5 100644 --- a/doc/models/resume-options.md +++ b/doc/models/resume-options.md @@ -12,12 +12,14 @@ | `requireResume` | `?bool` | Optional | Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in its current state. | getRequireResume(): ?bool | setRequireResume(?bool requireResume): void | | `forgiveBalance` | `?bool` | Optional | Indicates whether or not Chargify should clear the subscription's existing balance before attempting to resume the subscription. If subscription cannot be resumed, the balance will remain as it was before the attempt to resume was made. | getForgiveBalance(): ?bool | setForgiveBalance(?bool forgiveBalance): void | -## Example (as JSON) +## Example -```json -{ - "require_resume": false, - "forgive_balance": false -} +```php +use AdvancedBillingLib\Models\Builders\ResumeOptionsBuilder; + +$resumeOptions = ResumeOptionsBuilder::init() + ->requireResume(false) + ->forgiveBalance(false) + ->build(); ``` diff --git a/doc/models/resumption-charge.md b/doc/models/resumption-charge.md index 799f3d35..4ebcbfcf 100644 --- a/doc/models/resumption-charge.md +++ b/doc/models/resumption-charge.md @@ -15,3 +15,11 @@ | `IMMEDIATE` | | `DELAYED` | +## Example + +```php +use AdvancedBillingLib\Models\ResumptionCharge; + +$resumptionCharge = ResumptionCharge::IMMEDIATE; +``` + diff --git a/doc/models/revoked-invitation.md b/doc/models/revoked-invitation.md index 2460bd4e..2b53b45e 100644 --- a/doc/models/revoked-invitation.md +++ b/doc/models/revoked-invitation.md @@ -13,13 +13,15 @@ | `lastAcceptedAt` | `?string` | Optional | - | getLastAcceptedAt(): ?string | setLastAcceptedAt(?string lastAcceptedAt): void | | `uninvitedCount` | `?int` | Optional | - | getUninvitedCount(): ?int | setUninvitedCount(?int uninvitedCount): void | -## Example (as JSON) - -```json -{ - "last_sent_at": "last_sent_at2", - "last_accepted_at": "last_accepted_at2", - "uninvited_count": 226 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\RevokedInvitationBuilder; + +$revokedInvitation = RevokedInvitationBuilder::init() + ->lastSentAt('last_sent_at8') + ->lastAcceptedAt('last_accepted_at8') + ->uninvitedCount(130) + ->build(); ``` diff --git a/doc/models/sale-rep-item-mrr.md b/doc/models/sale-rep-item-mrr.md index 54906b02..67f47f04 100644 --- a/doc/models/sale-rep-item-mrr.md +++ b/doc/models/sale-rep-item-mrr.md @@ -13,13 +13,15 @@ | `usage` | `?string` | Optional | - | getUsage(): ?string | setUsage(?string usage): void | | `recurring` | `?string` | Optional | - | getRecurring(): ?string | setRecurring(?string recurring): void | -## Example (as JSON) - -```json -{ - "mrr": "mrr2", - "usage": "usage0", - "recurring": "recurring4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SaleRepItemMrrBuilder; + +$saleRepItemMrr = SaleRepItemMrrBuilder::init() + ->mrr('mrr8') + ->usage('usage0') + ->recurring('recurring6') + ->build(); ``` diff --git a/doc/models/sale-rep-settings.md b/doc/models/sale-rep-settings.md index 98fa6c24..e6666017 100644 --- a/doc/models/sale-rep-settings.md +++ b/doc/models/sale-rep-settings.md @@ -17,15 +17,17 @@ | `salesRepId` | `?int` | Optional | - | getSalesRepId(): ?int | setSalesRepId(?int salesRepId): void | | `salesRepName` | `?string` | Optional | - | getSalesRepName(): ?string | setSalesRepName(?string salesRepName): void | -## Example (as JSON) - -```json -{ - "customer_name": "customer_name8", - "subscription_id": 200, - "site_link": "site_link4", - "site_name": "site_name8", - "subscription_mrr": "subscription_mrr6" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SaleRepSettingsBuilder; + +$saleRepSettings = SaleRepSettingsBuilder::init() + ->customerName('customer_name6') + ->subscriptionId(202) + ->siteLink('site_link2') + ->siteName('site_name6') + ->subscriptionMrr('subscription_mrr4') + ->build(); ``` diff --git a/doc/models/sale-rep-subscription.md b/doc/models/sale-rep-subscription.md index 6f091c43..e55e7a71 100644 --- a/doc/models/sale-rep-subscription.md +++ b/doc/models/sale-rep-subscription.md @@ -20,15 +20,17 @@ | `lastPayment` | `?string` | Optional | - | getLastPayment(): ?string | setLastPayment(?string lastPayment): void | | `churnDate` | `?string` | Optional | - | getChurnDate(): ?string | setChurnDate(?string churnDate): void | -## Example (as JSON) - -```json -{ - "id": 18, - "site_name": "site_name2", - "subscription_url": "subscription_url6", - "customer_name": "customer_name2", - "created_at": "created_at8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SaleRepSubscriptionBuilder; + +$saleRepSubscription = SaleRepSubscriptionBuilder::init() + ->id(68) + ->siteName('site_name8') + ->subscriptionUrl('subscription_url2') + ->customerName('customer_name8') + ->createdAt('created_at4') + ->build(); ``` diff --git a/doc/models/sale-rep.md b/doc/models/sale-rep.md index 36a10016..81091d7d 100644 --- a/doc/models/sale-rep.md +++ b/doc/models/sale-rep.md @@ -15,30 +15,42 @@ | `testMode` | `?bool` | Optional | - | getTestMode(): ?bool | setTestMode(?bool testMode): void | | `subscriptions` | [`?(SaleRepSubscription[])`](../../doc/models/sale-rep-subscription.md) | Optional | - | getSubscriptions(): ?array | setSubscriptions(?array subscriptions): void | -## Example (as JSON) - -```json -{ - "id": 18, - "full_name": "full_name0", - "subscriptions_count": 162, - "test_mode": false, - "subscriptions": [ - { - "id": 202, - "site_name": "site_name8", - "subscription_url": "subscription_url2", - "customer_name": "customer_name8", - "created_at": "created_at4" - }, - { - "id": 202, - "site_name": "site_name8", - "subscription_url": "subscription_url2", - "customer_name": "customer_name8", - "created_at": "created_at4" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SaleRepBuilder; +use AdvancedBillingLib\Models\Builders\SaleRepSubscriptionBuilder; + +$saleRep = SaleRepBuilder::init() + ->id(78) + ->fullName('full_name0') + ->subscriptionsCount(102) + ->testMode(false) + ->subscriptions( + [ + SaleRepSubscriptionBuilder::init() + ->id(202) + ->siteName('site_name8') + ->subscriptionUrl('subscription_url2') + ->customerName('customer_name8') + ->createdAt('created_at4') + ->build(), + SaleRepSubscriptionBuilder::init() + ->id(202) + ->siteName('site_name8') + ->subscriptionUrl('subscription_url2') + ->customerName('customer_name8') + ->createdAt('created_at4') + ->build(), + SaleRepSubscriptionBuilder::init() + ->id(202) + ->siteName('site_name8') + ->subscriptionUrl('subscription_url2') + ->customerName('customer_name8') + ->createdAt('created_at4') + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-component-custom-price.md b/doc/models/scheduled-renewal-component-custom-price.md index f5b8e1cc..e1fc479e 100644 --- a/doc/models/scheduled-renewal-component-custom-price.md +++ b/doc/models/scheduled-renewal-component-custom-price.md @@ -12,22 +12,30 @@ Custom pricing for a component within a scheduled renewal. | 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 | +| `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 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; + +$scheduledRenewalComponentCustomPrice = ScheduledRenewalComponentCustomPriceBuilder::init( + PricingScheme::PER_UNIT, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] +) + ->taxIncluded(false) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration-item-request.md b/doc/models/scheduled-renewal-configuration-item-request.md index 8f25d916..f5df26a6 100644 --- a/doc/models/scheduled-renewal-configuration-item-request.md +++ b/doc/models/scheduled-renewal-configuration-item-request.md @@ -11,32 +11,47 @@ | --- | --- | --- | --- | --- | --- | | `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 - } - ] - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationItemRequestBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalItemRequestBodyComponentBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; + +$scheduledRenewalConfigurationItemRequest = ScheduledRenewalConfigurationItemRequestBuilder::init( + ScheduledRenewalItemRequestBodyComponentBuilder::init( + 108 + ) + ->pricePointId(122) + ->quantity(212) + ->customPrice( + ScheduledRenewalComponentCustomPriceBuilder::init( + PricingScheme::STAIRSTEP, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration-item-response.md b/doc/models/scheduled-renewal-configuration-item-response.md index cd8afba8..3226561e 100644 --- a/doc/models/scheduled-renewal-configuration-item-response.md +++ b/doc/models/scheduled-renewal-configuration-item-response.md @@ -11,17 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `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" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationItemResponseBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationItemBuilder; + +$scheduledRenewalConfigurationItemResponse = ScheduledRenewalConfigurationItemResponseBuilder::init() + ->scheduledRenewalConfigurationItem( + ScheduledRenewalConfigurationItemBuilder::init() + ->id(98) + ->subscriptionId(208) + ->subscriptionRenewalConfigurationId(108) + ->itemId(246) + ->itemType('item_type2') + ->build() + ) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration-item.md b/doc/models/scheduled-renewal-configuration-item.md index 70e7b4d5..2694acbf 100644 --- a/doc/models/scheduled-renewal-configuration-item.md +++ b/doc/models/scheduled-renewal-configuration-item.md @@ -21,15 +21,17 @@ | `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" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationItemBuilder; + +$scheduledRenewalConfigurationItem = ScheduledRenewalConfigurationItemBuilder::init() + ->id(54) + ->subscriptionId(164) + ->subscriptionRenewalConfigurationId(64) + ->itemId(202) + ->itemType('item_type0') + ->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration-request-body.md b/doc/models/scheduled-renewal-configuration-request-body.md index cb5f71a5..4b264e0e 100644 --- a/doc/models/scheduled-renewal-configuration-request-body.md +++ b/doc/models/scheduled-renewal-configuration-request-body.md @@ -15,15 +15,18 @@ | `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 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationRequestBodyBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$scheduledRenewalConfigurationRequestBody = ScheduledRenewalConfigurationRequestBodyBuilder::init() + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->lockInAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->contractId(162) + ->createNewContract(false) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration-request.md b/doc/models/scheduled-renewal-configuration-request.md index d83af8c0..76a8f379 100644 --- a/doc/models/scheduled-renewal-configuration-request.md +++ b/doc/models/scheduled-renewal-configuration-request.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `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 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationRequestBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationRequestBodyBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$scheduledRenewalConfigurationRequest = ScheduledRenewalConfigurationRequestBuilder::init( + ScheduledRenewalConfigurationRequestBodyBuilder::init() + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->lockInAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->contractId(244) + ->createNewContract(false) + ->build() +)->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration-response.md b/doc/models/scheduled-renewal-configuration-response.md index dbf03553..fd8e141e 100644 --- a/doc/models/scheduled-renewal-configuration-response.md +++ b/doc/models/scheduled-renewal-configuration-response.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `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" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationResponseBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$scheduledRenewalConfigurationResponse = ScheduledRenewalConfigurationResponseBuilder::init() + ->scheduledRenewalConfiguration( + ScheduledRenewalConfigurationBuilder::init() + ->id(134) + ->siteId(60) + ->subscriptionId(244) + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-configuration.md b/doc/models/scheduled-renewal-configuration.md index 5304b2d6..6bc4580d 100644 --- a/doc/models/scheduled-renewal-configuration.md +++ b/doc/models/scheduled-renewal-configuration.md @@ -20,15 +20,18 @@ | `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" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$scheduledRenewalConfiguration = ScheduledRenewalConfigurationBuilder::init() + ->id(8) + ->siteId(190) + ->subscriptionId(118) + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-configurations-response.md b/doc/models/scheduled-renewal-configurations-response.md index b3586336..2e3f8015 100644 --- a/doc/models/scheduled-renewal-configurations-response.md +++ b/doc/models/scheduled-renewal-configurations-response.md @@ -11,33 +11,25 @@ | --- | --- | --- | --- | --- | --- | | `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" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationsResponseBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalConfigurationBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$scheduledRenewalConfigurationsResponse = ScheduledRenewalConfigurationsResponseBuilder::init() + ->scheduledRenewalConfigurations( + [ + ScheduledRenewalConfigurationBuilder::init() + ->id(122) + ->siteId(48) + ->subscriptionId(232) + ->startsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->endsAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-item-request-body-component.md b/doc/models/scheduled-renewal-item-request-body-component.md index d4252b71..10fe8807 100644 --- a/doc/models/scheduled-renewal-item-request-body-component.md +++ b/doc/models/scheduled-renewal-item-request-body-component.md @@ -12,33 +12,47 @@ | `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 | +| `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 - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalItemRequestBodyComponentBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; + +$scheduledRenewalItemRequestBodyComponent = ScheduledRenewalItemRequestBodyComponentBuilder::init( + 20 +) + ->pricePointId(6) + ->quantity(84) + ->customPrice( + ScheduledRenewalComponentCustomPriceBuilder::init( + PricingScheme::STAIRSTEP, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->build() + ) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-item-request-body-product.md b/doc/models/scheduled-renewal-item-request-body-product.md index e265e9b0..a6ea263c 100644 --- a/doc/models/scheduled-renewal-item-request-body-product.md +++ b/doc/models/scheduled-renewal-item-request-body-product.md @@ -12,27 +12,34 @@ | `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 | +| `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 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalItemRequestBodyProductBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalProductPricePointBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$scheduledRenewalItemRequestBodyProduct = ScheduledRenewalItemRequestBodyProductBuilder::init( + 154 +) + ->pricePointId(168) + ->quantity(166) + ->customPrice( + ScheduledRenewalProductPricePointBuilder::init( + 'String3', + 'String3' + ) + ->name('name4') + ->handle('handle0') + ->intervalUnit(IntervalUnit::DAY) + ->taxIncluded(false) + ->initialChargeInCents(30) + ->expirationInterval(52) + ->build() + ) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-lock-in-request.md b/doc/models/scheduled-renewal-lock-in-request.md index d36c1cb3..91f17b51 100644 --- a/doc/models/scheduled-renewal-lock-in-request.md +++ b/doc/models/scheduled-renewal-lock-in-request.md @@ -11,11 +11,14 @@ | --- | --- | --- | --- | --- | --- | | `lockInAt` | `DateTime` | Required | Date to lock in the renewal. | getLockInAt(): \DateTime | setLockInAt(\DateTime lockInAt): void | -## Example (as JSON) +## Example -```json -{ - "lock_in_at": "2016-03-13" -} +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalLockInRequestBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$scheduledRenewalLockInRequest = ScheduledRenewalLockInRequestBuilder::init( + DateTimeHelper::fromSimpleDateRequired('2016-03-13') +)->build(); ``` diff --git a/doc/models/scheduled-renewal-product-price-point.md b/doc/models/scheduled-renewal-product-price-point.md index 9d1e07a2..ffd25f29 100644 --- a/doc/models/scheduled-renewal-product-price-point.md +++ b/doc/models/scheduled-renewal-product-price-point.md @@ -18,21 +18,25 @@ Custom pricing for a product within a scheduled renewal. | `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 | +| `expirationInterval` | `?int` | Optional | The numerical expiration interval. e.g., 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 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalProductPricePointBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$scheduledRenewalProductPricePoint = ScheduledRenewalProductPricePointBuilder::init( + 'String1', + 'String7' +) + ->name('name6') + ->handle('handle2') + ->intervalUnit(IntervalUnit::DAY) + ->taxIncluded(false) + ->initialChargeInCents(218) + ->expirationInterval(240) + ->build(); ``` diff --git a/doc/models/scheduled-renewal-update-request.md b/doc/models/scheduled-renewal-update-request.md index 9283d733..37e47d4a 100644 --- a/doc/models/scheduled-renewal-update-request.md +++ b/doc/models/scheduled-renewal-update-request.md @@ -11,32 +11,47 @@ | --- | --- | --- | --- | --- | --- | | `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 - } - ] - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ScheduledRenewalUpdateRequestBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalItemRequestBodyComponentBuilder; +use AdvancedBillingLib\Models\Builders\ScheduledRenewalComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; + +$scheduledRenewalUpdateRequest = ScheduledRenewalUpdateRequestBuilder::init( + ScheduledRenewalItemRequestBodyComponentBuilder::init( + 108 + ) + ->pricePointId(122) + ->quantity(212) + ->customPrice( + ScheduledRenewalComponentCustomPriceBuilder::init( + PricingScheme::STAIRSTEP, + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/segment-price.md b/doc/models/segment-price.md index 8e89ae43..976ff0b9 100644 --- a/doc/models/segment-price.md +++ b/doc/models/segment-price.md @@ -18,15 +18,17 @@ | `formattedUnitPrice` | `?string` | Optional | - | getFormattedUnitPrice(): ?string | setFormattedUnitPrice(?string formattedUnitPrice): void | | `segmentId` | `?int` | Optional | - | getSegmentId(): ?int | setSegmentId(?int segmentId): void | -## Example (as JSON) - -```json -{ - "id": 220, - "component_id": 74, - "starting_quantity": 118, - "ending_quantity": 92, - "unit_price": "unit_price0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SegmentPriceBuilder; + +$segmentPrice = SegmentPriceBuilder::init() + ->id(194) + ->componentId(48) + ->startingQuantity(144) + ->endingQuantity(118) + ->unitPrice('unit_price0') + ->build(); ``` diff --git a/doc/models/segment-response.md b/doc/models/segment-response.md index b4191713..4a52c0ef 100644 --- a/doc/models/segment-response.md +++ b/doc/models/segment-response.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `segment` | [`?Segment`](../../doc/models/segment.md) | Optional | - | getSegment(): ?Segment | setSegment(?Segment segment): void | -## Example (as JSON) - -```json -{ - "segment": { - "id": 118, - "component_id": 228, - "price_point_id": 4, - "event_based_billing_metric_id": 56, - "pricing_scheme": "stairstep" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SegmentResponseBuilder; +use AdvancedBillingLib\Models\Builders\SegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; + +$segmentResponse = SegmentResponseBuilder::init() + ->segment( + SegmentBuilder::init() + ->id(118) + ->componentId(228) + ->pricePointId(4) + ->eventBasedBillingMetricId(56) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->build() + ) + ->build(); ``` diff --git a/doc/models/segment.md b/doc/models/segment.md index aff5c7f7..10fefa09 100644 --- a/doc/models/segment.md +++ b/doc/models/segment.md @@ -22,15 +22,18 @@ | `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | | `prices` | [`?(SegmentPrice[])`](../../doc/models/segment-price.md) | Optional | **Constraints**: *Minimum Items*: `1` | getPrices(): ?array | setPrices(?array prices): void | -## Example (as JSON) - -```json -{ - "id": 6, - "component_id": 116, - "price_point_id": 140, - "event_based_billing_metric_id": 200, - "pricing_scheme": "stairstep" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; + +$segment = SegmentBuilder::init() + ->id(118) + ->componentId(228) + ->pricePointId(4) + ->eventBasedBillingMetricId(56) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->build(); ``` diff --git a/doc/models/send-email.md b/doc/models/send-email.md index c6e7e827..241a159b 100644 --- a/doc/models/send-email.md +++ b/doc/models/send-email.md @@ -12,12 +12,14 @@ | `canExecute` | `bool` | Required | - | getCanExecute(): bool | setCanExecute(bool canExecute): void | | `url` | `string` | Required | - | getUrl(): string | setUrl(string url): void | -## Example (as JSON) +## Example -```json -{ - "can_execute": false, - "url": "url2" -} +```php +use AdvancedBillingLib\Models\Builders\SendEmailBuilder; + +$sendEmail = SendEmailBuilder::init( + false, + 'url2' +)->build(); ``` diff --git a/doc/models/send-invoice-request.md b/doc/models/send-invoice-request.md index c9d23c35..4e1cccb3 100644 --- a/doc/models/send-invoice-request.md +++ b/doc/models/send-invoice-request.md @@ -14,25 +14,34 @@ | `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) - -```json -{ - "recipient_emails": [ - "recipient_emails3", - "recipient_emails4" - ], - "cc_recipient_emails": [ - "cc_recipient_emails6", - "cc_recipient_emails5" - ], - "bcc_recipient_emails": [ - "bcc_recipient_emails6" - ], - "attachment_urls": [ - "attachment_urls0", - "attachment_urls1" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SendInvoiceRequestBuilder; + +$sendInvoiceRequest = SendInvoiceRequestBuilder::init() + ->recipientEmails( + [ + 'recipient_emails7' + ] + ) + ->ccRecipientEmails( + [ + 'cc_recipient_emails2' + ] + ) + ->bccRecipientEmails( + [ + 'bcc_recipient_emails0', + 'bcc_recipient_emails1', + 'bcc_recipient_emails2' + ] + ) + ->attachmentUrls( + [ + 'attachment_urls4' + ] + ) + ->build(); ``` diff --git a/doc/models/service-credit-1.md b/doc/models/service-credit-1.md index d63e9348..e73508d9 100644 --- a/doc/models/service-credit-1.md +++ b/doc/models/service-credit-1.md @@ -14,19 +14,22 @@ | `endingBalanceInCents` | `?int` | Optional | The new balance for the credit account | getEndingBalanceInCents(): ?int | setEndingBalanceInCents(?int endingBalanceInCents): void | | `entryType` | [`?string(ServiceCreditType)`](../../doc/models/service-credit-type.md) | Optional | The type of entry | getEntryType(): ?string | setEntryType(?string entryType): void | | `memo` | `?string` | Optional | The memo attached to the entry | getMemo(): ?string | setMemo(?string memo): void | -| `invoiceUid` | `?string` | Optional | The invoice uid associated with the entry. Only present for debit entries | getInvoiceUid(): ?string | setInvoiceUid(?string invoiceUid): void | +| `invoiceUid` | `?string` | Optional | The invoice uid associated with the entry. Only present for debit entries. | getInvoiceUid(): ?string | setInvoiceUid(?string invoiceUid): void | | `remainingBalanceInCents` | `?int` | Optional | The remaining balance for the entry | getRemainingBalanceInCents(): ?int | setRemainingBalanceInCents(?int remainingBalanceInCents): void | | `createdAt` | `?DateTime` | Optional | The date and time the entry was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | -## Example (as JSON) +## Example -```json -{ - "id": 174, - "amount_in_cents": 4, - "ending_balance_in_cents": 44, - "entry_type": "Credit", - "memo": "memo8" -} +```php +use AdvancedBillingLib\Models\Builders\ServiceCredit1Builder; +use AdvancedBillingLib\Models\ServiceCreditType; + +$serviceCredit1 = ServiceCredit1Builder::init() + ->id(12) + ->amountInCents(158) + ->endingBalanceInCents(138) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo4') + ->build(); ``` diff --git a/doc/models/service-credit-response.md b/doc/models/service-credit-response.md index 5e616ea3..96666921 100644 --- a/doc/models/service-credit-response.md +++ b/doc/models/service-credit-response.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `serviceCredit` | [`ServiceCredit`](../../doc/models/service-credit.md) | Required | - | getServiceCredit(): ServiceCredit | setServiceCredit(ServiceCredit serviceCredit): void | -## Example (as JSON) - -```json -{ - "service_credit": { - "id": 38, - "amount_in_cents": 124, - "ending_balance_in_cents": 164, - "entry_type": "Credit", - "memo": "memo0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ServiceCreditResponseBuilder; +use AdvancedBillingLib\Models\Builders\ServiceCreditBuilder; +use AdvancedBillingLib\Models\ServiceCreditType; + +$serviceCreditResponse = ServiceCreditResponseBuilder::init( + ServiceCreditBuilder::init() + ->id(38) + ->amountInCents(124) + ->endingBalanceInCents(164) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo0') + ->build() +)->build(); ``` diff --git a/doc/models/service-credit-type.md b/doc/models/service-credit-type.md index e4763845..1cb43347 100644 --- a/doc/models/service-credit-type.md +++ b/doc/models/service-credit-type.md @@ -14,3 +14,11 @@ The type of entry | `CREDIT` | | `DEBIT` | +## Example + +```php +use AdvancedBillingLib\Models\ServiceCreditType; + +$serviceCreditType = ServiceCreditType::CREDIT; +``` + diff --git a/doc/models/service-credit.md b/doc/models/service-credit.md index 556087d5..07bf14f2 100644 --- a/doc/models/service-credit.md +++ b/doc/models/service-credit.md @@ -15,15 +15,18 @@ | `entryType` | [`?string(ServiceCreditType)`](../../doc/models/service-credit-type.md) | Optional | The type of entry | getEntryType(): ?string | setEntryType(?string entryType): void | | `memo` | `?string` | Optional | The memo attached to the entry | getMemo(): ?string | setMemo(?string memo): void | -## Example (as JSON) - -```json -{ - "id": 216, - "amount_in_cents": 210, - "ending_balance_in_cents": 86, - "entry_type": "Credit", - "memo": "memo2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\ServiceCreditBuilder; +use AdvancedBillingLib\Models\ServiceCreditType; + +$serviceCredit = ServiceCreditBuilder::init() + ->id(132) + ->amountInCents(218) + ->endingBalanceInCents(2) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo8') + ->build(); ``` diff --git a/doc/models/signup-proforma-preview-response.md b/doc/models/signup-proforma-preview-response.md index 5ee46c6f..fa706f73 100644 --- a/doc/models/signup-proforma-preview-response.md +++ b/doc/models/signup-proforma-preview-response.md @@ -11,26 +11,34 @@ | --- | --- | --- | --- | --- | --- | | `proformaInvoicePreview` | [`SignupProformaPreview`](../../doc/models/signup-proforma-preview.md) | Required | - | getProformaInvoicePreview(): SignupProformaPreview | setProformaInvoicePreview(SignupProformaPreview proformaInvoicePreview): void | -## Example (as JSON) - -```json -{ - "proforma_invoice_preview": { - "current_proforma_invoice": { - "uid": "uid6", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": 132 - }, - "next_proforma_invoice": { - "uid": "uid8", - "site_id": 212, - "customer_id": 68, - "subscription_id": 140, - "number": 16 - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SignupProformaPreviewResponseBuilder; +use AdvancedBillingLib\Models\Builders\SignupProformaPreviewBuilder; +use AdvancedBillingLib\Models\Builders\ProformaInvoiceBuilder; + +$signupProformaPreviewResponse = SignupProformaPreviewResponseBuilder::init( + SignupProformaPreviewBuilder::init() + ->currentProformaInvoice( + ProformaInvoiceBuilder::init() + ->uid('uid6') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number(132) + ->build() + ) + ->nextProformaInvoice( + ProformaInvoiceBuilder::init() + ->uid('uid8') + ->siteId(212) + ->customerId(68) + ->subscriptionId(140) + ->number(16) + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/signup-proforma-preview.md b/doc/models/signup-proforma-preview.md index 6f9c1554..05589d37 100644 --- a/doc/models/signup-proforma-preview.md +++ b/doc/models/signup-proforma-preview.md @@ -12,24 +12,31 @@ | `currentProformaInvoice` | [`?ProformaInvoice`](../../doc/models/proforma-invoice.md) | Optional | - | getCurrentProformaInvoice(): ?ProformaInvoice | setCurrentProformaInvoice(?ProformaInvoice currentProformaInvoice): void | | `nextProformaInvoice` | [`?ProformaInvoice`](../../doc/models/proforma-invoice.md) | Optional | - | getNextProformaInvoice(): ?ProformaInvoice | setNextProformaInvoice(?ProformaInvoice nextProformaInvoice): void | -## Example (as JSON) - -```json -{ - "current_proforma_invoice": { - "uid": "uid6", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": 132 - }, - "next_proforma_invoice": { - "uid": "uid8", - "site_id": 212, - "customer_id": 68, - "subscription_id": 140, - "number": 16 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SignupProformaPreviewBuilder; +use AdvancedBillingLib\Models\Builders\ProformaInvoiceBuilder; + +$signupProformaPreview = SignupProformaPreviewBuilder::init() + ->currentProformaInvoice( + ProformaInvoiceBuilder::init() + ->uid('uid6') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number(132) + ->build() + ) + ->nextProformaInvoice( + ProformaInvoiceBuilder::init() + ->uid('uid8') + ->siteId(212) + ->customerId(68) + ->subscriptionId(140) + ->number(16) + ->build() + ) + ->build(); ``` diff --git a/doc/models/single-error-response-exception.md b/doc/models/single-error-response-exception.md index 33047588..a229cbef 100644 --- a/doc/models/single-error-response-exception.md +++ b/doc/models/single-error-response-exception.md @@ -11,11 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `error` | `string` | Required | - | getError(): string | setError(string error): void | -## Example (as JSON) - -```json -{ - "error": "error2" +## Example + +```php +try { + // make the API call +} catch (SingleErrorResponseException $exp) { + echo 'Caught SingleErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/single-string-error-response-exception.md b/doc/models/single-string-error-response-exception.md index 51c56062..17b269f7 100644 --- a/doc/models/single-string-error-response-exception.md +++ b/doc/models/single-string-error-response-exception.md @@ -11,11 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | `?string` | Optional | - | getErrors(): ?string | setErrors(?string errors): void | -## Example (as JSON) - -```json -{ - "errors": "errors4" +## Example + +```php +try { + // make the API call +} catch (SingleStringErrorResponseException $exp) { + echo 'Caught SingleStringErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/site-response.md b/doc/models/site-response.md index 939d95fc..e5a60abf 100644 --- a/doc/models/site-response.md +++ b/doc/models/site-response.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `site` | [`Site`](../../doc/models/site.md) | Required | - | getSite(): Site | setSite(Site site): void | -## Example (as JSON) - -```json -{ - "site": { - "id": 64, - "name": "name4", - "subdomain": "subdomain0", - "currency": "currency4", - "seller_id": 228 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SiteResponseBuilder; +use AdvancedBillingLib\Models\Builders\SiteBuilder; + +$siteResponse = SiteResponseBuilder::init( + SiteBuilder::init() + ->id(64) + ->name('name4') + ->subdomain('subdomain0') + ->currency('currency4') + ->sellerId(228) + ->build() +)->build(); ``` diff --git a/doc/models/site-statistics.md b/doc/models/site-statistics.md index d6db062a..2bc640f7 100644 --- a/doc/models/site-statistics.md +++ b/doc/models/site-statistics.md @@ -21,15 +21,17 @@ | `totalUnpaidSubscriptions` | `?int` | Optional | - | getTotalUnpaidSubscriptions(): ?int | setTotalUnpaidSubscriptions(?int totalUnpaidSubscriptions): void | | `totalDunningSubscriptions` | `?int` | Optional | - | getTotalDunningSubscriptions(): ?int | setTotalDunningSubscriptions(?int totalDunningSubscriptions): void | -## Example (as JSON) - -```json -{ - "total_subscriptions": 204, - "subscriptions_today": 134, - "total_revenue": "total_revenue6", - "revenue_today": "revenue_today4", - "revenue_this_month": "revenue_this_month4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SiteStatisticsBuilder; + +$siteStatistics = SiteStatisticsBuilder::init() + ->totalSubscriptions(168) + ->subscriptionsToday(170) + ->totalRevenue('total_revenue2') + ->revenueToday('revenue_today0') + ->revenueThisMonth('revenue_this_month0') + ->build(); ``` diff --git a/doc/models/site-summary.md b/doc/models/site-summary.md index 95795dd5..fb28b577 100644 --- a/doc/models/site-summary.md +++ b/doc/models/site-summary.md @@ -15,21 +15,26 @@ | `siteCurrency` | `?string` | Optional | - | getSiteCurrency(): ?string | setSiteCurrency(?string siteCurrency): void | | `stats` | [`?SiteStatistics`](../../doc/models/site-statistics.md) | Optional | - | getStats(): ?SiteStatistics | setStats(?SiteStatistics stats): void | -## Example (as JSON) - -```json -{ - "seller_name": "seller_name0", - "site_name": "site_name4", - "site_id": 218, - "site_currency": "site_currency6", - "stats": { - "total_subscriptions": 110, - "subscriptions_today": 228, - "total_revenue": "total_revenue6", - "revenue_today": "revenue_today4", - "revenue_this_month": "revenue_this_month4" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SiteSummaryBuilder; +use AdvancedBillingLib\Models\Builders\SiteStatisticsBuilder; + +$siteSummary = SiteSummaryBuilder::init() + ->sellerName('seller_name4') + ->siteName('site_name8') + ->siteId(252) + ->siteCurrency('site_currency0') + ->stats( + SiteStatisticsBuilder::init() + ->totalSubscriptions(110) + ->subscriptionsToday(228) + ->totalRevenue('total_revenue6') + ->revenueToday('revenue_today4') + ->revenueThisMonth('revenue_this_month4') + ->build() + ) + ->build(); ``` diff --git a/doc/models/site.md b/doc/models/site.md index 8f3f1c68..f82137cc 100644 --- a/doc/models/site.md +++ b/doc/models/site.md @@ -30,15 +30,17 @@ | `portalEnabled` | `?bool` | Optional | Whether the Billing Portal is enabled for this site. | getPortalEnabled(): ?bool | setPortalEnabled(?bool portalEnabled): void | | `test` | `?bool` | Optional | - | getTest(): ?bool | setTest(?bool test): void | -## Example (as JSON) - -```json -{ - "id": 34, - "name": "name0", - "subdomain": "subdomain4", - "currency": "currency0", - "seller_id": 198 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SiteBuilder; + +$site = SiteBuilder::init() + ->id(64) + ->name('name4') + ->subdomain('subdomain0') + ->currency('currency4') + ->sellerId(228) + ->build(); ``` diff --git a/doc/models/sorting-direction.md b/doc/models/sorting-direction.md index 547aa444..dd489069 100644 --- a/doc/models/sorting-direction.md +++ b/doc/models/sorting-direction.md @@ -14,3 +14,11 @@ Used for sorting results. | `ASC` | | `DESC` | +## Example + +```php +use AdvancedBillingLib\Models\SortingDirection; + +$sortingDirection = SortingDirection::ASC; +``` + diff --git a/doc/models/status.md b/doc/models/status.md index 3531d2ce..1859f6ea 100644 --- a/doc/models/status.md +++ b/doc/models/status.md @@ -16,3 +16,11 @@ | `ACTIVE` | | `FULFILLED` | +## Example + +```php +use AdvancedBillingLib\Models\Status; + +$status = Status::PENDING; +``` + diff --git a/doc/models/subscription-add-coupon-error-exception.md b/doc/models/subscription-add-coupon-error-exception.md index 45837282..d11794c2 100644 --- a/doc/models/subscription-add-coupon-error-exception.md +++ b/doc/models/subscription-add-coupon-error-exception.md @@ -14,25 +14,15 @@ | `couponCodes` | `?(string[])` | Optional | - | getCouponCodes(): ?array | setCouponCodes(?array couponCodes): void | | `subscription` | `?(string[])` | Optional | - | getSubscription(): ?array | setSubscription(?array subscription): void | -## Example (as JSON) - -```json -{ - "codes": [ - "codes6", - "codes7", - "codes8" - ], - "coupon_code": [ - "coupon_code8", - "coupon_code7" - ], - "coupon_codes": [ - "coupon_codes2" - ], - "subscription": [ - "subscription8" - ] +## Example + +```php +try { + // make the API call +} catch (SubscriptionAddCouponErrorException $exp) { + echo 'Caught SubscriptionAddCouponErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-component-allocation-error-exception.md b/doc/models/subscription-component-allocation-error-exception.md index f27115eb..7a3dedda 100644 --- a/doc/models/subscription-component-allocation-error-exception.md +++ b/doc/models/subscription-component-allocation-error-exception.md @@ -11,16 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?(SubscriptionComponentAllocationErrorItem[])`](../../doc/models/subscription-component-allocation-error-item.md) | Optional | - | getErrors(): ?array | setErrors(?array errors): void | -## Example (as JSON) - -```json -{ - "errors": [ - { - "kind": "kind8", - "message": "message0" - } - ] +## Example + +```php +try { + // make the API call +} catch (SubscriptionComponentAllocationErrorException $exp) { + echo 'Caught SubscriptionComponentAllocationErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-component-allocation-error-item.md b/doc/models/subscription-component-allocation-error-item.md index 899e76da..bb6770a7 100644 --- a/doc/models/subscription-component-allocation-error-item.md +++ b/doc/models/subscription-component-allocation-error-item.md @@ -12,12 +12,14 @@ | `kind` | `?string` | Optional | - | getKind(): ?string | setKind(?string kind): void | | `message` | `?string` | Optional | - | getMessage(): ?string | setMessage(?string message): void | -## Example (as JSON) +## Example -```json -{ - "kind": "kind0", - "message": "message8" -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionComponentAllocationErrorItemBuilder; + +$subscriptionComponentAllocationErrorItem = SubscriptionComponentAllocationErrorItemBuilder::init() + ->kind('kind6') + ->message('message8') + ->build(); ``` diff --git a/doc/models/subscription-component-response.md b/doc/models/subscription-component-response.md index 7f4650e0..b9a2f0aa 100644 --- a/doc/models/subscription-component-response.md +++ b/doc/models/subscription-component-response.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `component` | [`?SubscriptionComponent`](../../doc/models/subscription-component.md) | Optional | - | getComponent(): ?SubscriptionComponent | setComponent(?SubscriptionComponent component): void | -## Example (as JSON) - -```json -{ - "component": { - "id": 80, - "name": "name8", - "kind": "quantity_based_component", - "unit_name": "unit_name0", - "enabled": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionComponentResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionComponentBuilder; +use AdvancedBillingLib\Models\ComponentKind; + +$subscriptionComponentResponse = SubscriptionComponentResponseBuilder::init() + ->component( + SubscriptionComponentBuilder::init() + ->id(80) + ->name('name8') + ->kind(ComponentKind::QUANTITY_BASED_COMPONENT) + ->unitName('unit_name0') + ->enabled(false) + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-component-subscription.md b/doc/models/subscription-component-subscription.md index 2c3bb2f2..18463f0a 100644 --- a/doc/models/subscription-component-subscription.md +++ b/doc/models/subscription-component-subscription.md @@ -1,7 +1,7 @@ # Subscription Component Subscription -An optional object, will be returned if provided `include=subscription` query param. +(Optional) Object that will be returned if the `include=subscription` query param is provided. ## Structure @@ -14,12 +14,16 @@ An optional object, will be returned if provided `include=subscription` query pa | `state` | [`?string(SubscriptionState)`](../../doc/models/subscription-state.md) | Optional | The state of a subscription.

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

See [Subscription States](https://maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscription-States) for more info about subscription states and state transitions. | getState(): ?string | setState(?string state): void | | `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | -## Example (as JSON) +## Example -```json -{ - "state": "paused", - "updated_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionComponentSubscriptionBuilder; +use AdvancedBillingLib\Models\SubscriptionState; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$subscriptionComponentSubscription = SubscriptionComponentSubscriptionBuilder::init() + ->state(SubscriptionState::ASSESSING) + ->updatedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/subscription-component.md b/doc/models/subscription-component.md index d3f750ec..823d9fee 100644 --- a/doc/models/subscription-component.md +++ b/doc/models/subscription-component.md @@ -13,8 +13,8 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `kind` | [`?string(ComponentKind)`](../../doc/models/component-kind.md) | Optional | A handle for the component type | getKind(): ?string | setKind(?string kind): void | | `unitName` | `?string` | Optional | - | getUnitName(): ?string | setUnitName(?string unitName): void | -| `enabled` | `?bool` | Optional | (for on/off components) indicates if the component is enabled for the subscription | getEnabled(): ?bool | setEnabled(?bool enabled): void | -| `unitBalance` | `?int` | Optional | - | getUnitBalance(): ?int | setUnitBalance(?int unitBalance): void | +| `enabled` | `?bool` | Optional | (for on/off components) indicates if the component is enabled for the subscription. | getEnabled(): ?bool | setEnabled(?bool enabled): void | +| `unitBalance` | int\|string\|null | Optional | This is a container for one-of cases. | getUnitBalance(): | setUnitBalance( unitBalance): void | | `currency` | `?string` | Optional | - | getCurrency(): ?string | setCurrency(?string currency): void | | `allocatedQuantity` | int\|string\|null | Optional | This is a container for one-of cases. | getAllocatedQuantity(): | setAllocatedQuantity( allocatedQuantity): void | | `pricingScheme` | [`?string(PricingScheme)`](../../doc/models/pricing-scheme.md) | Optional | - | getPricingScheme(): ?string | setPricingScheme(?string pricingScheme): void | @@ -36,21 +36,24 @@ | `useSiteExchangeRate` | `?bool` | Optional | - | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | | `description` | `?string` | Optional | - | getDescription(): ?string | setDescription(?string description): void | | `allowFractionalQuantities` | `?bool` | Optional | - | getAllowFractionalQuantities(): ?bool | setAllowFractionalQuantities(?bool allowFractionalQuantities): void | -| `subscription` | [`?SubscriptionComponentSubscription`](../../doc/models/subscription-component-subscription.md) | Optional | An optional object, will be returned if provided `include=subscription` query param. | getSubscription(): ?SubscriptionComponentSubscription | setSubscription(?SubscriptionComponentSubscription subscription): void | +| `subscription` | [`?SubscriptionComponentSubscription`](../../doc/models/subscription-component-subscription.md) | Optional | (Optional) Object that will be returned if the `include=subscription` query param is provided. | getSubscription(): ?SubscriptionComponentSubscription | setSubscription(?SubscriptionComponentSubscription subscription): void | | `historicUsages` | [`?(HistoricUsage[])`](../../doc/models/historic-usage.md) | Optional | - | getHistoricUsages(): ?array | setHistoricUsages(?array historicUsages): void | | `displayOnHostedPage` | `?bool` | Optional | - | getDisplayOnHostedPage(): ?bool | setDisplayOnHostedPage(?bool displayOnHostedPage): 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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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 | -## Example (as JSON) +## Example -```json -{ - "id": 20, - "name": "name8", - "kind": "quantity_based_component", - "unit_name": "unit_name0", - "enabled": false -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionComponentBuilder; +use AdvancedBillingLib\Models\ComponentKind; + +$subscriptionComponent = SubscriptionComponentBuilder::init() + ->id(254) + ->name('name8') + ->kind(ComponentKind::QUANTITY_BASED_COMPONENT) + ->unitName('unit_name0') + ->enabled(false) + ->build(); ``` diff --git a/doc/models/subscription-custom-price.md b/doc/models/subscription-custom-price.md index 1ee39447..0c49432d 100644 --- a/doc/models/subscription-custom-price.md +++ b/doc/models/subscription-custom-price.md @@ -19,25 +19,33 @@ | `trialPriceInCents` | string\|int\|null | Optional | This is a container for one-of cases. | getTrialPriceInCents(): | setTrialPriceInCents( trialPriceInCents): void | | `trialInterval` | string\|int\|null | Optional | This is a container for one-of cases. | getTrialInterval(): | setTrialInterval( trialInterval): void | | `trialIntervalUnit` | [`?string(IntervalUnit)`](../../doc/models/interval-unit.md) | Optional | (Optional) | getTrialIntervalUnit(): ?string | setTrialIntervalUnit(?string trialIntervalUnit): void | -| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | +| `trialType` | [`?string(TrialType)`](../../doc/models/trial-type.md) | Optional | Indicates how a trial is handled when the trial period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. | getTrialType(): ?string | setTrialType(?string trialType): void | | `initialChargeInCents` | string\|int\|null | Optional | This is a container for one-of cases. | getInitialChargeInCents(): | setInitialChargeInCents( initialChargeInCents): void | | `initialChargeAfterTrial` | `?bool` | Optional | (Optional) | getInitialChargeAfterTrial(): ?bool | setInitialChargeAfterTrial(?bool initialChargeAfterTrial): void | | `expirationInterval` | string\|int\|null | Optional | This is a container for one-of cases. | getExpirationInterval(): | setExpirationInterval( expirationInterval): void | | `expirationIntervalUnit` | [`?string(ExpirationIntervalUnit)`](../../doc/models/expiration-interval-unit.md) | Optional | (Optional) | getExpirationIntervalUnit(): ?string | setExpirationIntervalUnit(?string expirationIntervalUnit): void | | `taxIncluded` | `?bool` | Optional | (Optional) | getTaxIncluded(): ?bool | setTaxIncluded(?bool taxIncluded): void | -## Example (as JSON) - -```json -{ - "name": "name4", - "handle": "handle0", - "price_in_cents": "String3", - "interval": "String3", - "interval_unit": "day", - "trial_price_in_cents": "String3", - "trial_interval": "String5", - "trial_interval_unit": "day" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionCustomPriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$subscriptionCustomPrice = SubscriptionCustomPriceBuilder::init( + 'String5', + 'String1' +) + ->name('name2') + ->handle('handle8') + ->intervalUnit(IntervalUnit::DAY) + ->trialPriceInCents( + 'String5' + ) + ->trialInterval( + 'String9' + ) + ->trialIntervalUnit(IntervalUnit::DAY) + ->build(); ``` diff --git a/doc/models/subscription-date-field.md b/doc/models/subscription-date-field.md index 3de7f3b6..dd39ef5e 100644 --- a/doc/models/subscription-date-field.md +++ b/doc/models/subscription-date-field.md @@ -19,3 +19,11 @@ | `TRIAL_ENDED_AT` | | `UPDATED_AT` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionDateField; + +$subscriptionDateField = SubscriptionDateField::UPDATED_AT; +``` + diff --git a/doc/models/subscription-filter.md b/doc/models/subscription-filter.md index a504bc72..20d968dc 100644 --- a/doc/models/subscription-filter.md +++ b/doc/models/subscription-filter.md @@ -18,19 +18,26 @@ Nested filter used for List Subscription Components For Site Filter | `startDatetime` | `?DateTime` | Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components that belong to the subscription with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of start_date. To use this filter you also have to include the following param in the request `include=subscription`. | getStartDatetime(): ?\DateTime | setStartDatetime(?\DateTime startDatetime): void | | `endDatetime` | `?DateTime` | Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components that belong to the subscription with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of end_date. To use this filter you also have to include the following param in the request `include=subscription`. | getEndDatetime(): ?\DateTime | setEndDatetime(?\DateTime endDatetime): void | -## Example (as JSON) - -```json -{ - "states": [ - "active", - "canceled" - ], - "start_date": "2024-01-17", - "end_date": "2024-01-31", - "start_datetime": "01/17/2024 09:15:30", - "end_datetime": "01/17/2024 17:20:06", - "date_field": "updated_at" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionFilterBuilder; +use AdvancedBillingLib\Models\SubscriptionStateFilter; +use AdvancedBillingLib\Models\SubscriptionListDateField; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$subscriptionFilter = SubscriptionFilterBuilder::init() + ->states( + [ + SubscriptionStateFilter::ACTIVE, + SubscriptionStateFilter::CANCELED + ] + ) + ->dateField(SubscriptionListDateField::UPDATED_AT) + ->startDate(DateTimeHelper::fromSimpleDate('2024-01-17')) + ->endDate(DateTimeHelper::fromSimpleDate('2024-01-31')) + ->startDatetime(DateTimeHelper::fromRfc3339DateTime('2024-01-17T09:15:30+00:00')) + ->endDatetime(DateTimeHelper::fromRfc3339DateTime('2024-01-17T17:20:06Z')) + ->build(); ``` diff --git a/doc/models/subscription-group-balances.md b/doc/models/subscription-group-balances.md index e40efc08..17e6c87d 100644 --- a/doc/models/subscription-group-balances.md +++ b/doc/models/subscription-group-balances.md @@ -14,30 +14,41 @@ | `openInvoices` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | - | getOpenInvoices(): ?AccountBalance | setOpenInvoices(?AccountBalance openInvoices): void | | `pendingDiscounts` | [`?AccountBalance`](../../doc/models/account-balance.md) | Optional | - | getPendingDiscounts(): ?AccountBalance | setPendingDiscounts(?AccountBalance pendingDiscounts): void | -## Example (as JSON) - -```json -{ - "prepayments": { - "balance_in_cents": 192, - "automatic_balance_in_cents": 178, - "remittance_balance_in_cents": 146 - }, - "service_credits": { - "balance_in_cents": 84, - "automatic_balance_in_cents": 70, - "remittance_balance_in_cents": 38 - }, - "open_invoices": { - "balance_in_cents": 40, - "automatic_balance_in_cents": 202, - "remittance_balance_in_cents": 170 - }, - "pending_discounts": { - "balance_in_cents": 88, - "automatic_balance_in_cents": 154, - "remittance_balance_in_cents": 134 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupBalancesBuilder; +use AdvancedBillingLib\Models\Builders\AccountBalanceBuilder; + +$subscriptionGroupBalances = SubscriptionGroupBalancesBuilder::init() + ->prepayments( + AccountBalanceBuilder::init() + ->balanceInCents(192) + ->automaticBalanceInCents(178) + ->remittanceBalanceInCents(146) + ->build() + ) + ->serviceCredits( + AccountBalanceBuilder::init() + ->balanceInCents(84) + ->automaticBalanceInCents(70) + ->remittanceBalanceInCents(38) + ->build() + ) + ->openInvoices( + AccountBalanceBuilder::init() + ->balanceInCents(40) + ->automaticBalanceInCents(202) + ->remittanceBalanceInCents(170) + ->build() + ) + ->pendingDiscounts( + AccountBalanceBuilder::init() + ->balanceInCents(88) + ->automaticBalanceInCents(154) + ->remittanceBalanceInCents(134) + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-group-bank-account.md b/doc/models/subscription-group-bank-account.md index 183d6cf2..fefd0eab 100644 --- a/doc/models/subscription-group-bank-account.md +++ b/doc/models/subscription-group-bank-account.md @@ -11,9 +11,9 @@ | --- | --- | --- | --- | --- | --- | | `bankName` | `?string` | Optional | (Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides | getBankName(): ?string | setBankName(?string bankName): void | | `bankAccountNumber` | `?string` | Optional | (Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number | getBankAccountNumber(): ?string | setBankAccountNumber(?string bankAccountNumber): void | -| `bankRoutingNumber` | `?string` | Optional | (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API | getBankRoutingNumber(): ?string | setBankRoutingNumber(?string bankRoutingNumber): void | -| `bankIban` | `?string` | Optional | (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided | getBankIban(): ?string | setBankIban(?string bankIban): void | -| `bankBranchCode` | `?string` | Optional | (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided | getBankBranchCode(): ?string | setBankBranchCode(?string bankBranchCode): void | +| `bankRoutingNumber` | `?string` | Optional | (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless.) The routing number of the bank. It becomes bank_code while passing via GoCardless API. | getBankRoutingNumber(): ?string | setBankRoutingNumber(?string bankRoutingNumber): void | +| `bankIban` | `?string` | Optional | (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided. | getBankIban(): ?string | setBankIban(?string bankIban): void | +| `bankBranchCode` | `?string` | Optional | (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided. | getBankBranchCode(): ?string | setBankBranchCode(?string bankBranchCode): void | | `bankAccountType` | [`?string(BankAccountType)`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking | getBankAccountType(): ?string | setBankAccountType(?string bankAccountType): void | | `bankAccountHolderType` | [`?string(BankAccountHolderType)`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal | getBankAccountHolderType(): ?string | setBankAccountHolderType(?string bankAccountHolderType): void | | `paymentType` | [`?string(PaymentType)`](../../doc/models/payment-type.md) | Optional | - | getPaymentType(): ?string | setPaymentType(?string paymentType): void | @@ -26,15 +26,17 @@ | `currentVault` | [`?string(BankAccountVault)`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | | `gatewayHandle` | `?string` | Optional | - | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | -## Example (as JSON) +## Example -```json -{ - "bank_name": "bank_name2", - "bank_account_number": "bank_account_number4", - "bank_routing_number": "bank_routing_number8", - "bank_iban": "bank_iban6", - "bank_branch_code": "bank_branch_code6" -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupBankAccountBuilder; + +$subscriptionGroupBankAccount = SubscriptionGroupBankAccountBuilder::init() + ->bankName('bank_name2') + ->bankAccountNumber('bank_account_number4') + ->bankRoutingNumber('bank_routing_number8') + ->bankIban('bank_iban6') + ->bankBranchCode('bank_branch_code6') + ->build(); ``` diff --git a/doc/models/subscription-group-component-custom-price.md b/doc/models/subscription-group-component-custom-price.md index 1310ab13..0b85bf13 100644 --- a/doc/models/subscription-group-component-custom-price.md +++ b/doc/models/subscription-group-component-custom-price.md @@ -15,34 +15,95 @@ Used in place of `price_point_id` to define a custom price point unique to the s | `prices` | [`?(Price[])`](../../doc/models/price.md) | Optional | - | getPrices(): ?array | setPrices(?array prices): void | | `overagePricing` | [`?(ComponentCustomPrice[])`](../../doc/models/component-custom-price.md) | Optional | - | getOveragePricing(): ?array | setOveragePricing(?array overagePricing): void | -## Example (as JSON) - -```json -{ - "pricing_scheme": "per_unit", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "overage_pricing": [ - { - "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 - } - ] - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$subscriptionGroupComponentCustomPrice = SubscriptionGroupComponentCustomPriceBuilder::init() + ->pricingScheme(PricingScheme::STAIRSTEP) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->overagePricing( + [ + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(230) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(10) + ->build(), + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(230) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(10) + ->build(), + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(230) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(10) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/subscription-group-create-error-response-exception.md b/doc/models/subscription-group-create-error-response-exception.md index a9a3e5c8..38990602 100644 --- a/doc/models/subscription-group-create-error-response-exception.md +++ b/doc/models/subscription-group-create-error-response-exception.md @@ -11,15 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [SubscriptionGroupMembersArrayError](../../doc/models/subscription-group-members-array-error.md)\|[SubscriptionGroupSingleError](../../doc/models/subscription-group-single-error.md)\|string | Required | This is a container for one-of cases. | getErrors(): | setErrors( errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "members": [ - "members6" - ] - } +## Example + +```php +try { + // make the API call +} catch (SubscriptionGroupCreateErrorResponseException $exp) { + echo 'Caught SubscriptionGroupCreateErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-group-credit-card.md b/doc/models/subscription-group-credit-card.md index 0fc88fa4..92beec74 100644 --- a/doc/models/subscription-group-credit-card.md +++ b/doc/models/subscription-group-credit-card.md @@ -30,16 +30,21 @@ | `cvv` | `?string` | Optional | - | getCvv(): ?string | setCvv(?string cvv): void | | `paymentType` | `?string` | Optional | - | getPaymentType(): ?string | setPaymentType(?string paymentType): void | -## Example (as JSON) - -```json -{ - "chargify_token": "tok_592nf92ng0sjd4300p", - "full_number": 4111111111111111, - "vault_token": "vault_token6", - "current_vault": "braintree_blue", - "gateway_handle": "gateway_handle6", - "first_name": "first_name4" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupCreditCardBuilder; +use AdvancedBillingLib\Models\CreditCardVault; + +$subscriptionGroupCreditCard = SubscriptionGroupCreditCardBuilder::init() + ->chargifyToken('tok_592nf92ng0sjd4300p') + ->vaultToken('vault_token0') + ->currentVault(CreditCardVault::BLUE_SNAP) + ->gatewayHandle('gateway_handle0') + ->firstName('first_name8') + ->fullNumber( + 4111111111111111 + ) + ->build(); ``` diff --git a/doc/models/subscription-group-customer.md b/doc/models/subscription-group-customer.md index 5a7fb2b8..4fb57182 100644 --- a/doc/models/subscription-group-customer.md +++ b/doc/models/subscription-group-customer.md @@ -15,15 +15,17 @@ | `email` | `?string` | Optional | - | getEmail(): ?string | setEmail(?string email): void | | `reference` | `?string` | Optional | - | getReference(): ?string | setReference(?string reference): void | -## Example (as JSON) - -```json -{ - "first_name": "first_name4", - "last_name": "last_name2", - "organization": "organization2", - "email": "email2", - "reference": "reference0" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupCustomerBuilder; + +$subscriptionGroupCustomer = SubscriptionGroupCustomerBuilder::init() + ->firstName('first_name6') + ->lastName('last_name4') + ->organization('organization0') + ->email('email0') + ->reference('reference8') + ->build(); ``` diff --git a/doc/models/subscription-group-include.md b/doc/models/subscription-group-include.md index 3225e28e..bd7b094b 100644 --- a/doc/models/subscription-group-include.md +++ b/doc/models/subscription-group-include.md @@ -11,3 +11,11 @@ | --- | | `CURRENT_BILLING_AMOUNT_IN_CENTS` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionGroupInclude; + +$subscriptionGroupInclude = SubscriptionGroupInclude::CURRENT_BILLING_AMOUNT_IN_CENTS; +``` + diff --git a/doc/models/subscription-group-item.md b/doc/models/subscription-group-item.md index 8e3ac02c..022e2ea9 100644 --- a/doc/models/subscription-group-item.md +++ b/doc/models/subscription-group-item.md @@ -20,15 +20,17 @@ | `totalRevenueInCents` | `?int` | Optional | - | getTotalRevenueInCents(): ?int | setTotalRevenueInCents(?int totalRevenueInCents): void | | `balanceInCents` | `?int` | Optional | - | getBalanceInCents(): ?int | setBalanceInCents(?int balanceInCents): void | -## Example (as JSON) - -```json -{ - "id": 16, - "reference": "reference8", - "product_id": 214, - "product_handle": "product_handle4", - "product_price_point_id": 138 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupItemBuilder; + +$subscriptionGroupItem = SubscriptionGroupItemBuilder::init() + ->id(26) + ->reference('reference4') + ->productId(32) + ->productHandle('product_handle8') + ->productPricePointId(148) + ->build(); ``` diff --git a/doc/models/subscription-group-members-array-error.md b/doc/models/subscription-group-members-array-error.md index 57d68744..606e64d7 100644 --- a/doc/models/subscription-group-members-array-error.md +++ b/doc/models/subscription-group-members-array-error.md @@ -11,13 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `members` | `string[]` | Required | - | getMembers(): array | setMembers(array members): void | -## Example (as JSON) - -```json -{ - "members": [ - "members6" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupMembersArrayErrorBuilder; + +$subscriptionGroupMembersArrayError = SubscriptionGroupMembersArrayErrorBuilder::init( + [ + 'members6' + ] +)->build(); ``` diff --git a/doc/models/subscription-group-payment-profile.md b/doc/models/subscription-group-payment-profile.md index 9454b965..a28048bd 100644 --- a/doc/models/subscription-group-payment-profile.md +++ b/doc/models/subscription-group-payment-profile.md @@ -14,14 +14,16 @@ | `lastName` | `?string` | Optional | - | getLastName(): ?string | setLastName(?string lastName): void | | `maskedCardNumber` | `?string` | Optional | - | getMaskedCardNumber(): ?string | setMaskedCardNumber(?string maskedCardNumber): void | -## Example (as JSON) - -```json -{ - "id": 22, - "first_name": "first_name4", - "last_name": "last_name2", - "masked_card_number": "masked_card_number2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPaymentProfileBuilder; + +$subscriptionGroupPaymentProfile = SubscriptionGroupPaymentProfileBuilder::init() + ->id(246) + ->firstName('first_name6') + ->lastName('last_name4') + ->maskedCardNumber('masked_card_number4') + ->build(); ``` diff --git a/doc/models/subscription-group-prepayment-method.md b/doc/models/subscription-group-prepayment-method.md index dc41027f..56a8f685 100644 --- a/doc/models/subscription-group-prepayment-method.md +++ b/doc/models/subscription-group-prepayment-method.md @@ -16,3 +16,11 @@ | `PAYPAL_ACCOUNT` | | `OTHER` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionGroupPrepaymentMethod; + +$subscriptionGroupPrepaymentMethod = SubscriptionGroupPrepaymentMethod::CHECK; +``` + diff --git a/doc/models/subscription-group-prepayment-request.md b/doc/models/subscription-group-prepayment-request.md index bccc8481..a652dd9e 100644 --- a/doc/models/subscription-group-prepayment-request.md +++ b/doc/models/subscription-group-prepayment-request.md @@ -11,16 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `prepayment` | [`SubscriptionGroupPrepayment`](../../doc/models/subscription-group-prepayment.md) | Required | - | getPrepayment(): SubscriptionGroupPrepayment | setPrepayment(SubscriptionGroupPrepayment prepayment): void | -## Example (as JSON) - -```json -{ - "prepayment": { - "amount": 136, - "details": "details8", - "memo": "memo2", - "method": "paypal_account" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPrepaymentRequestBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPrepaymentBuilder; +use AdvancedBillingLib\Models\SubscriptionGroupPrepaymentMethod; + +$subscriptionGroupPrepaymentRequest = SubscriptionGroupPrepaymentRequestBuilder::init( + SubscriptionGroupPrepaymentBuilder::init( + 136, + 'details8', + 'memo2', + SubscriptionGroupPrepaymentMethod::PAYPAL_ACCOUNT + )->build() +)->build(); ``` diff --git a/doc/models/subscription-group-prepayment-response.md b/doc/models/subscription-group-prepayment-response.md index 25598f8b..e953c36b 100644 --- a/doc/models/subscription-group-prepayment-response.md +++ b/doc/models/subscription-group-prepayment-response.md @@ -15,15 +15,18 @@ | `entryType` | [`?string(ServiceCreditType)`](../../doc/models/service-credit-type.md) | Optional | The type of entry | getEntryType(): ?string | setEntryType(?string entryType): void | | `memo` | `?string` | Optional | A memo attached to the entry. | getMemo(): ?string | setMemo(?string memo): void | -## Example (as JSON) - -```json -{ - "id": 110, - "amount_in_cents": 196, - "ending_balance_in_cents": 236, - "entry_type": "Credit", - "memo": "memo2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPrepaymentResponseBuilder; +use AdvancedBillingLib\Models\ServiceCreditType; + +$subscriptionGroupPrepaymentResponse = SubscriptionGroupPrepaymentResponseBuilder::init() + ->id(32) + ->amountInCents(138) + ->endingBalanceInCents(158) + ->entryType(ServiceCreditType::CREDIT) + ->memo('memo2') + ->build(); ``` diff --git a/doc/models/subscription-group-prepayment.md b/doc/models/subscription-group-prepayment.md index 744f5c07..48eaa3b6 100644 --- a/doc/models/subscription-group-prepayment.md +++ b/doc/models/subscription-group-prepayment.md @@ -14,14 +14,17 @@ | `memo` | `string` | Required | - | getMemo(): string | setMemo(string memo): void | | `method` | [`string(SubscriptionGroupPrepaymentMethod)`](../../doc/models/subscription-group-prepayment-method.md) | Required | - | getMethod(): string | setMethod(string method): void | -## Example (as JSON) - -```json -{ - "amount": 96, - "details": "details2", - "memo": "memo6", - "method": "money_order" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPrepaymentBuilder; +use AdvancedBillingLib\Models\SubscriptionGroupPrepaymentMethod; + +$subscriptionGroupPrepayment = SubscriptionGroupPrepaymentBuilder::init( + 12, + 'details4', + 'memo8', + SubscriptionGroupPrepaymentMethod::MONEY_ORDER +)->build(); ``` diff --git a/doc/models/subscription-group-response.md b/doc/models/subscription-group-response.md index cb3f8140..86fdb8d5 100644 --- a/doc/models/subscription-group-response.md +++ b/doc/models/subscription-group-response.md @@ -11,25 +11,34 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionGroup` | [`SubscriptionGroup`](../../doc/models/subscription-group.md) | Required | - | getSubscriptionGroup(): SubscriptionGroup | setSubscriptionGroup(SubscriptionGroup subscriptionGroup): void | -## Example (as JSON) - -```json -{ - "subscription_group": { - "uid": "uid8", - "customer_id": 220, - "payment_profile": { - "id": 44, - "first_name": "first_name4", - "last_name": "last_name2", - "masked_card_number": "masked_card_number2" - }, - "payment_collection_method": "prepaid", - "subscription_ids": [ - 74, - 75 - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPaymentProfileBuilder; +use AdvancedBillingLib\Models\CollectionMethod; + +$subscriptionGroupResponse = SubscriptionGroupResponseBuilder::init( + SubscriptionGroupBuilder::init() + ->uid('uid8') + ->customerId(220) + ->paymentProfile( + SubscriptionGroupPaymentProfileBuilder::init() + ->id(44) + ->firstName('first_name4') + ->lastName('last_name2') + ->maskedCardNumber('masked_card_number2') + ->build() + ) + ->paymentCollectionMethod(CollectionMethod::PREPAID) + ->subscriptionIds( + [ + 74, + 75 + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-group-signup-component.md b/doc/models/subscription-group-signup-component.md index 072c64c0..28b375fe 100644 --- a/doc/models/subscription-group-signup-component.md +++ b/doc/models/subscription-group-signup-component.md @@ -15,73 +15,112 @@ | `pricePointId` | string\|int\|null | Optional | This is a container for one-of cases. | getPricePointId(): | setPricePointId( pricePointId): void | | `customPrice` | [`?SubscriptionGroupComponentCustomPrice`](../../doc/models/subscription-group-component-custom-price.md) | Optional | Used in place of `price_point_id` to define a custom price point unique to the subscription. You still need to provide `component_id`. | getCustomPrice(): ?SubscriptionGroupComponentCustomPrice | setCustomPrice(?SubscriptionGroupComponentCustomPrice customPrice): void | -## Example (as JSON) +## Example -```json -{ - "component_id": "String1", - "allocated_quantity": "String5", - "unit_balance": "String9", - "price_point_id": "String5", - "custom_price": { - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ], - "overage_pricing": [ - { - "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 - } - ] - }, - { - "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 - } - ] - }, - { - "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 - } - ] - } - ] - } -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupComponentBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\IntervalUnit; + +$subscriptionGroupSignupComponent = SubscriptionGroupSignupComponentBuilder::init() + ->componentId( + 'String7' + ) + ->allocatedQuantity( + 'String1' + ) + ->unitBalance( + 'String5' + ) + ->pricePointId( + 'String1' + ) + ->customPrice( + SubscriptionGroupComponentCustomPriceBuilder::init() + ->pricingScheme(PricingScheme::STAIRSTEP) + ->prices( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->overagePricing( + [ + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(230) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(10) + ->build(), + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(230) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(10) + ->build(), + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(230) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(10) + ->build() + ] + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-group-signup-error-response-exception.md b/doc/models/subscription-group-signup-error-response-exception.md index 9f7ddccd..b841d913 100644 --- a/doc/models/subscription-group-signup-error-response-exception.md +++ b/doc/models/subscription-group-signup-error-response-exception.md @@ -11,60 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`SubscriptionGroupSignupError`](../../doc/models/subscription-group-signup-error.md) | Required | - | getErrors(): SubscriptionGroupSignupError | setErrors(SubscriptionGroupSignupError errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "subscriptions": { - "0": { - "payment_profile.chargify_token": [ - "Chargify token not found" - ], - "product": [ - "Product must be among the Products for this Site" - ], - "product_price_point_id": [ - "Product price point must belong to product." - ], - "base": [ - "No payment method was on file for the $30.00 balance'" - ], - "payment_profile.expiration_month": [ - "Credit card expiration month: cannot be blank." - ], - "payment_profile.expiration_year": [ - "Credit card expiration year: cannot be blank." - ], - "payment_profile.full_number": [ - "Credit card number: cannot be blank." - ], - "payment_profile": [ - "payment_profile2" - ] - } - }, - "payer_reference": "payer_reference4", - "payer": { - "last_name": [ - "last_name5", - "last_name6" - ], - "first_name": [ - "first_name8" - ], - "email": [ - "email0", - "email9" - ] - }, - "subscription_group": [ - "subscription_group7", - "subscription_group8", - "subscription_group9" - ], - "payment_profile_id": "payment_profile_id8" - } +## Example + +```php +try { + // make the API call +} catch (SubscriptionGroupSignupErrorResponseException $exp) { + echo 'Caught SubscriptionGroupSignupErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-group-signup-error.md b/doc/models/subscription-group-signup-error.md index b894ed1e..4774d294 100644 --- a/doc/models/subscription-group-signup-error.md +++ b/doc/models/subscription-group-signup-error.md @@ -16,67 +16,132 @@ | `paymentProfileId` | `?string` | Optional | - | getPaymentProfileId(): ?string | setPaymentProfileId(?string paymentProfileId): void | | `payerId` | `?string` | Optional | - | getPayerId(): ?string | setPayerId(?string payerId): void | -## Example (as JSON) +## Example -```json -{ - "subscriptions": { - "key0": { - "product": [ - "product9" - ], - "product_price_point_id": [ - "product_price_point_id7" - ], - "payment_profile": [ - "payment_profile2" - ], - "payment_profile.chargify_token": [ - "payment_profile.chargify_token6" - ], - "base": [ - "base5", - "base6" - ] - }, - "key1": { - "product": [ - "product9" - ], - "product_price_point_id": [ - "product_price_point_id7" - ], - "payment_profile": [ - "payment_profile2" - ], - "payment_profile.chargify_token": [ - "payment_profile.chargify_token6" - ], - "base": [ - "base5", - "base6" - ] - } - }, - "payer_reference": "payer_reference0", - "payer": { - "last_name": [ - "last_name5", - "last_name6" - ], - "first_name": [ - "first_name8" - ], - "email": [ - "email0", - "email9" - ] - }, - "subscription_group": [ - "subscription_group1", - "subscription_group2" - ], - "payment_profile_id": "payment_profile_id2" -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupErrorBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSubscriptionErrorBuilder; +use AdvancedBillingLib\Models\Builders\PayerErrorBuilder; + +$subscriptionGroupSignupError = SubscriptionGroupSignupErrorBuilder::init() + ->subscriptions( + [ + 'key0' => SubscriptionGroupSubscriptionErrorBuilder::init() + ->product( + [ + 'product9' + ] + ) + ->productPricePointId( + [ + 'product_price_point_id7' + ] + ) + ->paymentProfile( + [ + 'payment_profile2' + ] + ) + ->paymentProfileChargifyToken( + [ + 'payment_profile.chargify_token6' + ] + ) + ->base( + [ + 'base5', + 'base6' + ] + ) + ->build(), + 'key1' => SubscriptionGroupSubscriptionErrorBuilder::init() + ->product( + [ + 'product9' + ] + ) + ->productPricePointId( + [ + 'product_price_point_id7' + ] + ) + ->paymentProfile( + [ + 'payment_profile2' + ] + ) + ->paymentProfileChargifyToken( + [ + 'payment_profile.chargify_token6' + ] + ) + ->base( + [ + 'base5', + 'base6' + ] + ) + ->build(), + 'key2' => SubscriptionGroupSubscriptionErrorBuilder::init() + ->product( + [ + 'product9' + ] + ) + ->productPricePointId( + [ + 'product_price_point_id7' + ] + ) + ->paymentProfile( + [ + 'payment_profile2' + ] + ) + ->paymentProfileChargifyToken( + [ + 'payment_profile.chargify_token6' + ] + ) + ->base( + [ + 'base5', + 'base6' + ] + ) + ->build() + ] + ) + ->payerReference('payer_reference8') + ->payer( + PayerErrorBuilder::init() + ->lastName( + [ + 'last_name5', + 'last_name6' + ] + ) + ->firstName( + [ + 'first_name8' + ] + ) + ->email( + [ + 'email0', + 'email9' + ] + ) + ->build() + ) + ->subscriptionGroup( + [ + 'subscription_group3', + 'subscription_group4', + 'subscription_group5' + ] + ) + ->paymentProfileId('payment_profile_id4') + ->build(); ``` diff --git a/doc/models/subscription-group-signup-event-data.md b/doc/models/subscription-group-signup-event-data.md index 42865443..da578a28 100644 --- a/doc/models/subscription-group-signup-event-data.md +++ b/doc/models/subscription-group-signup-event-data.md @@ -12,30 +12,40 @@ | `subscriptionGroup` | [`SubscriptionGroupSignupFailureData`](../../doc/models/subscription-group-signup-failure-data.md) | Required | - | getSubscriptionGroup(): SubscriptionGroupSignupFailureData | setSubscriptionGroup(SubscriptionGroupSignupFailureData subscriptionGroup): void | | `customer` | [`?Customer`](../../doc/models/customer.md) | Required | - | getCustomer(): ?Customer | setCustomer(?Customer customer): void | -## Example (as JSON) - -```json -{ - "subscription_group": { - "payer_id": 150, - "payer_reference": "payer_reference6", - "payment_profile_id": 128, - "payment_collection_method": "payment_collection_method8", - "payer_attributes": { - "first_name": "first_name2", - "last_name": "last_name0", - "email": "email4", - "cc_emails": "cc_emails2", - "organization": "organization6" - } - }, - "customer": { - "first_name": "first_name0", - "last_name": "last_name8", - "email": "email6", - "cc_emails": "cc_emails0", - "organization": "organization6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupEventDataBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupFailureDataBuilder; +use AdvancedBillingLib\Models\Builders\PayerAttributesBuilder; +use AdvancedBillingLib\Models\Builders\CustomerBuilder; + +$subscriptionGroupSignupEventData = SubscriptionGroupSignupEventDataBuilder::init( + SubscriptionGroupSignupFailureDataBuilder::init() + ->payerId(150) + ->payerReference('payer_reference6') + ->paymentProfileId(128) + ->paymentCollectionMethod('payment_collection_method8') + ->payerAttributes( + PayerAttributesBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails2') + ->organization('organization6') + ->build() + ) + ->build() +) + ->customer( + CustomerBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->email('email6') + ->ccEmails('cc_emails0') + ->organization('organization6') + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-group-signup-failure-data.md b/doc/models/subscription-group-signup-failure-data.md index a89c339c..94daab51 100644 --- a/doc/models/subscription-group-signup-failure-data.md +++ b/doc/models/subscription-group-signup-failure-data.md @@ -18,21 +18,26 @@ | `bankAccountAttributes` | [`?SubscriptionGroupBankAccount`](../../doc/models/subscription-group-bank-account.md) | Optional | - | getBankAccountAttributes(): ?SubscriptionGroupBankAccount | setBankAccountAttributes(?SubscriptionGroupBankAccount bankAccountAttributes): void | | `subscriptions` | [`?(SubscriptionGroupSignupItem[])`](../../doc/models/subscription-group-signup-item.md) | Optional | - | getSubscriptions(): ?array | setSubscriptions(?array subscriptions): void | -## Example (as JSON) - -```json -{ - "payer_id": 16, - "payer_reference": "payer_reference8", - "payment_profile_id": 6, - "payment_collection_method": "payment_collection_method0", - "payer_attributes": { - "first_name": "first_name2", - "last_name": "last_name0", - "email": "email4", - "cc_emails": "cc_emails2", - "organization": "organization6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupFailureDataBuilder; +use AdvancedBillingLib\Models\Builders\PayerAttributesBuilder; + +$subscriptionGroupSignupFailureData = SubscriptionGroupSignupFailureDataBuilder::init() + ->payerId(236) + ->payerReference('payer_reference2') + ->paymentProfileId(42) + ->paymentCollectionMethod('payment_collection_method4') + ->payerAttributes( + PayerAttributesBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails2') + ->organization('organization6') + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-group-signup-item.md b/doc/models/subscription-group-signup-item.md index 99c50575..1ea60a90 100644 --- a/doc/models/subscription-group-signup-item.md +++ b/doc/models/subscription-group-signup-item.md @@ -13,29 +13,33 @@ | `productId` | `?int` | Optional | The Product ID of the product for which you are creating a subscription. You can pass either `product_id` or `product_handle`. | getProductId(): ?int | setProductId(?int productId): void | | `productPricePointId` | `?int` | Optional | The ID of the particular price point on the product. | getProductPricePointId(): ?int | setProductPricePointId(?int productPricePointId): void | | `productPricePointHandle` | `?string` | Optional | The user-friendly API handle of a product's particular price point. | getProductPricePointHandle(): ?string | setProductPricePointHandle(?string productPricePointHandle): void | -| `offerId` | `?int` | Optional | Use in place of passing product and component information to set up the subscription with an existing offer. May be either the Chargify ID of the offer or its handle prefixed with `handle:` | getOfferId(): ?int | setOfferId(?int offerId): void | -| `reference` | `?string` | Optional | The reference value (provided by your app) for the subscription itelf. | getReference(): ?string | setReference(?string reference): void | +| `offerId` | `?int` | Optional | Use in place of passing product and component information to set up the subscription with an existing offer. May be either the Chargify ID of the offer or its handle prefixed with `handle:`. | getOfferId(): ?int | setOfferId(?int offerId): void | +| `reference` | `?string` | Optional | The reference value (provided by your app) for the subscription itself. | getReference(): ?string | setReference(?string reference): void | | `primary` | `?bool` | Optional | One of the subscriptions must be marked as primary in the group. | getPrimary(): ?bool | setPrimary(?bool primary): void | | `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. 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 | +| `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 | -## Example (as JSON) - -```json -{ - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "product_handle": "product_handle2", - "product_id": 34, - "product_price_point_id": 214, - "product_price_point_handle": "product_price_point_handle4", - "offer_id": 150 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupItemBuilder; + +$subscriptionGroupSignupItem = SubscriptionGroupSignupItemBuilder::init() + ->productHandle('product_handle8') + ->productId(12) + ->productPricePointId(192) + ->productPricePointHandle('product_price_point_handle8') + ->offerId(172) + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->build(); ``` diff --git a/doc/models/subscription-group-signup-request.md b/doc/models/subscription-group-signup-request.md index a538c2f9..ef323054 100644 --- a/doc/models/subscription-group-signup-request.md +++ b/doc/models/subscription-group-signup-request.md @@ -11,36 +11,47 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionGroup` | [`SubscriptionGroupSignup`](../../doc/models/subscription-group-signup.md) | Required | - | getSubscriptionGroup(): SubscriptionGroupSignup | setSubscriptionGroup(SubscriptionGroupSignup subscriptionGroup): void | -## Example (as JSON) - -```json -{ - "subscription_group": { - "subscriptions": [ - { - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "product_handle": "product_handle8", - "product_id": 144, - "product_price_point_id": 68, - "product_price_point_handle": "product_price_point_handle4", - "offer_id": 40 - } - ], - "payment_profile_id": 128, - "payer_id": 150, - "payer_reference": "payer_reference6", - "payment_collection_method": "prepaid", - "payer_attributes": { - "first_name": "first_name2", - "last_name": "last_name0", - "email": "email4", - "cc_emails": "cc_emails2", - "organization": "organization6" - } - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupRequestBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupItemBuilder; +use AdvancedBillingLib\Models\CollectionMethod; +use AdvancedBillingLib\Models\Builders\PayerAttributesBuilder; + +$subscriptionGroupSignupRequest = SubscriptionGroupSignupRequestBuilder::init( + SubscriptionGroupSignupBuilder::init( + [ + SubscriptionGroupSignupItemBuilder::init() + ->productHandle('product_handle8') + ->productId(144) + ->productPricePointId(68) + ->productPricePointHandle('product_price_point_handle4') + ->offerId(40) + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->build() + ] + ) + ->paymentProfileId(128) + ->payerId(150) + ->payerReference('payer_reference6') + ->paymentCollectionMethod(CollectionMethod::PREPAID) + ->payerAttributes( + PayerAttributesBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails2') + ->organization('organization6') + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-group-signup-response.md b/doc/models/subscription-group-signup-response.md index 18949b6a..5fb2001a 100644 --- a/doc/models/subscription-group-signup-response.md +++ b/doc/models/subscription-group-signup-response.md @@ -21,19 +21,21 @@ | `subscriptions` | [`?(SubscriptionGroupItem[])`](../../doc/models/subscription-group-item.md) | Optional | - | getSubscriptions(): ?array | setSubscriptions(?array subscriptions): 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 | -## Example (as JSON) - -```json -{ - "uid": "uid8", - "scheme": 28, - "customer_id": 48, - "payment_profile_id": 44, - "subscription_ids": [ - 158, - 159, - 160 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupResponseBuilder; + +$subscriptionGroupSignupResponse = SubscriptionGroupSignupResponseBuilder::init() + ->uid('uid4') + ->scheme(60) + ->customerId(80) + ->paymentProfileId(244) + ->subscriptionIds( + [ + 190 + ] + ) + ->build(); ``` diff --git a/doc/models/subscription-group-signup.md b/doc/models/subscription-group-signup.md index e2da4845..8e30e071 100644 --- a/doc/models/subscription-group-signup.md +++ b/doc/models/subscription-group-signup.md @@ -18,34 +18,44 @@ | `bankAccountAttributes` | [`?SubscriptionGroupBankAccount`](../../doc/models/subscription-group-bank-account.md) | Optional | - | getBankAccountAttributes(): ?SubscriptionGroupBankAccount | setBankAccountAttributes(?SubscriptionGroupBankAccount bankAccountAttributes): void | | `subscriptions` | [`SubscriptionGroupSignupItem[]`](../../doc/models/subscription-group-signup-item.md) | Required | - | getSubscriptions(): array | setSubscriptions(array subscriptions): void | -## Example (as JSON) - -```json -{ - "subscriptions": [ - { - "metafields": { - "custom_field_name_1": "custom_field_value_1", - "custom_field_name_2": "custom_field_value_2" - }, - "product_handle": "product_handle8", - "product_id": 144, - "product_price_point_id": 68, - "product_price_point_handle": "product_price_point_handle4", - "offer_id": 40 - } - ], - "payment_profile_id": 42, - "payer_id": 64, - "payer_reference": "payer_reference8", - "payment_collection_method": "automatic", - "payer_attributes": { - "first_name": "first_name2", - "last_name": "last_name0", - "email": "email4", - "cc_emails": "cc_emails2", - "organization": "organization6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSignupItemBuilder; +use AdvancedBillingLib\Models\CollectionMethod; +use AdvancedBillingLib\Models\Builders\PayerAttributesBuilder; + +$subscriptionGroupSignup = SubscriptionGroupSignupBuilder::init( + [ + SubscriptionGroupSignupItemBuilder::init() + ->productHandle('product_handle8') + ->productId(144) + ->productPricePointId(68) + ->productPricePointHandle('product_price_point_handle4') + ->offerId(40) + ->metafields( + [ + 'custom_field_name_1' => 'custom_field_value_1', + 'custom_field_name_2' => 'custom_field_value_2' + ] + ) + ->build() + ] +) + ->paymentProfileId(124) + ->payerId(146) + ->payerReference('payer_reference0') + ->paymentCollectionMethod(CollectionMethod::PREPAID) + ->payerAttributes( + PayerAttributesBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails2') + ->organization('organization6') + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-group-single-error.md b/doc/models/subscription-group-single-error.md index b2d934f2..c10631f1 100644 --- a/doc/models/subscription-group-single-error.md +++ b/doc/models/subscription-group-single-error.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionGroup` | `string` | Required | - | getSubscriptionGroup(): string | setSubscriptionGroup(string subscriptionGroup): void | -## Example (as JSON) +## Example -```json -{ - "subscription_group": "subscription_group2" -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSingleErrorBuilder; + +$subscriptionGroupSingleError = SubscriptionGroupSingleErrorBuilder::init( + 'subscription_group0' +)->build(); ``` diff --git a/doc/models/subscription-group-subscription-error.md b/doc/models/subscription-group-subscription-error.md index a88e3808..d2bb94d7 100644 --- a/doc/models/subscription-group-subscription-error.md +++ b/doc/models/subscription-group-subscription-error.md @@ -20,31 +20,43 @@ Object which contains subscription errors. | `paymentProfileExpirationYear` | `?(string[])` | Optional | - | getPaymentProfileExpirationYear(): ?array | setPaymentProfileExpirationYear(?array paymentProfileExpirationYear): void | | `paymentProfileFullNumber` | `?(string[])` | Optional | - | getPaymentProfileFullNumber(): ?array | setPaymentProfileFullNumber(?array paymentProfileFullNumber): void | -## Example (as JSON) - -```json -{ - "product": [ - "product7", - "product6" - ], - "product_price_point_id": [ - "product_price_point_id9", - "product_price_point_id0" - ], - "payment_profile": [ - "payment_profile4", - "payment_profile5" - ], - "payment_profile.chargify_token": [ - "payment_profile.chargify_token8", - "payment_profile.chargify_token9" - ], - "base": [ - "base7", - "base8", - "base9" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupSubscriptionErrorBuilder; + +$subscriptionGroupSubscriptionError = SubscriptionGroupSubscriptionErrorBuilder::init() + ->product( + [ + 'product7', + 'product8' + ] + ) + ->productPricePointId( + [ + 'product_price_point_id3', + 'product_price_point_id4' + ] + ) + ->paymentProfile( + [ + 'payment_profile8', + 'payment_profile9' + ] + ) + ->paymentProfileChargifyToken( + [ + 'payment_profile.chargify_token2', + 'payment_profile.chargify_token3' + ] + ) + ->base( + [ + 'base1', + 'base2', + 'base3' + ] + ) + ->build(); ``` diff --git a/doc/models/subscription-group-update-error-response-exception.md b/doc/models/subscription-group-update-error-response-exception.md index 5aedd56c..5e929320 100644 --- a/doc/models/subscription-group-update-error-response-exception.md +++ b/doc/models/subscription-group-update-error-response-exception.md @@ -11,16 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`?SubscriptionGroupUpdateError`](../../doc/models/subscription-group-update-error.md) | Optional | - | getErrors(): ?SubscriptionGroupUpdateError | setErrors(?SubscriptionGroupUpdateError errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "members": [ - "members2", - "members1" - ] - } +## Example + +```php +try { + // make the API call +} catch (SubscriptionGroupUpdateErrorResponseException $exp) { + echo 'Caught SubscriptionGroupUpdateErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-group-update-error.md b/doc/models/subscription-group-update-error.md index 3ba69b83..467ee88a 100644 --- a/doc/models/subscription-group-update-error.md +++ b/doc/models/subscription-group-update-error.md @@ -11,15 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `members` | `?(string[])` | Optional | - | getMembers(): ?array | setMembers(?array members): void | -## Example (as JSON) - -```json -{ - "members": [ - "members4", - "members5", - "members6" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupUpdateErrorBuilder; + +$subscriptionGroupUpdateError = SubscriptionGroupUpdateErrorBuilder::init() + ->members( + [ + 'members6', + 'members7' + ] + ) + ->build(); ``` diff --git a/doc/models/subscription-group.md b/doc/models/subscription-group.md index f53fa1e9..03a09939 100644 --- a/doc/models/subscription-group.md +++ b/doc/models/subscription-group.md @@ -16,24 +16,32 @@ | `subscriptionIds` | `?(int[])` | Optional | - | getSubscriptionIds(): ?array | setSubscriptionIds(?array subscriptionIds): void | | `createdAt` | `?DateTime` | Optional | - | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | -## Example (as JSON) - -```json -{ - "uid": "uid4", - "customer_id": 36, - "payment_profile": { - "id": 44, - "first_name": "first_name4", - "last_name": "last_name2", - "masked_card_number": "masked_card_number2" - }, - "payment_collection_method": "prepaid", - "subscription_ids": [ - 146, - 147, - 148 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionGroupBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionGroupPaymentProfileBuilder; +use AdvancedBillingLib\Models\CollectionMethod; + +$subscriptionGroup = SubscriptionGroupBuilder::init() + ->uid('uid8') + ->customerId(78) + ->paymentProfile( + SubscriptionGroupPaymentProfileBuilder::init() + ->id(44) + ->firstName('first_name4') + ->lastName('last_name2') + ->maskedCardNumber('masked_card_number2') + ->build() + ) + ->paymentCollectionMethod(CollectionMethod::AUTOMATIC) + ->subscriptionIds( + [ + 188, + 189, + 190 + ] + ) + ->build(); ``` diff --git a/doc/models/subscription-groups-list-include.md b/doc/models/subscription-groups-list-include.md index 27d18a04..6aed3633 100644 --- a/doc/models/subscription-groups-list-include.md +++ b/doc/models/subscription-groups-list-include.md @@ -11,3 +11,11 @@ | --- | | `ACCOUNT_BALANCES` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionGroupsListInclude; + +$subscriptionGroupsListInclude = SubscriptionGroupsListInclude::ACCOUNT_BALANCES; +``` + diff --git a/doc/models/subscription-include.md b/doc/models/subscription-include.md index 639f7da2..47edc4ba 100644 --- a/doc/models/subscription-include.md +++ b/doc/models/subscription-include.md @@ -12,3 +12,11 @@ | `COUPONS` | | `SELF_SERVICE_PAGE_TOKEN` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionInclude; + +$subscriptionInclude = SubscriptionInclude::COUPONS; +``` + diff --git a/doc/models/subscription-included-coupon.md b/doc/models/subscription-included-coupon.md index cc51258f..25e3a989 100644 --- a/doc/models/subscription-included-coupon.md +++ b/doc/models/subscription-included-coupon.md @@ -17,17 +17,19 @@ | `amountInCents` | `?int` | Optional | **Constraints**: `>= 0` | getAmountInCents(): ?int | setAmountInCents(?int amountInCents): void | | `percentage` | `?string` | Optional | - | getPercentage(): ?string | setPercentage(?string percentage): void | -## Example (as JSON) - -```json -{ - "code": "\"ABCD_10\"", - "use_count": 2, - "uses_allowed": 10, - "expires_at": "\"2023-07-13T05:18:58-04:00\"", - "amount_in_cents": 1000, - "percentage": "\"15.0\"", - "recurring": false -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionIncludedCouponBuilder; + +$subscriptionIncludedCoupon = SubscriptionIncludedCouponBuilder::init() + ->code('"ABCD_10"') + ->useCount(2) + ->usesAllowed(10) + ->expiresAt('"2023-07-13T05:18:58-04:00"') + ->recurring(false) + ->amountInCents(1000) + ->percentage('"15.0"') + ->build(); ``` diff --git a/doc/models/subscription-list-date-field.md b/doc/models/subscription-list-date-field.md index dc18409d..3537231f 100644 --- a/doc/models/subscription-list-date-field.md +++ b/doc/models/subscription-list-date-field.md @@ -13,7 +13,9 @@ ## Example -``` -updated_at +```php +use AdvancedBillingLib\Models\SubscriptionListDateField; + +$subscriptionListDateField = SubscriptionListDateField::UPDATED_AT; ``` diff --git a/doc/models/subscription-list-include.md b/doc/models/subscription-list-include.md index 27fb9c1d..d6bc39d7 100644 --- a/doc/models/subscription-list-include.md +++ b/doc/models/subscription-list-include.md @@ -10,4 +10,15 @@ | Name | | --- | | `SELF_SERVICE_PAGE_TOKEN` | +| `CURRENT_ACCOUNT_BALANCE_IN_CENTS` | +| `CURRENT_BILLING_AMOUNT` | +| `COUPONS` | + +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionListInclude; + +$subscriptionListInclude = SubscriptionListInclude::SELF_SERVICE_PAGE_TOKEN; +``` diff --git a/doc/models/subscription-migration-preview-options.md b/doc/models/subscription-migration-preview-options.md index 5b19e847..51feee52 100644 --- a/doc/models/subscription-migration-preview-options.md +++ b/doc/models/subscription-migration-preview-options.md @@ -20,16 +20,18 @@ | `proration` | [`?Proration`](../../doc/models/proration.md) | Optional | - | getProration(): ?Proration | setProration(?Proration proration): void | | `prorationDate` | `?DateTime` | Optional | The date that the proration is calculated from for the preview | getProrationDate(): ?\DateTime | setProrationDate(?\DateTime prorationDate): void | -## Example (as JSON) - -```json -{ - "include_trial": false, - "include_initial_charge": false, - "include_coupons": true, - "preserve_period": false, - "product_id": 242, - "product_price_point_id": 166 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMigrationPreviewOptionsBuilder; + +$subscriptionMigrationPreviewOptions = SubscriptionMigrationPreviewOptionsBuilder::init() + ->productId(70) + ->productPricePointId(250) + ->includeTrial(false) + ->includeInitialCharge(false) + ->includeCoupons(true) + ->preservePeriod(false) + ->build(); ``` diff --git a/doc/models/subscription-migration-preview-request.md b/doc/models/subscription-migration-preview-request.md index 424b177c..9117d221 100644 --- a/doc/models/subscription-migration-preview-request.md +++ b/doc/models/subscription-migration-preview-request.md @@ -11,18 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `migration` | [`SubscriptionMigrationPreviewOptions`](../../doc/models/subscription-migration-preview-options.md) | Required | - | getMigration(): SubscriptionMigrationPreviewOptions | setMigration(SubscriptionMigrationPreviewOptions migration): void | -## Example (as JSON) - -```json -{ - "migration": { - "include_trial": false, - "include_initial_charge": false, - "include_coupons": true, - "preserve_period": false, - "product_id": 158, - "product_price_point_id": 82 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMigrationPreviewRequestBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionMigrationPreviewOptionsBuilder; + +$subscriptionMigrationPreviewRequest = SubscriptionMigrationPreviewRequestBuilder::init( + SubscriptionMigrationPreviewOptionsBuilder::init() + ->productId(158) + ->productPricePointId(82) + ->includeTrial(false) + ->includeInitialCharge(false) + ->includeCoupons(true) + ->preservePeriod(false) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-migration-preview-response.md b/doc/models/subscription-migration-preview-response.md index 65b82abb..1d4a62ee 100644 --- a/doc/models/subscription-migration-preview-response.md +++ b/doc/models/subscription-migration-preview-response.md @@ -11,16 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `migration` | [`SubscriptionMigrationPreview`](../../doc/models/subscription-migration-preview.md) | Required | - | getMigration(): SubscriptionMigrationPreview | setMigration(SubscriptionMigrationPreview migration): void | -## Example (as JSON) - -```json -{ - "migration": { - "prorated_adjustment_in_cents": 196, - "charge_in_cents": 78, - "payment_due_in_cents": 250, - "credit_applied_in_cents": 210 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMigrationPreviewResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionMigrationPreviewBuilder; + +$subscriptionMigrationPreviewResponse = SubscriptionMigrationPreviewResponseBuilder::init( + SubscriptionMigrationPreviewBuilder::init() + ->proratedAdjustmentInCents(196) + ->chargeInCents(78) + ->paymentDueInCents(250) + ->creditAppliedInCents(210) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-migration-preview.md b/doc/models/subscription-migration-preview.md index 44a86f57..a0be9e67 100644 --- a/doc/models/subscription-migration-preview.md +++ b/doc/models/subscription-migration-preview.md @@ -14,14 +14,16 @@ | `paymentDueInCents` | `?int` | Optional | The amount of the payment due in the case of an upgrade. | getPaymentDueInCents(): ?int | setPaymentDueInCents(?int paymentDueInCents): void | | `creditAppliedInCents` | `?int` | Optional | Represents a credit in cents that is applied to your subscription as part of a migration process for a specific product, which reduces the amount owed for the subscription. | getCreditAppliedInCents(): ?int | setCreditAppliedInCents(?int creditAppliedInCents): void | -## Example (as JSON) - -```json -{ - "prorated_adjustment_in_cents": 134, - "charge_in_cents": 16, - "payment_due_in_cents": 188, - "credit_applied_in_cents": 148 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMigrationPreviewBuilder; + +$subscriptionMigrationPreview = SubscriptionMigrationPreviewBuilder::init() + ->proratedAdjustmentInCents(6) + ->chargeInCents(144) + ->paymentDueInCents(60) + ->creditAppliedInCents(20) + ->build(); ``` diff --git a/doc/models/subscription-mrr-breakout.md b/doc/models/subscription-mrr-breakout.md index 96b59b97..6f039ed4 100644 --- a/doc/models/subscription-mrr-breakout.md +++ b/doc/models/subscription-mrr-breakout.md @@ -12,12 +12,14 @@ | `planAmountInCents` | `int` | Required | - | getPlanAmountInCents(): int | setPlanAmountInCents(int planAmountInCents): void | | `usageAmountInCents` | `int` | Required | - | getUsageAmountInCents(): int | setUsageAmountInCents(int usageAmountInCents): void | -## Example (as JSON) +## Example -```json -{ - "plan_amount_in_cents": 208, - "usage_amount_in_cents": 60 -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMRRBreakoutBuilder; + +$subscriptionMRRBreakout = SubscriptionMRRBreakoutBuilder::init( + 248, + 100 +)->build(); ``` diff --git a/doc/models/subscription-mrr-response.md b/doc/models/subscription-mrr-response.md index 658d29f6..6b1aaf7e 100644 --- a/doc/models/subscription-mrr-response.md +++ b/doc/models/subscription-mrr-response.md @@ -11,20 +11,26 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionsMrr` | [`SubscriptionMRR[]`](../../doc/models/subscription-mrr.md) | Required | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | getSubscriptionsMrr(): array | setSubscriptionsMrr(array subscriptionsMrr): void | -## Example (as JSON) - -```json -{ - "subscriptions_mrr": [ - { - "subscription_id": 0, - "mrr_amount_in_cents": 0, - "breakouts": { - "plan_amount_in_cents": 0, - "usage_amount_in_cents": 0 - } - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMRRResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionMRRBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionMRRBreakoutBuilder; + +$subscriptionMRRResponse = SubscriptionMRRResponseBuilder::init( + [ + SubscriptionMRRBuilder::init( + 0, + 0 + ) + ->breakouts( + SubscriptionMRRBreakoutBuilder::init( + 0, + 0 + )->build() + )->build() + ] +)->build(); ``` diff --git a/doc/models/subscription-mrr.md b/doc/models/subscription-mrr.md index fc1433c6..9dfc7c76 100644 --- a/doc/models/subscription-mrr.md +++ b/doc/models/subscription-mrr.md @@ -13,16 +13,21 @@ | `mrrAmountInCents` | `int` | Required | - | getMrrAmountInCents(): int | setMrrAmountInCents(int mrrAmountInCents): void | | `breakouts` | [`?SubscriptionMRRBreakout`](../../doc/models/subscription-mrr-breakout.md) | Optional | - | getBreakouts(): ?SubscriptionMRRBreakout | setBreakouts(?SubscriptionMRRBreakout breakouts): void | -## Example (as JSON) - -```json -{ - "subscription_id": 4, - "mrr_amount_in_cents": 22, - "breakouts": { - "plan_amount_in_cents": 254, - "usage_amount_in_cents": 106 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionMRRBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionMRRBreakoutBuilder; + +$subscriptionMRR = SubscriptionMRRBuilder::init( + 192, + 210 +) + ->breakouts( + SubscriptionMRRBreakoutBuilder::init( + 254, + 106 + )->build() + )->build(); ``` diff --git a/doc/models/subscription-note-response.md b/doc/models/subscription-note-response.md index e8b7a81d..d3ad0dbe 100644 --- a/doc/models/subscription-note-response.md +++ b/doc/models/subscription-note-response.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `note` | [`SubscriptionNote`](../../doc/models/subscription-note.md) | Required | - | getNote(): SubscriptionNote | setNote(SubscriptionNote note): void | -## Example (as JSON) - -```json -{ - "note": { - "id": 28, - "body": "body0", - "subscription_id": 138, - "created_at": "2016-03-13T12:52:32.123Z", - "updated_at": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionNoteResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionNoteBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$subscriptionNoteResponse = SubscriptionNoteResponseBuilder::init( + SubscriptionNoteBuilder::init() + ->id(28) + ->body('body0') + ->subscriptionId(138) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->updatedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-note.md b/doc/models/subscription-note.md index 57e083a3..7f415f15 100644 --- a/doc/models/subscription-note.md +++ b/doc/models/subscription-note.md @@ -16,15 +16,18 @@ | `updatedAt` | `?DateTime` | Optional | - | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | | `sticky` | `?bool` | Optional | - | getSticky(): ?bool | setSticky(?bool sticky): void | -## Example (as JSON) - -```json -{ - "id": 36, - "body": "body4", - "subscription_id": 146, - "created_at": "2016-03-13T12:52:32.123Z", - "updated_at": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionNoteBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$subscriptionNote = SubscriptionNoteBuilder::init() + ->id(18) + ->body('body6') + ->subscriptionId(128) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->updatedAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/subscription-preview-response.md b/doc/models/subscription-preview-response.md index 39a6c07d..9d3bbbf4 100644 --- a/doc/models/subscription-preview-response.md +++ b/doc/models/subscription-preview-response.md @@ -11,56 +11,71 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionPreview` | [`SubscriptionPreview`](../../doc/models/subscription-preview.md) | Required | - | getSubscriptionPreview(): SubscriptionPreview | setSubscriptionPreview(SubscriptionPreview subscriptionPreview): void | -## Example (as JSON) +## Example -```json -{ - "subscription_preview": { - "current_billing_manifest": { - "line_items": [ - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - } - ], - "total_in_cents": 38, - "total_discount_in_cents": 24, - "total_tax_in_cents": 18, - "subtotal_in_cents": 150 - }, - "next_billing_manifest": { - "line_items": [ - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - }, - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - }, - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - } - ], - "total_in_cents": 62, - "total_discount_in_cents": 208, - "total_tax_in_cents": 42, - "subtotal_in_cents": 174 - } - } -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionPreviewResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionPreviewBuilder; +use AdvancedBillingLib\Models\Builders\BillingManifestBuilder; +use AdvancedBillingLib\Models\Builders\BillingManifestItemBuilder; +use AdvancedBillingLib\Models\LineItemTransactionType; +use AdvancedBillingLib\Models\BillingManifestLineItemKind; + +$subscriptionPreviewResponse = SubscriptionPreviewResponseBuilder::init( + SubscriptionPreviewBuilder::init() + ->currentBillingManifest( + BillingManifestBuilder::init() + ->lineItems( + [ + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build() + ] + ) + ->totalInCents(38) + ->totalDiscountInCents(24) + ->totalTaxInCents(18) + ->subtotalInCents(150) + ->build() + ) + ->nextBillingManifest( + BillingManifestBuilder::init() + ->lineItems( + [ + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build(), + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build(), + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build() + ] + ) + ->totalInCents(62) + ->totalDiscountInCents(208) + ->totalTaxInCents(42) + ->subtotalInCents(174) + ->build() + ) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-preview.md b/doc/models/subscription-preview.md index f0ce517c..e0be370f 100644 --- a/doc/models/subscription-preview.md +++ b/doc/models/subscription-preview.md @@ -12,54 +12,68 @@ | `currentBillingManifest` | [`?BillingManifest`](../../doc/models/billing-manifest.md) | Optional | - | getCurrentBillingManifest(): ?BillingManifest | setCurrentBillingManifest(?BillingManifest currentBillingManifest): void | | `nextBillingManifest` | [`?BillingManifest`](../../doc/models/billing-manifest.md) | Optional | - | getNextBillingManifest(): ?BillingManifest | setNextBillingManifest(?BillingManifest nextBillingManifest): void | -## Example (as JSON) +## Example -```json -{ - "current_billing_manifest": { - "line_items": [ - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - } - ], - "total_in_cents": 38, - "total_discount_in_cents": 24, - "total_tax_in_cents": 18, - "subtotal_in_cents": 150 - }, - "next_billing_manifest": { - "line_items": [ - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - }, - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - }, - { - "transaction_type": "credit", - "kind": "component", - "amount_in_cents": 24, - "memo": "memo2", - "discount_amount_in_cents": 172 - } - ], - "total_in_cents": 62, - "total_discount_in_cents": 208, - "total_tax_in_cents": 42, - "subtotal_in_cents": 174 - } -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionPreviewBuilder; +use AdvancedBillingLib\Models\Builders\BillingManifestBuilder; +use AdvancedBillingLib\Models\Builders\BillingManifestItemBuilder; +use AdvancedBillingLib\Models\LineItemTransactionType; +use AdvancedBillingLib\Models\BillingManifestLineItemKind; + +$subscriptionPreview = SubscriptionPreviewBuilder::init() + ->currentBillingManifest( + BillingManifestBuilder::init() + ->lineItems( + [ + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build() + ] + ) + ->totalInCents(38) + ->totalDiscountInCents(24) + ->totalTaxInCents(18) + ->subtotalInCents(150) + ->build() + ) + ->nextBillingManifest( + BillingManifestBuilder::init() + ->lineItems( + [ + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build(), + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build(), + BillingManifestItemBuilder::init() + ->transactionType(LineItemTransactionType::CREDIT) + ->kind(BillingManifestLineItemKind::COMPONENT) + ->amountInCents(24) + ->memo('memo2') + ->discountAmountInCents(172) + ->build() + ] + ) + ->totalInCents(62) + ->totalDiscountInCents(208) + ->totalTaxInCents(42) + ->subtotalInCents(174) + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-product-change.md b/doc/models/subscription-product-change.md index 7c6c3e79..dd547a79 100644 --- a/doc/models/subscription-product-change.md +++ b/doc/models/subscription-product-change.md @@ -1,6 +1,8 @@ # Subscription Product Change +Event data for both `subscription_product_change` and `subscription_product_change_scheduled`. The price point and `effective_at` fields are only populated for scheduled changes. + ## Structure `SubscriptionProductChange` @@ -11,13 +13,23 @@ | --- | --- | --- | --- | --- | --- | | `previousProductId` | `int` | Required | - | getPreviousProductId(): int | setPreviousProductId(int previousProductId): void | | `newProductId` | `int` | Required | - | getNewProductId(): int | setNewProductId(int newProductId): void | - -## Example (as JSON) - -```json -{ - "previous_product_id": 126, - "new_product_id": 12 -} +| `previousProductPricePointId` | `?int` | Optional | - | getPreviousProductPricePointId(): ?int | setPreviousProductPricePointId(?int previousProductPricePointId): void | +| `newProductPricePointId` | `?int` | Optional | - | getNewProductPricePointId(): ?int | setNewProductPricePointId(?int newProductPricePointId): void | +| `effectiveAt` | `?DateTime` | Optional | When the scheduled product change takes effect (the subscription's next renewal). Only sent for `subscription_product_change_scheduled`. | getEffectiveAt(): ?\DateTime | setEffectiveAt(?\DateTime effectiveAt): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionProductChangeBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$subscriptionProductChange = SubscriptionProductChangeBuilder::init( + 104, + 10 +) + ->previousProductPricePointId(228) + ->newProductPricePointId(222) + ->effectiveAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/subscription-product-migration-request.md b/doc/models/subscription-product-migration-request.md index e1743837..dcbf753c 100644 --- a/doc/models/subscription-product-migration-request.md +++ b/doc/models/subscription-product-migration-request.md @@ -11,18 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `migration` | [`SubscriptionProductMigration`](../../doc/models/subscription-product-migration.md) | Required | - | getMigration(): SubscriptionProductMigration | setMigration(SubscriptionProductMigration migration): void | -## Example (as JSON) - -```json -{ - "migration": { - "include_trial": false, - "include_initial_charge": false, - "include_coupons": true, - "preserve_period": false, - "product_id": 158, - "product_price_point_id": 82 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionProductMigrationRequestBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionProductMigrationBuilder; + +$subscriptionProductMigrationRequest = SubscriptionProductMigrationRequestBuilder::init( + SubscriptionProductMigrationBuilder::init() + ->productId(158) + ->productPricePointId(82) + ->includeTrial(false) + ->includeInitialCharge(false) + ->includeCoupons(true) + ->preservePeriod(false) + ->build() +)->build(); ``` diff --git a/doc/models/subscription-product-migration.md b/doc/models/subscription-product-migration.md index 39d16eef..839f7375 100644 --- a/doc/models/subscription-product-migration.md +++ b/doc/models/subscription-product-migration.md @@ -19,16 +19,18 @@ | `productPricePointHandle` | `?string` | Optional | The ID or handle of the specified product's price point. This can be passed to migrate to a non-default price point. | getProductPricePointHandle(): ?string | setProductPricePointHandle(?string productPricePointHandle): void | | `proration` | [`?Proration`](../../doc/models/proration.md) | Optional | - | getProration(): ?Proration | setProration(?Proration proration): void | -## Example (as JSON) - -```json -{ - "include_trial": false, - "include_initial_charge": false, - "include_coupons": true, - "preserve_period": false, - "product_id": 8, - "product_price_point_id": 172 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionProductMigrationBuilder; + +$subscriptionProductMigration = SubscriptionProductMigrationBuilder::init() + ->productId(44) + ->productPricePointId(224) + ->includeTrial(false) + ->includeInitialCharge(false) + ->includeCoupons(true) + ->preservePeriod(false) + ->build(); ``` diff --git a/doc/models/subscription-purge-type.md b/doc/models/subscription-purge-type.md index cd25299c..e648af43 100644 --- a/doc/models/subscription-purge-type.md +++ b/doc/models/subscription-purge-type.md @@ -12,3 +12,11 @@ | `CUSTOMER` | | `PAYMENT_PROFILE` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionPurgeType; + +$subscriptionPurgeType = SubscriptionPurgeType::CUSTOMER; +``` + diff --git a/doc/models/subscription-remove-coupon-errors-exception.md b/doc/models/subscription-remove-coupon-errors-exception.md index 841bc6fb..7c4edd82 100644 --- a/doc/models/subscription-remove-coupon-errors-exception.md +++ b/doc/models/subscription-remove-coupon-errors-exception.md @@ -11,13 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | `string[]` | Required | - | getSubscription(): array | setSubscription(array subscription): void | -## Example (as JSON) - -```json -{ - "subscription": [ - "subscription0" - ] +## Example + +```php +try { + // make the API call +} catch (SubscriptionRemoveCouponErrorsException $exp) { + echo 'Caught SubscriptionRemoveCouponErrorsException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-response-error-exception.md b/doc/models/subscription-response-error-exception.md index 10ff7041..9eb94fc6 100644 --- a/doc/models/subscription-response-error-exception.md +++ b/doc/models/subscription-response-error-exception.md @@ -11,17 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`?Subscription`](../../doc/models/subscription.md) | Optional | - | getSubscription(): ?Subscription | setSubscription(?Subscription subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "id": 8, - "state": "paused", - "balance_in_cents": 124, - "total_revenue_in_cents": 48, - "product_price_in_cents": 238 - } +## Example + +```php +try { + // make the API call +} catch (SubscriptionResponseErrorException $exp) { + echo 'Caught SubscriptionResponseErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/subscription-response.md b/doc/models/subscription-response.md index ccace2ba..702aae3d 100644 --- a/doc/models/subscription-response.md +++ b/doc/models/subscription-response.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`?Subscription`](../../doc/models/subscription.md) | Optional | - | getSubscription(): ?Subscription | setSubscription(?Subscription subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "id": 8, - "state": "paused", - "balance_in_cents": 124, - "total_revenue_in_cents": 48, - "product_price_in_cents": 238 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\SubscriptionResponseBuilder; +use AdvancedBillingLib\Models\Builders\SubscriptionBuilder; +use AdvancedBillingLib\Models\SubscriptionState; + +$subscriptionResponse = SubscriptionResponseBuilder::init() + ->subscription( + SubscriptionBuilder::init() + ->id(8) + ->state(SubscriptionState::PAUSED) + ->balanceInCents(124) + ->totalRevenueInCents(48) + ->productPriceInCents(238) + ->build() + ) + ->build(); ``` diff --git a/doc/models/subscription-sort.md b/doc/models/subscription-sort.md index b07e8ee0..157d3080 100644 --- a/doc/models/subscription-sort.md +++ b/doc/models/subscription-sort.md @@ -20,3 +20,11 @@ | `OPEN_BALANCE` | | `EXPIRES_AT` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionSort; + +$subscriptionSort = SubscriptionSort::TOTAL_PAYMENTS; +``` + diff --git a/doc/models/subscription-state-change.md b/doc/models/subscription-state-change.md index cdc86975..e07e46c1 100644 --- a/doc/models/subscription-state-change.md +++ b/doc/models/subscription-state-change.md @@ -12,12 +12,14 @@ | `previousSubscriptionState` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getPreviousSubscriptionState(): string | setPreviousSubscriptionState(string previousSubscriptionState): void | | `newSubscriptionState` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getNewSubscriptionState(): string | setNewSubscriptionState(string newSubscriptionState): void | -## Example (as JSON) +## Example -```json -{ - "previous_subscription_state": "previous_subscription_state2", - "new_subscription_state": "new_subscription_state6" -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionStateChangeBuilder; + +$subscriptionStateChange = SubscriptionStateChangeBuilder::init( + 'previous_subscription_state8', + 'new_subscription_state2' +)->build(); ``` diff --git a/doc/models/subscription-state-filter.md b/doc/models/subscription-state-filter.md index 148d4118..30454e62 100644 --- a/doc/models/subscription-state-filter.md +++ b/doc/models/subscription-state-filter.md @@ -15,12 +15,25 @@ Allowed values for filtering by the current state of the subscription. | `CANCELED` | | `EXPIRED` | | `EXPIRED_CARDS` | +| `ENUM_EXPIRED_CARDS_LIVE_SUBSCRIPTIONS` | +| `ENUM_EXPIRED_CARDS_ALL_SUBSCRIPTIONS` | | `ON_HOLD` | +| `AWAITING_SIGNUP` | +| `AWAITING_SIGNUP_DATE` | | `PAST_DUE` | | `PENDING_CANCELLATION` | | `PENDING_RENEWAL` | +| `PREPAID_DUNNING` | | `SUSPENDED` | | `TRIAL_ENDED` | | `TRIALING` | | `UNPAID` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionStateFilter; + +$subscriptionStateFilter = SubscriptionStateFilter::AWAITING_SIGNUP; +``` + diff --git a/doc/models/subscription-state.md b/doc/models/subscription-state.md index 6e893623..e94f9ea3 100644 --- a/doc/models/subscription-state.md +++ b/doc/models/subscription-state.md @@ -48,3 +48,11 @@ See [Subscription States](https://maxio.zendesk.com/hc/en-us/articles/2425211902 | `ON_HOLD` | | `AWAITING_SIGNUP` | +## Example + +```php +use AdvancedBillingLib\Models\SubscriptionState; + +$subscriptionState = SubscriptionState::AWAITING_SIGNUP; +``` + diff --git a/doc/models/subscription.md b/doc/models/subscription.md index 38234ef9..5a96b09b 100644 --- a/doc/models/subscription.md +++ b/doc/models/subscription.md @@ -13,13 +13,13 @@ | `state` | [`?string(SubscriptionState)`](../../doc/models/subscription-state.md) | Optional | The state of a subscription.

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

See [Subscription States](https://maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscription-States) for more info about subscription states and state transitions. | getState(): ?string | setState(?string state): void | | `balanceInCents` | `?int` | Optional | Gives the current outstanding subscription balance in the number of cents. | getBalanceInCents(): ?int | setBalanceInCents(?int balanceInCents): void | | `totalRevenueInCents` | `?int` | Optional | Gives the total revenue from the subscription in the number of cents. | getTotalRevenueInCents(): ?int | setTotalRevenueInCents(?int totalRevenueInCents): void | -| `productPriceInCents` | `?int` | Optional | (Added Nov 5 2013) The recurring amount of the product (and version),currently subscribed. NOTE: this may differ from the current price of,the product, if you’ve changed the price of the product but haven’t,moved this subscription to a newer version. | getProductPriceInCents(): ?int | setProductPriceInCents(?int productPriceInCents): void | +| `productPriceInCents` | `?int` | Optional | (Added Nov 5 2013) The recurring amount of the product (and version), currently subscribed. NOTE: this may differ from the current price of the product, if you’ve changed the price of the product but haven’t moved this subscription to a newer version. | getProductPriceInCents(): ?int | setProductPriceInCents(?int productPriceInCents): void | | `productVersionNumber` | `?int` | Optional | The version of the product for the subscription. Note that this is a deprecated field kept for backwards-compatibility. | getProductVersionNumber(): ?int | setProductVersionNumber(?int productVersionNumber): void | -| `currentPeriodEndsAt` | `?DateTime` | Optional | Timestamp relating to the end of the current (recurring) period (i.e.,when the next regularly scheduled attempted charge will occur) | getCurrentPeriodEndsAt(): ?\DateTime | setCurrentPeriodEndsAt(?\DateTime currentPeriodEndsAt): void | -| `nextAssessmentAt` | `?DateTime` | Optional | Timestamp that indicates when capture of payment will be tried or,retried. This value will usually track the current_period_ends_at, but,will diverge if a renewal payment fails and must be retried. In that,case, the current_period_ends_at will advance to the end of the next,period (time doesn’t stop because a payment was missed) but the,next_assessment_at will be scheduled for the auto-retry time (i.e. 24,hours in the future, in some cases) | getNextAssessmentAt(): ?\DateTime | setNextAssessmentAt(?\DateTime nextAssessmentAt): void | +| `currentPeriodEndsAt` | `?DateTime` | Optional | Timestamp relating to the end of the current (recurring) period (i.e., when the next regularly scheduled attempted charge will occur) | getCurrentPeriodEndsAt(): ?\DateTime | setCurrentPeriodEndsAt(?\DateTime currentPeriodEndsAt): void | +| `nextAssessmentAt` | `?DateTime` | Optional | Timestamp that indicates when capture of payment will be tried or retried. This value will usually track the current_period_ends_at, but will diverge if a renewal payment fails and must be retried. In that case, the current_period_ends_at will advance to the end of the next period (time doesn’t stop because a payment was missed) but the next_assessment_at will be scheduled for the auto-retry time (e.g., 24 hours in the future, in some cases). | getNextAssessmentAt(): ?\DateTime | setNextAssessmentAt(?\DateTime nextAssessmentAt): void | | `trialStartedAt` | `?DateTime` | Optional | Timestamp for when the trial period (if any) began | getTrialStartedAt(): ?\DateTime | setTrialStartedAt(?\DateTime trialStartedAt): void | | `trialEndedAt` | `?DateTime` | Optional | Timestamp for when the trial period (if any) ended | getTrialEndedAt(): ?\DateTime | setTrialEndedAt(?\DateTime trialEndedAt): void | -| `activatedAt` | `?DateTime` | Optional | Timestamp for when the subscription began (i.e. when it came out of trial, or when it began in the case of no trial) | getActivatedAt(): ?\DateTime | setActivatedAt(?\DateTime activatedAt): void | +| `activatedAt` | `?DateTime` | Optional | Timestamp for when the subscription began (i.e., when it came out of trial, or when it began in the case of no trial) | getActivatedAt(): ?\DateTime | setActivatedAt(?\DateTime activatedAt): void | | `expiresAt` | `?DateTime` | Optional | Timestamp giving the expiration date of this subscription (if any) | getExpiresAt(): ?\DateTime | setExpiresAt(?\DateTime expiresAt): void | | `createdAt` | `?DateTime` | Optional | The creation date for this subscription | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `updatedAt` | `?DateTime` | Optional | The date of last update for this subscription | getUpdatedAt(): ?\DateTime | setUpdatedAt(?\DateTime updatedAt): void | @@ -28,9 +28,9 @@ | `cancelAtEndOfPeriod` | `?bool` | Optional | Whether or not the subscription will (or has) canceled at the end of the period. | getCancelAtEndOfPeriod(): ?bool | setCancelAtEndOfPeriod(?bool cancelAtEndOfPeriod): void | | `canceledAt` | `?DateTime` | Optional | The timestamp of the most recent cancellation | getCanceledAt(): ?\DateTime | setCanceledAt(?\DateTime canceledAt): void | | `currentPeriodStartedAt` | `?DateTime` | Optional | Timestamp relating to the start of the current (recurring) period | getCurrentPeriodStartedAt(): ?\DateTime | setCurrentPeriodStartedAt(?\DateTime currentPeriodStartedAt): void | -| `previousState` | [`?string(SubscriptionState)`](../../doc/models/subscription-state.md) | Optional | Only valid for webhook payloads The previous state for webhooks that have indicated a change in state. For normal API calls, this will always be the same as the state (current state) | getPreviousState(): ?string | setPreviousState(?string previousState): void | +| `previousState` | [`?string(SubscriptionState)`](../../doc/models/subscription-state.md) | Optional | Only valid for webhook payloads The previous state for webhooks that have indicated a change in state. For normal API calls, this will always be the same as the state (current state). | getPreviousState(): ?string | setPreviousState(?string previousState): void | | `signupPaymentId` | `?int` | Optional | The ID of the transaction that generated the revenue | getSignupPaymentId(): ?int | setSignupPaymentId(?int signupPaymentId): void | -| `signupRevenue` | `?string` | Optional | The revenue, formatted as a string of decimal separated dollars and,cents, from the subscription signup ($50.00 would be formatted as,50.00) | getSignupRevenue(): ?string | setSignupRevenue(?string signupRevenue): void | +| `signupRevenue` | `?string` | Optional | The revenue, formatted as a string of decimal separated dollars and cents, from the subscription signup ($50.00 would be formatted as 50.00) | getSignupRevenue(): ?string | setSignupRevenue(?string signupRevenue): void | | `delayedCancelAt` | `?DateTime` | Optional | Timestamp for when the subscription is currently set to cancel. | getDelayedCancelAt(): ?\DateTime | setDelayedCancelAt(?\DateTime delayedCancelAt): 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 | | `snapDay` | `?string` | Optional | A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'. | getSnapDay(): ?string | setSnapDay(?string snapDay): void | @@ -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 | The churn reason code associated to a cancelled subscription. | getReasonCode(): ?string | setReasonCode(?string reasonCode): void | +| `reasonCode` | `?string` | Optional | The churn reason code associated to a canceled 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,10 +57,10 @@ | `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 istelf. | getReference(): ?string | setReference(?string reference): void | +| `reference` | `?string` | Optional | The reference value (provided by your app) for the subscription itself. | 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 | +| `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 | | `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 | | `receivesInvoiceEmails` | `?bool` | Optional | - | getReceivesInvoiceEmails(): ?bool | setReceivesInvoiceEmails(?bool receivesInvoiceEmails): void | @@ -72,38 +72,48 @@ | `prepaidConfiguration` | [`?PrepaidConfiguration`](../../doc/models/prepaid-configuration.md) | Optional | - | getPrepaidConfiguration(): ?PrepaidConfiguration | setPrepaidConfiguration(?PrepaidConfiguration prepaidConfiguration): void | | `selfServicePageToken` | `?string` | Optional | Returned only for list/read Subscription operation when `include[]=self_service_page_token` parameter is provided. | getSelfServicePageToken(): ?string | setSelfServicePageToken(?string selfServicePageToken): void | -## Example (as JSON) +## Example -```json -{ - "credit_card": { - "id": 10088716, - "first_name": "Test", - "last_name": "Subscription", - "masked_card_number": "XXXX-XXXX-XXXX-1", - "card_type": "bogus", - "expiration_month": 1, - "expiration_year": 2022, - "customer_id": 14543792, - "current_vault": "bogus", - "vault_token": "1", - "billing_address": "123 Montana Way", - "billing_city": "Billings", - "billing_state": "MT", - "billing_zip": "59101", - "billing_country": "US", - "customer_vault_token": null, - "billing_address_2": "", - "payment_type": "credit_card", - "site_gateway_setting_id": 1, - "gateway_handle": null - }, - "dunning_communication_delay_time_zone": "\"Eastern Time (US & Canada)\"", - "id": 96, - "state": "soft_failure", - "balance_in_cents": 212, - "total_revenue_in_cents": 136, - "product_price_in_cents": 70 -} +```php +use AdvancedBillingLib\Models\Builders\SubscriptionBuilder; +use AdvancedBillingLib\Models\SubscriptionState; +use AdvancedBillingLib\Models\Builders\CreditCardPaymentProfileBuilder; +use AdvancedBillingLib\Models\PaymentType; +use AdvancedBillingLib\Models\CardType; +use AdvancedBillingLib\Models\CreditCardVault; + +$subscription = SubscriptionBuilder::init() + ->id(8) + ->state(SubscriptionState::PAUSED) + ->balanceInCents(124) + ->totalRevenueInCents(48) + ->productPriceInCents(238) + ->creditCard( + CreditCardPaymentProfileBuilder::init( + PaymentType::CREDIT_CARD + ) + ->id(10088716) + ->firstName('Test') + ->lastName('Subscription') + ->maskedCardNumber('XXXX-XXXX-XXXX-1') + ->cardType(CardType::BOGUS) + ->expirationMonth(1) + ->expirationYear(2022) + ->customerId(14543792) + ->currentVault(CreditCardVault::BOGUS) + ->vaultToken('1') + ->billingAddress('123 Montana Way') + ->billingCity('Billings') + ->billingState('MT') + ->billingZip('59101') + ->billingCountry('US') + ->customerVaultToken('customer_vault_token2') + ->billingAddress2('') + ->siteGatewaySettingId(1) + ->gatewayHandle('gateway_handle8') + ->build() + ) + ->dunningCommunicationDelayTimeZone('"Eastern Time (US & Canada)"') + ->build(); ``` diff --git a/doc/models/subscriptions-mrr-error-response-exception.md b/doc/models/subscriptions-mrr-error-response-exception.md index a95ced9b..7776e696 100644 --- a/doc/models/subscriptions-mrr-error-response-exception.md +++ b/doc/models/subscriptions-mrr-error-response-exception.md @@ -11,15 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`AttributeError`](../../doc/models/attribute-error.md) | Required | - | getErrors(): AttributeError | setErrors(AttributeError errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "attribute": [ - "supplied value is invalid, expected ISO 8601 format" - ] - } +## Example + +```php +try { + // make the API call +} catch (SubscriptionsMrrErrorResponseException $exp) { + echo 'Caught SubscriptionsMrrErrorResponseException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/tax-configuration-kind.md b/doc/models/tax-configuration-kind.md index ef95cf08..e18cef10 100644 --- a/doc/models/tax-configuration-kind.md +++ b/doc/models/tax-configuration-kind.md @@ -14,3 +14,11 @@ | `ENUM_LINKED_AVALARA` | | `ENUM_DIGITAL_RIVER` | +## Example + +```php +use AdvancedBillingLib\Models\TaxConfigurationKind; + +$taxConfigurationKind = TaxConfigurationKind::CUSTOM; +``` + diff --git a/doc/models/tax-configuration.md b/doc/models/tax-configuration.md index 9ba99785..b4b49c9a 100644 --- a/doc/models/tax-configuration.md +++ b/doc/models/tax-configuration.md @@ -13,13 +13,17 @@ | `destinationAddress` | [`?string(TaxDestinationAddress)`](../../doc/models/tax-destination-address.md) | Optional | - | getDestinationAddress(): ?string | setDestinationAddress(?string destinationAddress): void | | `fullyConfigured` | `?bool` | Optional | Returns `true` when Chargify has been properly configured to charge tax using the specified tax system. More details about taxes: https://maxio.zendesk.com/hc/en-us/articles/24287012608909-Taxes-Overview

**Default**: `false` | getFullyConfigured(): ?bool | setFullyConfigured(?bool fullyConfigured): void | -## Example (as JSON) - -```json -{ - "kind": "custom", - "fully_configured": false, - "destination_address": "shipping_only" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\TaxConfigurationBuilder; +use AdvancedBillingLib\Models\TaxConfigurationKind; +use AdvancedBillingLib\Models\TaxDestinationAddress; + +$taxConfiguration = TaxConfigurationBuilder::init() + ->kind(TaxConfigurationKind::CUSTOM) + ->destinationAddress(TaxDestinationAddress::SHIPPING_ONLY) + ->fullyConfigured(false) + ->build(); ``` diff --git a/doc/models/tax-destination-address.md b/doc/models/tax-destination-address.md index f2a5b2ac..ae42bc86 100644 --- a/doc/models/tax-destination-address.md +++ b/doc/models/tax-destination-address.md @@ -14,3 +14,11 @@ | `SHIPPING_ONLY` | | `BILLING_ONLY` | +## Example + +```php +use AdvancedBillingLib\Models\TaxDestinationAddress; + +$taxDestinationAddress = TaxDestinationAddress::SHIPPING_ONLY; +``` + diff --git a/doc/models/tokenized-payment-profile.md b/doc/models/tokenized-payment-profile.md index 7b4957a8..f2731e26 100644 --- a/doc/models/tokenized-payment-profile.md +++ b/doc/models/tokenized-payment-profile.md @@ -14,14 +14,17 @@ | `gatewayHandle` | `?string` | Optional | - | getGatewayHandle(): ?string | setGatewayHandle(?string gatewayHandle): void | | `customerVaultToken` | `?string` | Optional | - | getCustomerVaultToken(): ?string | setCustomerVaultToken(?string customerVaultToken): void | -## Example (as JSON) - -```json -{ - "id": 72, - "vault_token": "vault_token2", - "gateway_handle": "gateway_handle8", - "customer_vault_token": "customer_vault_token8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\TokenizedPaymentProfileBuilder; + +$tokenizedPaymentProfile = TokenizedPaymentProfileBuilder::init( + 116 +) + ->vaultToken('vault_token0') + ->gatewayHandle('gateway_handle0') + ->customerVaultToken('customer_vault_token6') + ->build(); ``` diff --git a/doc/models/too-many-management-link-requests-error-exception.md b/doc/models/too-many-management-link-requests-error-exception.md index 2e0b4005..f3e9f56f 100644 --- a/doc/models/too-many-management-link-requests-error-exception.md +++ b/doc/models/too-many-management-link-requests-error-exception.md @@ -11,14 +11,15 @@ | --- | --- | --- | --- | --- | --- | | `errors` | [`TooManyManagementLinkRequests`](../../doc/models/too-many-management-link-requests.md) | Required | - | getErrors(): TooManyManagementLinkRequests | setErrors(TooManyManagementLinkRequests errors): void | -## Example (as JSON) - -```json -{ - "errors": { - "error": "error4", - "new_link_available_at": "2016-03-13T12:52:32.123Z" - } +## Example + +```php +try { + // make the API call +} catch (TooManyManagementLinkRequestsErrorException $exp) { + echo 'Caught TooManyManagementLinkRequestsErrorException:', $exp; +} catch (ApiException $exp) { + echo 'Caught ApiException:', $exp; } ``` diff --git a/doc/models/too-many-management-link-requests.md b/doc/models/too-many-management-link-requests.md index 65901932..f5fcd67e 100644 --- a/doc/models/too-many-management-link-requests.md +++ b/doc/models/too-many-management-link-requests.md @@ -12,12 +12,15 @@ | `error` | `string` | Required | - | getError(): string | setError(string error): void | | `newLinkAvailableAt` | `DateTime` | Required | - | getNewLinkAvailableAt(): \DateTime | setNewLinkAvailableAt(\DateTime newLinkAvailableAt): void | -## Example (as JSON) +## Example -```json -{ - "error": "error2", - "new_link_available_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\TooManyManagementLinkRequestsBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$tooManyManagementLinkRequests = TooManyManagementLinkRequestsBuilder::init( + 'error8', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); ``` diff --git a/doc/models/trial-type.md b/doc/models/trial-type.md index 1298d99b..c3ba5fe3 100644 --- a/doc/models/trial-type.md +++ b/doc/models/trial-type.md @@ -1,7 +1,7 @@ # Trial Type -Indicates how a trial is handled when the trail period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. +Indicates how a trial is handled when the trial period ends and there is no credit card on file. For `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will send normal dunning emails and statements according to your other settings. ## Enumeration @@ -14,3 +14,11 @@ Indicates how a trial is handled when the trail period ends and there is no cred | `NO_OBLIGATION` | | `PAYMENT_EXPECTED` | +## Example + +```php +use AdvancedBillingLib\Models\TrialType; + +$trialType = TrialType::NO_OBLIGATION; +``` + diff --git a/doc/models/update-allocation-expiration-date.md b/doc/models/update-allocation-expiration-date.md index 09a981d5..cce99a8f 100644 --- a/doc/models/update-allocation-expiration-date.md +++ b/doc/models/update-allocation-expiration-date.md @@ -11,13 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `allocation` | [`?AllocationExpirationDate`](../../doc/models/allocation-expiration-date.md) | Optional | - | getAllocation(): ?AllocationExpirationDate | setAllocation(?AllocationExpirationDate allocation): void | -## Example (as JSON) - -```json -{ - "allocation": { - "expires_at": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateAllocationExpirationDateBuilder; +use AdvancedBillingLib\Models\Builders\AllocationExpirationDateBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$updateAllocationExpirationDate = UpdateAllocationExpirationDateBuilder::init() + ->allocation( + AllocationExpirationDateBuilder::init() + ->expiresAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build(); ``` diff --git a/doc/models/update-component-price-point-request.md b/doc/models/update-component-price-point-request.md index 84db4aa1..db1ebd2b 100644 --- a/doc/models/update-component-price-point-request.md +++ b/doc/models/update-component-price-point-request.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `pricePoint` | [`?UpdateComponentPricePoint`](../../doc/models/update-component-price-point.md) | Optional | - | getPricePoint(): ?UpdateComponentPricePoint | setPricePoint(?UpdateComponentPricePoint pricePoint): void | -## Example (as JSON) - -```json -{ - "price_point": { - "name": "name0", - "handle": "handle6", - "pricing_scheme": "per_unit", - "use_site_exchange_rate": false, - "tax_included": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateComponentPricePointRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricingScheme; + +$updateComponentPricePointRequest = UpdateComponentPricePointRequestBuilder::init() + ->pricePoint( + UpdateComponentPricePointBuilder::init() + ->name('name0') + ->handle('handle6') + ->pricingScheme(PricingScheme::PER_UNIT) + ->useSiteExchangeRate(false) + ->taxIncluded(false) + ->build() + ) + ->build(); ``` diff --git a/doc/models/update-component-price-point.md b/doc/models/update-component-price-point.md index b2fbe3d0..380ed95a 100644 --- a/doc/models/update-component-price-point.md +++ b/doc/models/update-component-price-point.md @@ -14,19 +14,22 @@ | `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 | | `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. | getUseSiteExchangeRate(): ?bool | setUseSiteExchangeRate(?bool useSiteExchangeRate): void | | `taxIncluded` | `?bool` | Optional | Whether or not the price point includes tax | 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 | +| `interval` | `?int` | Optional | The numerical interval. e.g., 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` | [`?(UpdatePrice[])`](../../doc/models/update-price.md) | Optional | - | getPrices(): ?array | setPrices(?array prices): void | -## Example (as JSON) +## Example -```json -{ - "name": "name2", - "handle": "handle8", - "pricing_scheme": "per_unit", - "use_site_exchange_rate": false, - "tax_included": false -} +```php +use AdvancedBillingLib\Models\Builders\UpdateComponentPricePointBuilder; +use AdvancedBillingLib\Models\PricingScheme; + +$updateComponentPricePoint = UpdateComponentPricePointBuilder::init() + ->name('name4') + ->handle('handle0') + ->pricingScheme(PricingScheme::STAIRSTEP) + ->useSiteExchangeRate(false) + ->taxIncluded(false) + ->build(); ``` diff --git a/doc/models/update-component-request.md b/doc/models/update-component-request.md index dc756c84..af148a6b 100644 --- a/doc/models/update-component-request.md +++ b/doc/models/update-component-request.md @@ -11,18 +11,22 @@ | --- | --- | --- | --- | --- | --- | | `component` | [`UpdateComponent`](../../doc/models/update-component.md) | Required | - | getComponent(): UpdateComponent | setComponent(UpdateComponent component): void | -## Example (as JSON) - -```json -{ - "component": { - "item_category": "Business Software", - "handle": "handle4", - "name": "name8", - "description": "description2", - "accounting_code": "accounting_code4", - "taxable": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateComponentRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateComponentBuilder; +use AdvancedBillingLib\Models\ItemCategory; + +$updateComponentRequest = UpdateComponentRequestBuilder::init( + UpdateComponentBuilder::init() + ->handle('handle4') + ->name('name8') + ->description('description2') + ->accountingCode('accounting_code4') + ->taxable(false) + ->itemCategory(ItemCategory::ENUM_BUSINESS_SOFTWARE) + ->build() +)->build(); ``` diff --git a/doc/models/update-component.md b/doc/models/update-component.md index 0953d5b8..986d2294 100644 --- a/doc/models/update-component.md +++ b/doc/models/update-component.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | -| `name` | `?string` | Optional | The name of the Component, suitable for display on statements. i.e. Text Messages. | getName(): ?string | setName(?string name): void | +| `name` | `?string` | Optional | The name of the Component, suitable for display on statements. e.g., Text Messages. | getName(): ?string | setName(?string name): void | | `description` | `?string` | Optional | The description of the component. | getDescription(): ?string | setDescription(?string description): void | | `accountingCode` | `?string` | Optional | - | getAccountingCode(): ?string | setAccountingCode(?string accountingCode): void | | `taxable` | `?bool` | Optional | Boolean flag describing whether a component is taxable or not. | getTaxable(): ?bool | setTaxable(?bool taxable): void | @@ -18,17 +18,21 @@ | `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. | getUpgradeCharge(): ?string | setUpgradeCharge(?string upgradeCharge): void | - -## Example (as JSON) - -```json -{ - "item_category": "Business Software", - "handle": "handle6", - "name": "name0", - "description": "description0", - "accounting_code": "accounting_code6", - "taxable": false -} +| `unspscCode` | `?string` | Optional | (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent as the commodity code on invoice line items for this component instead of the default derived from item_category. | getUnspscCode(): ?string | setUnspscCode(?string unspscCode): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateComponentBuilder; +use AdvancedBillingLib\Models\ItemCategory; + +$updateComponent = UpdateComponentBuilder::init() + ->handle('handle4') + ->name('name8') + ->description('description8') + ->accountingCode('accounting_code4') + ->taxable(false) + ->itemCategory(ItemCategory::ENUM_BUSINESS_SOFTWARE) + ->build(); ``` diff --git a/doc/models/update-coupon-currency.md b/doc/models/update-coupon-currency.md index 84bda50e..5e64be3c 100644 --- a/doc/models/update-coupon-currency.md +++ b/doc/models/update-coupon-currency.md @@ -12,12 +12,14 @@ | `currency` | `string` | Required | ISO code for the site defined currency. | getCurrency(): string | setCurrency(string currency): void | | `price` | `int` | Required | Price for the given currency. | getPrice(): int | setPrice(int price): void | -## Example (as JSON) +## Example -```json -{ - "currency": "currency4", - "price": 146 -} +```php +use AdvancedBillingLib\Models\Builders\UpdateCouponCurrencyBuilder; + +$updateCouponCurrency = UpdateCouponCurrencyBuilder::init( + 'currency4', + 100 +)->build(); ``` diff --git a/doc/models/update-currency-price.md b/doc/models/update-currency-price.md index c33e0cf8..1a275480 100644 --- a/doc/models/update-currency-price.md +++ b/doc/models/update-currency-price.md @@ -12,12 +12,14 @@ | `id` | `int` | Required | ID of the currency price record being updated | getId(): int | setId(int id): void | | `price` | `float` | Required | New price for the given currency | getPrice(): float | setPrice(float price): void | -## Example (as JSON) +## Example -```json -{ - "id": 146, - "price": 71.86 -} +```php +use AdvancedBillingLib\Models\Builders\UpdateCurrencyPriceBuilder; + +$updateCurrencyPrice = UpdateCurrencyPriceBuilder::init( + 104, + 163.6 +)->build(); ``` diff --git a/doc/models/update-currency-prices-request.md b/doc/models/update-currency-prices-request.md index af37d5f6..fbb223b3 100644 --- a/doc/models/update-currency-prices-request.md +++ b/doc/models/update-currency-prices-request.md @@ -11,16 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `currencyPrices` | [`UpdateCurrencyPrice[]`](../../doc/models/update-currency-price.md) | Required | - | getCurrencyPrices(): array | setCurrencyPrices(array currencyPrices): void | -## Example (as JSON) - -```json -{ - "currency_prices": [ - { - "id": 50, - "price": 233.74 - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateCurrencyPricesRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateCurrencyPriceBuilder; + +$updateCurrencyPricesRequest = UpdateCurrencyPricesRequestBuilder::init( + [ + UpdateCurrencyPriceBuilder::init( + 50, + 233.74 + )->build() + ] +)->build(); ``` diff --git a/doc/models/update-customer-request.md b/doc/models/update-customer-request.md index 300d3b52..9cf7352d 100644 --- a/doc/models/update-customer-request.md +++ b/doc/models/update-customer-request.md @@ -11,17 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `customer` | [`UpdateCustomer`](../../doc/models/update-customer.md) | Required | - | getCustomer(): UpdateCustomer | setCustomer(UpdateCustomer customer): void | -## Example (as JSON) - -```json -{ - "customer": { - "first_name": "first_name0", - "last_name": "last_name8", - "email": "email6", - "cc_emails": "cc_emails0", - "organization": "organization6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateCustomerRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateCustomerBuilder; + +$updateCustomerRequest = UpdateCustomerRequestBuilder::init( + UpdateCustomerBuilder::init() + ->firstName('first_name0') + ->lastName('last_name8') + ->email('email6') + ->ccEmails('cc_emails0') + ->organization('organization6') + ->build() +)->build(); ``` diff --git a/doc/models/update-customer.md b/doc/models/update-customer.md index dc4aa328..1393f58d 100644 --- a/doc/models/update-customer.md +++ b/doc/models/update-customer.md @@ -25,20 +25,24 @@ | `locale` | `?string` | Optional | Set a specific language on a customer record. | getLocale(): ?string | setLocale(?string locale): void | | `vatNumber` | `?string` | Optional | - | getVatNumber(): ?string | setVatNumber(?string vatNumber): void | | `taxExempt` | `?bool` | Optional | - | getTaxExempt(): ?bool | setTaxExempt(?bool taxExempt): void | +| `surcharging` | `?bool` | Optional | Whether surcharging is enabled for the customer. Only applied on sites where surcharging control is enabled. | getSurcharging(): ?bool | setSurcharging(?bool surcharging): void | | `taxExemptReason` | `?string` | Optional | - | getTaxExemptReason(): ?string | setTaxExemptReason(?string taxExemptReason): void | | `parentId` | `?int` | Optional | - | getParentId(): ?int | setParentId(?int parentId): void | -| `verified` | `?bool` | Optional | Is the customer verified to use ACH as a payment method. Available only on Authorize.Net gateway | getVerified(): ?bool | setVerified(?bool verified): void | +| `verified` | `?bool` | Optional | Is the customer verified to use ACH as a payment method. Available only on the Authorize.Net gateway. | getVerified(): ?bool | setVerified(?bool verified): void | | `salesforceId` | `?string` | Optional | The Salesforce ID of the customer | getSalesforceId(): ?string | setSalesforceId(?string salesforceId): void | +| `brandingThemeId` | `?int` | Optional | The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. This customer-level Branding Theme is used when a subscription does not have its own subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. | getBrandingThemeId(): ?int | setBrandingThemeId(?int brandingThemeId): void | -## Example (as JSON) +## Example -```json -{ - "first_name": "first_name2", - "last_name": "last_name0", - "email": "email4", - "cc_emails": "cc_emails8", - "organization": "organization6" -} +```php +use AdvancedBillingLib\Models\Builders\UpdateCustomerBuilder; + +$updateCustomer = UpdateCustomerBuilder::init() + ->firstName('first_name2') + ->lastName('last_name0') + ->email('email4') + ->ccEmails('cc_emails8') + ->organization('organization6') + ->build(); ``` diff --git a/doc/models/update-invoice-item.md b/doc/models/update-invoice-item.md new file mode 100644 index 00000000..671b78df --- /dev/null +++ b/doc/models/update-invoice-item.md @@ -0,0 +1,46 @@ + +# Update Invoice Item + +A line item change for a draft ad hoc invoice. Supports the same attributes as line items on invoice creation, plus `uid` and `_destroy` for updating or removing existing line items. + +## Structure + +`UpdateInvoiceItem` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `title` | `?string` | Optional | - | getTitle(): ?string | setTitle(?string title): void | +| `quantity` | float\|string\|null | Optional | This is a container for one-of cases. | getQuantity(): | setQuantity( quantity): void | +| `unitPrice` | float\|string\|null | Optional | This is a container for one-of cases. | getUnitPrice(): | setUnitPrice( unitPrice): void | +| `taxable` | `?bool` | Optional | Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. If using AvaTax, a tax_code parameter must also be sent. | getTaxable(): ?bool | setTaxable(?bool taxable): void | +| `taxCode` | `?string` | Optional | A string representing the tax code related to the product type. This is especially important when using AvaTax to tax based on locale. This attribute has a max length of 25 characters. | getTaxCode(): ?string | setTaxCode(?string taxCode): void | +| `periodRangeStart` | `?string` | Optional | YYYY-MM-DD | getPeriodRangeStart(): ?string | setPeriodRangeStart(?string periodRangeStart): void | +| `periodRangeEnd` | `?string` | Optional | YYYY-MM-DD | getPeriodRangeEnd(): ?string | setPeriodRangeEnd(?string periodRangeEnd): void | +| `productId` | string\|int\|null | Optional | This is a container for one-of cases. | getProductId(): | setProductId( productId): void | +| `componentId` | string\|int\|null | Optional | This is a container for one-of cases. | getComponentId(): | setComponentId( componentId): void | +| `pricePointId` | string\|int\|null | Optional | This is a container for one-of cases. | getPricePointId(): | setPricePointId( pricePointId): void | +| `productPricePointId` | string\|int\|null | Optional | This is a container for one-of cases. | getProductPricePointId(): | setProductPricePointId( productPricePointId): void | +| `description` | `?string` | Optional | **Constraints**: *Maximum Length*: `255` | getDescription(): ?string | setDescription(?string description): void | +| `uid` | `?string` | Optional | Unique identifier of an existing line item on the invoice. When provided, the matching line item is updated with the submitted attributes. When omitted, a new line item is added to the invoice. | getUid(): ?string | setUid(?string uid): void | +| `destroy` | `?bool` | Optional | Set to `true` together with `uid` to remove the matching line item from the invoice. Line items not referenced in the request remain unchanged. | getDestroy(): ?bool | setDestroy(?bool destroy): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateInvoiceItemBuilder; + +$updateInvoiceItem = UpdateInvoiceItemBuilder::init() + ->title('title8') + ->quantity( + 94.82 + ) + ->unitPrice( + 78.04 + ) + ->taxable(false) + ->taxCode('tax_code0') + ->build(); +``` + diff --git a/doc/models/update-invoice-request.md b/doc/models/update-invoice-request.md new file mode 100644 index 00000000..9d613c07 --- /dev/null +++ b/doc/models/update-invoice-request.md @@ -0,0 +1,70 @@ + +# Update Invoice Request + +Request payload for updating a draft ad hoc invoice. + +## Structure + +`UpdateInvoiceRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `invoice` | [`UpdateInvoice`](../../doc/models/update-invoice.md) | Required | Attributes of a draft ad hoc invoice which can be updated. Only the submitted attributes are changed. | getInvoice(): UpdateInvoice | setInvoice(UpdateInvoice invoice): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateInvoiceRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateInvoiceBuilder; +use AdvancedBillingLib\Models\Builders\UpdateInvoiceItemBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$updateInvoiceRequest = UpdateInvoiceRequestBuilder::init( + UpdateInvoiceBuilder::init() + ->lineItems( + [ + UpdateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build(), + UpdateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build(), + UpdateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build() + ] + ) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->netTerms(144) + ->paymentInstructions('payment_instructions6') + ->memo('memo0') + ->build() +)->build(); +``` + diff --git a/doc/models/update-invoice.md b/doc/models/update-invoice.md new file mode 100644 index 00000000..83d47e82 --- /dev/null +++ b/doc/models/update-invoice.md @@ -0,0 +1,53 @@ + +# Update Invoice + +Attributes of a draft ad hoc invoice which can be updated. Only the submitted attributes are changed. + +## Structure + +`UpdateInvoice` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `lineItems` | [`?(UpdateInvoiceItem[])`](../../doc/models/update-invoice-item.md) | Optional | Line item changes to apply. Line items without a `uid` are added, line items with a `uid` are updated, and line items with a `uid` and `_destroy` set to `true` are removed. Existing line items not referenced in the array remain unchanged. | getLineItems(): ?array | setLineItems(?array lineItems): void | +| `issueDate` | `?DateTime` | Optional | New issue date for the invoice (format YYYY-MM-DD). This date is interpreted and validated in your site's time zone. It must be today or a date in the past — future dates are not accepted. The due date is recalculated from the issue date and net terms. | getIssueDate(): ?\DateTime | setIssueDate(?\DateTime issueDate): void | +| `netTerms` | `?int` | Optional | Number of days after the issue date on which the invoice is due. The due date is recalculated when net terms or the issue date change. | getNetTerms(): ?int | setNetTerms(?int netTerms): void | +| `paymentInstructions` | `?string` | Optional | Custom payment instructions displayed on the invoice. | getPaymentInstructions(): ?string | setPaymentInstructions(?string paymentInstructions): void | +| `memo` | `?string` | Optional | A custom memo displayed on the invoice. | getMemo(): ?string | setMemo(?string memo): void | +| `sellerAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Replaces the seller address on the invoice | getSellerAddress(): ?CreateInvoiceAddress | setSellerAddress(?CreateInvoiceAddress sellerAddress): void | +| `billingAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Replaces the billing address on the invoice | getBillingAddress(): ?CreateInvoiceAddress | setBillingAddress(?CreateInvoiceAddress billingAddress): void | +| `shippingAddress` | [`?CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Replaces the shipping address on the invoice | getShippingAddress(): ?CreateInvoiceAddress | setShippingAddress(?CreateInvoiceAddress shippingAddress): void | +| `coupons` | [`?(CreateInvoiceCoupon[])`](../../doc/models/create-invoice-coupon.md) | Optional | When present, replaces all discounts currently applied to the invoice. Send an empty array to remove all discounts. | getCoupons(): ?array | setCoupons(?array coupons): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateInvoiceBuilder; +use AdvancedBillingLib\Models\Builders\UpdateInvoiceItemBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$updateInvoice = UpdateInvoiceBuilder::init() + ->lineItems( + [ + UpdateInvoiceItemBuilder::init() + ->title('title4') + ->quantity( + 56.68 + ) + ->unitPrice( + 39.9 + ) + ->taxable(false) + ->taxCode('tax_code6') + ->build() + ] + ) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->netTerms(46) + ->paymentInstructions('payment_instructions6') + ->memo('memo2') + ->build(); +``` + diff --git a/doc/models/update-metadata-request.md b/doc/models/update-metadata-request.md index e9893ee0..c75d2a99 100644 --- a/doc/models/update-metadata-request.md +++ b/doc/models/update-metadata-request.md @@ -11,15 +11,20 @@ | --- | --- | --- | --- | --- | --- | | `metadata` | [`?UpdateMetadata`](../../doc/models/update-metadata.md) | Optional | - | getMetadata(): ?UpdateMetadata | setMetadata(?UpdateMetadata metadata): void | -## Example (as JSON) - -```json -{ - "metadata": { - "current_name": "current_name0", - "name": "name6", - "value": "value8" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateMetadataRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateMetadataBuilder; + +$updateMetadataRequest = UpdateMetadataRequestBuilder::init() + ->metadata( + UpdateMetadataBuilder::init() + ->currentName('current_name0') + ->name('name6') + ->value('value8') + ->build() + ) + ->build(); ``` diff --git a/doc/models/update-metadata.md b/doc/models/update-metadata.md index 5890aa04..31991576 100644 --- a/doc/models/update-metadata.md +++ b/doc/models/update-metadata.md @@ -13,13 +13,15 @@ | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `value` | `?string` | Optional | - | getValue(): ?string | setValue(?string value): void | -## Example (as JSON) - -```json -{ - "current_name": "current_name4", - "name": "name0", - "value": "value2" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateMetadataBuilder; + +$updateMetadata = UpdateMetadataBuilder::init() + ->currentName('current_name8') + ->name('name4') + ->value('value6') + ->build(); ``` diff --git a/doc/models/update-metafield.md b/doc/models/update-metafield.md index 06a7fd76..3f644a23 100644 --- a/doc/models/update-metafield.md +++ b/doc/models/update-metafield.md @@ -12,26 +12,37 @@ | `currentName` | `?string` | Optional | - | getCurrentName(): ?string | setCurrentName(?string currentName): void | | `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void | | `scope` | [`?MetafieldScope`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. | getScope(): ?MetafieldScope | setScope(?MetafieldScope scope): void | -| `inputType` | [`?string(MetafieldInput)`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | getInputType(): ?string | setInputType(?string inputType): void | +| `inputType` | [`?string(MetafieldInput)`](../../doc/models/metafield-input.md) | Optional | Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio metafields have a set of values that can be selected. Defaults to 'text'. | getInputType(): ?string | setInputType(?string inputType): void | | `enum` | `?(string[])` | Optional | Only applicable when input_type is radio or dropdown. | getEnum(): ?array | setEnum(?array enum): void | -## Example (as JSON) - -```json -{ - "current_name": "current_name0", - "name": "name6", - "scope": { - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0" - }, - "input_type": "balance_tracker", - "enum": [ - "enum2" - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateMetafieldBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; +use AdvancedBillingLib\Models\MetafieldInput; + +$updateMetafield = UpdateMetafieldBuilder::init() + ->currentName('current_name6') + ->name('name2') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build() + ) + ->inputType(MetafieldInput::RADIO) + ->enum( + [ + 'enum8', + 'enum9', + 'enum0' + ] + ) + ->build(); ``` diff --git a/doc/models/update-metafields-request.md b/doc/models/update-metafields-request.md index d28c7f89..e02c05ba 100644 --- a/doc/models/update-metafields-request.md +++ b/doc/models/update-metafields-request.md @@ -11,25 +11,37 @@ | --- | --- | --- | --- | --- | --- | | `metafields` | [UpdateMetafield](../../doc/models/update-metafield.md)\|[UpdateMetafield](../../doc/models/update-metafield.md)[]\|null | Optional | This is a container for one-of cases. | getMetafields(): | setMetafields( metafields): void | -## Example (as JSON) - -```json -{ - "metafields": { - "current_name": "current_name0", - "name": "name6", - "scope": { - "csv": "0", - "invoices": "0", - "statements": "0", - "portal": "0", - "public_show": "0" - }, - "input_type": "balance_tracker", - "enum": [ - "enum2" - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateMetafieldsRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateMetafieldBuilder; +use AdvancedBillingLib\Models\Builders\MetafieldScopeBuilder; +use AdvancedBillingLib\Models\IncludeOption; +use AdvancedBillingLib\Models\MetafieldInput; + +$updateMetafieldsRequest = UpdateMetafieldsRequestBuilder::init() + ->metafields( + UpdateMetafieldBuilder::init() + ->currentName('current_name0') + ->name('name6') + ->scope( + MetafieldScopeBuilder::init() + ->csv(IncludeOption::EXCLUDE) + ->invoices(IncludeOption::EXCLUDE) + ->statements(IncludeOption::EXCLUDE) + ->portal(IncludeOption::EXCLUDE) + ->publicShow(IncludeOption::EXCLUDE) + ->build() + ) + ->inputType(MetafieldInput::BALANCE_TRACKER) + ->enum( + [ + 'enum2' + ] + ) + ->build() + ) + ->build(); ``` diff --git a/doc/models/update-payment-profile-request.md b/doc/models/update-payment-profile-request.md index 08c8be24..4a0c0aa0 100644 --- a/doc/models/update-payment-profile-request.md +++ b/doc/models/update-payment-profile-request.md @@ -11,17 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `paymentProfile` | [`UpdatePaymentProfile`](../../doc/models/update-payment-profile.md) | Required | - | getPaymentProfile(): UpdatePaymentProfile | setPaymentProfile(UpdatePaymentProfile paymentProfile): void | -## Example (as JSON) - -```json -{ - "payment_profile": { - "full_number": "5424000000000015", - "first_name": "first_name4", - "last_name": "last_name2", - "card_type": "bogus", - "expiration_month": "expiration_month0" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdatePaymentProfileRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdatePaymentProfileBuilder; +use AdvancedBillingLib\Models\CardType; + +$updatePaymentProfileRequest = UpdatePaymentProfileRequestBuilder::init( + UpdatePaymentProfileBuilder::init() + ->firstName('first_name4') + ->lastName('last_name2') + ->fullNumber('5424000000000015') + ->cardType(CardType::BOGUS) + ->expirationMonth('expiration_month0') + ->build() +)->build(); ``` diff --git a/doc/models/update-payment-profile.md b/doc/models/update-payment-profile.md index 8c6219e5..5569a0a3 100644 --- a/doc/models/update-payment-profile.md +++ b/doc/models/update-payment-profile.md @@ -13,25 +13,28 @@ | `lastName` | `?string` | Optional | The last name of the card holder. | getLastName(): ?string | setLastName(?string lastName): void | | `fullNumber` | `?string` | Optional | The full credit card number | getFullNumber(): ?string | setFullNumber(?string fullNumber): void | | `cardType` | [`?string(CardType)`](../../doc/models/card-type.md) | Optional | The type of card used. | getCardType(): ?string | setCardType(?string cardType): void | -| `expirationMonth` | `?string` | Optional | (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit card expiration month, as an integer or string, i.e. 5 | getExpirationMonth(): ?string | setExpirationMonth(?string expirationMonth): void | -| `expirationYear` | `?string` | Optional | (Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, i.e. 2012 | getExpirationYear(): ?string | setExpirationYear(?string expirationYear): void | +| `expirationMonth` | `?string` | Optional | (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit card expiration month, as an integer or string, e.g., 5 | getExpirationMonth(): ?string | setExpirationMonth(?string expirationMonth): void | +| `expirationYear` | `?string` | Optional | (Optional when performing an Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, e.g., 2012 | getExpirationYear(): ?string | setExpirationYear(?string expirationYear): void | | `currentVault` | [`?string(AllVaults)`](../../doc/models/all-vaults.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. | getCurrentVault(): ?string | setCurrentVault(?string currentVault): void | -| `billingAddress` | `?string` | Optional | The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the payment gateway. | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | -| `billingCity` | `?string` | Optional | The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway. | getBillingCity(): ?string | setBillingCity(?string billingCity): void | -| `billingState` | `?string` | Optional | The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getBillingState(): ?string | setBillingState(?string billingState): void | -| `billingZip` | `?string` | Optional | The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway. | getBillingZip(): ?string | setBillingZip(?string billingZip): void | -| `billingCountry` | `?string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | getBillingCountry(): ?string | setBillingCountry(?string billingCountry): void | -| `billingAddress2` | `?string` | Optional | Second line of the customer’s billing address i.e. Apt. 100 | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | - -## Example (as JSON) - -```json -{ - "full_number": "5424000000000015", - "first_name": "first_name2", - "last_name": "last_name0", - "card_type": "carnet", - "expiration_month": "expiration_month2" -} +| `billingAddress` | `?string` | Optional | The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely passed through to the payment gateway. | getBillingAddress(): ?string | setBillingAddress(?string billingAddress): void | +| `billingCity` | `?string` | Optional | The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed through to the payment gateway. | getBillingCity(): ?string | setBillingCity(?string billingCity): void | +| `billingState` | `?string` | Optional | The credit card or bank account billing address state (e.g., MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. | getBillingState(): ?string | setBillingState(?string billingState): void | +| `billingZip` | `?string` | Optional | The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed through to the payment gateway. | getBillingZip(): ?string | setBillingZip(?string billingZip): void | +| `billingCountry` | `?string` | Optional | The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time. | getBillingCountry(): ?string | setBillingCountry(?string billingCountry): void | +| `billingAddress2` | `?string` | Optional | Second line of the customer’s billing address, e.g., Apt. 100 | getBillingAddress2(): ?string | setBillingAddress2(?string billingAddress2): void | + +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdatePaymentProfileBuilder; +use AdvancedBillingLib\Models\CardType; + +$updatePaymentProfile = UpdatePaymentProfileBuilder::init() + ->firstName('first_name6') + ->lastName('last_name4') + ->fullNumber('5424000000000015') + ->cardType(CardType::AMERICAN_EXPRESS) + ->expirationMonth('expiration_month8') + ->build(); ``` diff --git a/doc/models/update-price.md b/doc/models/update-price.md index 84f20fd7..1e1366e5 100644 --- a/doc/models/update-price.md +++ b/doc/models/update-price.md @@ -15,15 +15,23 @@ | `destroy` | `?bool` | Optional | - | getDestroy(): ?bool | setDestroy(?bool destroy): void | | `startingQuantity` | int\|string\|null | Optional | This is a container for one-of cases. | getStartingQuantity(): | setStartingQuantity( startingQuantity): void | -## Example (as JSON) - -```json -{ - "id": 18, - "ending_quantity": 216, - "unit_price": 166.62, - "_destroy": false, - "starting_quantity": 242 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdatePriceBuilder; + +$updatePrice = UpdatePriceBuilder::init() + ->id(206) + ->endingQuantity( + 28 + ) + ->unitPrice( + 181.3 + ) + ->destroy(false) + ->startingQuantity( + 54 + ) + ->build(); ``` diff --git a/doc/models/update-product-price-point-request.md b/doc/models/update-product-price-point-request.md index d51da3d6..15071efe 100644 --- a/doc/models/update-product-price-point-request.md +++ b/doc/models/update-product-price-point-request.md @@ -11,14 +11,17 @@ | --- | --- | --- | --- | --- | --- | | `pricePoint` | [`UpdateProductPricePoint`](../../doc/models/update-product-price-point.md) | Required | - | getPricePoint(): UpdateProductPricePoint | setPricePoint(UpdateProductPricePoint pricePoint): void | -## Example (as JSON) - -```json -{ - "price_point": { - "handle": "handle6", - "price_in_cents": 196 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateProductPricePointRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateProductPricePointBuilder; + +$updateProductPricePointRequest = UpdateProductPricePointRequestBuilder::init( + UpdateProductPricePointBuilder::init() + ->handle('handle6') + ->priceInCents(196) + ->build() +)->build(); ``` diff --git a/doc/models/update-product-price-point.md b/doc/models/update-product-price-point.md index 43780717..435354b4 100644 --- a/doc/models/update-product-price-point.md +++ b/doc/models/update-product-price-point.md @@ -12,12 +12,14 @@ | `handle` | `?string` | Optional | - | getHandle(): ?string | setHandle(?string handle): void | | `priceInCents` | `?int` | Optional | - | getPriceInCents(): ?int | setPriceInCents(?int priceInCents): void | -## Example (as JSON) +## Example -```json -{ - "handle": "handle6", - "price_in_cents": 220 -} +```php +use AdvancedBillingLib\Models\Builders\UpdateProductPricePointBuilder; + +$updateProductPricePoint = UpdateProductPricePointBuilder::init() + ->handle('handle2') + ->priceInCents(154) + ->build(); ``` diff --git a/doc/models/update-reason-code-request.md b/doc/models/update-reason-code-request.md index c95a5feb..f381a314 100644 --- a/doc/models/update-reason-code-request.md +++ b/doc/models/update-reason-code-request.md @@ -11,15 +11,18 @@ | --- | --- | --- | --- | --- | --- | | `reasonCode` | [`UpdateReasonCode`](../../doc/models/update-reason-code.md) | Required | - | getReasonCode(): UpdateReasonCode | setReasonCode(UpdateReasonCode reasonCode): void | -## Example (as JSON) - -```json -{ - "reason_code": { - "code": "code4", - "description": "description6", - "position": 14 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateReasonCodeRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateReasonCodeBuilder; + +$updateReasonCodeRequest = UpdateReasonCodeRequestBuilder::init( + UpdateReasonCodeBuilder::init() + ->code('code4') + ->description('description6') + ->position(14) + ->build() +)->build(); ``` diff --git a/doc/models/update-reason-code.md b/doc/models/update-reason-code.md index f5f1cebe..5abe8cf5 100644 --- a/doc/models/update-reason-code.md +++ b/doc/models/update-reason-code.md @@ -13,13 +13,15 @@ | `description` | `?string` | Optional | The friendly summary of what the code signifies | getDescription(): ?string | setDescription(?string description): void | | `position` | `?int` | Optional | The order that code appears in lists | getPosition(): ?int | setPosition(?int position): void | -## Example (as JSON) - -```json -{ - "code": "code0", - "description": "description8", - "position": 118 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateReasonCodeBuilder; + +$updateReasonCode = UpdateReasonCodeBuilder::init() + ->code('code4') + ->description('description6') + ->position(4) + ->build(); ``` diff --git a/doc/models/update-segment-request.md b/doc/models/update-segment-request.md index 692d107d..e55134fa 100644 --- a/doc/models/update-segment-request.md +++ b/doc/models/update-segment-request.md @@ -11,30 +11,41 @@ | --- | --- | --- | --- | --- | --- | | `segment` | [`UpdateSegment`](../../doc/models/update-segment.md) | Required | - | getSegment(): UpdateSegment | setSegment(UpdateSegment segment): void | -## Example (as JSON) - -```json -{ - "segment": { - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - }, - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSegmentRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateSegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$updateSegmentRequest = UpdateSegmentRequestBuilder::init( + UpdateSegmentBuilder::init( + PricingScheme::STAIRSTEP + ) + ->prices( + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/update-segment.md b/doc/models/update-segment.md index cd72d514..ebef7f4f 100644 --- a/doc/models/update-segment.md +++ b/doc/models/update-segment.md @@ -12,18 +12,38 @@ | `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` | [`?(CreateOrUpdateSegmentPrice[])`](../../doc/models/create-or-update-segment-price.md) | Optional | - | getPrices(): ?array | setPrices(?array prices): void | -## Example (as JSON) - -```json -{ - "pricing_scheme": "stairstep", - "prices": [ - { - "starting_quantity": 64, - "ending_quantity": 38, - "unit_price": "String3" - } - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSegmentBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\Builders\CreateOrUpdateSegmentPriceBuilder; + +$updateSegment = UpdateSegmentBuilder::init( + PricingScheme::STAIRSTEP +) + ->prices( + [ + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build(), + CreateOrUpdateSegmentPriceBuilder::init( + 'String3' + ) + ->startingQuantity(64) + ->endingQuantity(38) + ->build() + ] + ) + ->build(); ``` diff --git a/doc/models/update-subscription-component.md b/doc/models/update-subscription-component.md index 69369697..6a46470d 100644 --- a/doc/models/update-subscription-component.md +++ b/doc/models/update-subscription-component.md @@ -12,30 +12,45 @@ | `componentId` | `?int` | Optional | - | getComponentId(): ?int | setComponentId(?int componentId): 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 -{ - "component_id": 244, - "custom_price": { - "tax_included": false, - "pricing_scheme": "stairstep", - "interval": 66, - "interval_unit": "day", - "list_price_point_id": 174, - "prices": [ - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - }, - { - "starting_quantity": 242, - "ending_quantity": 40, - "unit_price": 23.26 - } - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionComponentBuilder; +use AdvancedBillingLib\Models\Builders\ComponentCustomPriceBuilder; +use AdvancedBillingLib\Models\Builders\PriceBuilder; +use AdvancedBillingLib\Models\PricingScheme; +use AdvancedBillingLib\Models\IntervalUnit; + +$updateSubscriptionComponent = UpdateSubscriptionComponentBuilder::init() + ->componentId(118) + ->customPrice( + ComponentCustomPriceBuilder::init( + [ + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build(), + PriceBuilder::init( + 242, + 23.26 + ) + ->endingQuantity( + 40 + ) + ->build() + ] + ) + ->taxIncluded(false) + ->pricingScheme(PricingScheme::STAIRSTEP) + ->interval(66) + ->intervalUnit(IntervalUnit::DAY) + ->listPricePointId(174) + ->build() + ) + ->build(); ``` diff --git a/doc/models/update-subscription-group-request.md b/doc/models/update-subscription-group-request.md index 66ac7551..6394f350 100644 --- a/doc/models/update-subscription-group-request.md +++ b/doc/models/update-subscription-group-request.md @@ -11,16 +11,21 @@ | --- | --- | --- | --- | --- | --- | | `subscriptionGroup` | [`UpdateSubscriptionGroup`](../../doc/models/update-subscription-group.md) | Required | - | getSubscriptionGroup(): UpdateSubscriptionGroup | setSubscriptionGroup(UpdateSubscriptionGroup subscriptionGroup): void | -## Example (as JSON) - -```json -{ - "subscription_group": { - "member_ids": [ - 164, - 165 - ] - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionGroupRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionGroupBuilder; + +$updateSubscriptionGroupRequest = UpdateSubscriptionGroupRequestBuilder::init( + UpdateSubscriptionGroupBuilder::init() + ->memberIds( + [ + 164, + 165 + ] + ) + ->build() +)->build(); ``` diff --git a/doc/models/update-subscription-group.md b/doc/models/update-subscription-group.md index 6c8c1150..0c0a566c 100644 --- a/doc/models/update-subscription-group.md +++ b/doc/models/update-subscription-group.md @@ -11,15 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `memberIds` | `?(int[])` | Optional | - | getMemberIds(): ?array | setMemberIds(?array memberIds): void | -## Example (as JSON) - -```json -{ - "member_ids": [ - 52, - 53, - 54 - ] -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionGroupBuilder; + +$updateSubscriptionGroup = UpdateSubscriptionGroupBuilder::init() + ->memberIds( + [ + 248, + 249, + 250 + ] + ) + ->build(); ``` diff --git a/doc/models/update-subscription-note-request.md b/doc/models/update-subscription-note-request.md index 8a64c4a0..ee794ca2 100644 --- a/doc/models/update-subscription-note-request.md +++ b/doc/models/update-subscription-note-request.md @@ -13,14 +13,17 @@ Updatable fields for Subscription Note | --- | --- | --- | --- | --- | --- | | `note` | [`UpdateSubscriptionNote`](../../doc/models/update-subscription-note.md) | Required | Updatable fields for Subscription Note | getNote(): UpdateSubscriptionNote | setNote(UpdateSubscriptionNote note): void | -## Example (as JSON) - -```json -{ - "note": { - "body": "body0", - "sticky": false - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionNoteRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionNoteBuilder; + +$updateSubscriptionNoteRequest = UpdateSubscriptionNoteRequestBuilder::init( + UpdateSubscriptionNoteBuilder::init( + 'body0', + false + )->build() +)->build(); ``` diff --git a/doc/models/update-subscription-note.md b/doc/models/update-subscription-note.md index 236335e7..cfa1d3e3 100644 --- a/doc/models/update-subscription-note.md +++ b/doc/models/update-subscription-note.md @@ -14,12 +14,14 @@ Updatable fields for Subscription Note | `body` | `string` | Required | - | getBody(): string | setBody(string body): void | | `sticky` | `bool` | Required | - | getSticky(): bool | setSticky(bool sticky): void | -## Example (as JSON) +## Example -```json -{ - "body": "body8", - "sticky": false -} +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionNoteBuilder; + +$updateSubscriptionNote = UpdateSubscriptionNoteBuilder::init( + 'body2', + false +)->build(); ``` diff --git a/doc/models/update-subscription-request.md b/doc/models/update-subscription-request.md index 37024fd7..b2fc7ff8 100644 --- a/doc/models/update-subscription-request.md +++ b/doc/models/update-subscription-request.md @@ -11,23 +11,29 @@ | --- | --- | --- | --- | --- | --- | | `subscription` | [`UpdateSubscription`](../../doc/models/update-subscription.md) | Required | - | getSubscription(): UpdateSubscription | setSubscription(UpdateSubscription subscription): void | -## Example (as JSON) - -```json -{ - "subscription": { - "defer_signup": false, - "dunning_communication_delay_time_zone": "\"Eastern Time (US & Canada)\"", - "credit_card_attributes": { - "full_number": "full_number2", - "expiration_month": "expiration_month6", - "expiration_year": "expiration_year2" - }, - "product_handle": "product_handle6", - "product_id": 206, - "product_change_delayed": false, - "next_product_id": "next_product_id6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionBuilder; +use AdvancedBillingLib\Models\Builders\CreditCardAttributesBuilder; + +$updateSubscriptionRequest = UpdateSubscriptionRequestBuilder::init( + UpdateSubscriptionBuilder::init() + ->creditCardAttributes( + CreditCardAttributesBuilder::init() + ->fullNumber('full_number2') + ->expirationMonth('expiration_month6') + ->expirationYear('expiration_year2') + ->build() + ) + ->productHandle('product_handle6') + ->productId(206) + ->productChangeDelayed(false) + ->nextProductId('next_product_id6') + ->deferSignup(false) + ->dunningCommunicationDelayTimeZone('"Eastern Time (US & Canada)"') + ->build() +)->build(); ``` diff --git a/doc/models/update-subscription.md b/doc/models/update-subscription.md index b5eaf647..20142f61 100644 --- a/doc/models/update-subscription.md +++ b/doc/models/update-subscription.md @@ -10,15 +10,16 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `creditCardAttributes` | [`?CreditCardAttributes`](../../doc/models/credit-card-attributes.md) | Optional | - | getCreditCardAttributes(): ?CreditCardAttributes | setCreditCardAttributes(?CreditCardAttributes creditCardAttributes): void | -| `productHandle` | `?string` | Optional | Set to the handle of a different product to change the subscription's product | getProductHandle(): ?string | setProductHandle(?string productHandle): void | -| `productId` | `?int` | Optional | Set to the id of a different product to change the subscription's product | getProductId(): ?int | setProductId(?int productId): void | +| `productHandle` | `?string` | Optional | Set to the handle of a different product to change the subscription's product. | getProductHandle(): ?string | setProductHandle(?string productHandle): void | +| `productId` | `?int` | Optional | Set to the id of a different product to change the subscription's product. | getProductId(): ?int | setProductId(?int productId): void | | `productChangeDelayed` | `?bool` | Optional | - | getProductChangeDelayed(): ?bool | setProductChangeDelayed(?bool productChangeDelayed): void | | `nextProductId` | `?string` | Optional | Set to an empty string to cancel a delayed product change. | getNextProductId(): ?string | setNextProductId(?string nextProductId): void | | `nextProductPricePointId` | `?string` | Optional | - | getNextProductPricePointId(): ?string | setNextProductPricePointId(?string nextProductPricePointId): void | | `snapDay` | string\|int\|null | Optional | This is a container for one-of cases. | getSnapDay(): | setSnapDay( snapDay): void | -| `initialBillingAt` | `?DateTime` | Optional | (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. It can be canceled, allocated to, or have its billing date changed. etc. When the `initial_billing_at` date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. You can omit the initial_billing_at date to activate the subscription immediately. See the [subscription import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format) documentation for more information about Date/Time formats. | getInitialBillingAt(): ?\DateTime | setInitialBillingAt(?\DateTime initialBillingAt): void | +| `initialBillingAt` | `?DateTime` | Optional | (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. It can be canceled, allocated to, or have its billing date changed, etc. When the `initial_billing_at` date hits, the subscription will transition to the expected state. If the product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees will be respected either before or after the trial, as configured on the price point. If the payment is due at the initial_billing_at and it fails the subscription will be immediately canceled. You can omit the initial_billing_at date to activate the subscription immediately. See the [subscription import](https://maxio.zendesk.com/hc/en-us/articles/24251489107213-Advanced-Billing-Subscription-Imports#date-format) documentation for more information about Date/Time formats. | getInitialBillingAt(): ?\DateTime | setInitialBillingAt(?\DateTime initialBillingAt): void | | `deferSignup` | `?bool` | Optional | (Optional) Set this attribute to true to move the subscription from Awaiting Signup, to Awaiting Signup Date. Use this when you want to update a subscription that has an unknown initial billing date. When the first billing date is known, update a subscription to set the `initial_billing_at` date. The subscription moves to the awaiting signup with a scheduled initial billing date. You can omit the initial_billing_at date to activate the subscription immediately. See [Subscription States](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404222005773-Subscription-States) for more information.

**Default**: `false` | getDeferSignup(): ?bool | setDeferSignup(?bool deferSignup): void | | `nextBillingAt` | `?DateTime` | Optional | - | getNextBillingAt(): ?\DateTime | setNextBillingAt(?\DateTime nextBillingAt): void | +| `brandingThemeId` | `?int` | Optional | The ID of the Branding Theme to assign to this subscription. When set, this subscription-level Branding Theme is used instead of the customer's default Branding Theme for subscription-related documents and communications that use subscription theming. Pass null or an empty value to clear the subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not returned in the response. | getBrandingThemeId(): ?int | setBrandingThemeId(?int brandingThemeId): void | | `expiresAt` | `?DateTime` | Optional | Timestamp giving the expiration date of this subscription (if any). You may manually change the expiration date at any point during a subscription period. | getExpiresAt(): ?\DateTime | setExpiresAt(?\DateTime expiresAt): void | | `paymentCollectionMethod` | `?string` | Optional | - | getPaymentCollectionMethod(): ?string | setPaymentCollectionMethod(?string paymentCollectionMethod): void | | `receivesInvoiceEmails` | `?bool` | Optional | - | getReceivesInvoiceEmails(): ?bool | setReceivesInvoiceEmails(?bool receivesInvoiceEmails): void | @@ -32,21 +33,26 @@ | `productPricePointId` | `?int` | Optional | Set to change the current product's price point. | getProductPricePointId(): ?int | setProductPricePointId(?int productPricePointId): void | | `productPricePointHandle` | `?string` | Optional | Set to change the current product's price point. | getProductPricePointHandle(): ?string | setProductPricePointHandle(?string productPricePointHandle): void | -## Example (as JSON) - -```json -{ - "defer_signup": false, - "dunning_communication_delay_time_zone": "\"Eastern Time (US & Canada)\"", - "credit_card_attributes": { - "full_number": "full_number2", - "expiration_month": "expiration_month6", - "expiration_year": "expiration_year2" - }, - "product_handle": "product_handle2", - "product_id": 114, - "product_change_delayed": false, - "next_product_id": "next_product_id8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpdateSubscriptionBuilder; +use AdvancedBillingLib\Models\Builders\CreditCardAttributesBuilder; + +$updateSubscription = UpdateSubscriptionBuilder::init() + ->creditCardAttributes( + CreditCardAttributesBuilder::init() + ->fullNumber('full_number2') + ->expirationMonth('expiration_month6') + ->expirationYear('expiration_year2') + ->build() + ) + ->productHandle('product_handle0') + ->productId(16) + ->productChangeDelayed(false) + ->nextProductId('next_product_id0') + ->deferSignup(false) + ->dunningCommunicationDelayTimeZone('"Eastern Time (US & Canada)"') + ->build(); ``` diff --git a/doc/models/upgrade-charge-credit-type.md b/doc/models/upgrade-charge-credit-type.md index 3bc95abc..4723f244 100644 --- a/doc/models/upgrade-charge-credit-type.md +++ b/doc/models/upgrade-charge-credit-type.md @@ -21,3 +21,11 @@ The type of credit to be created when upgrading/downgrading. Defaults to the com | `PRORATED` | | `NONE` | +## Example + +```php +use AdvancedBillingLib\Models\UpgradeChargeCreditType; + +$upgradeChargeCreditType = UpgradeChargeCreditType::FULL; +``` + diff --git a/doc/models/upsert-prepaid-configuration-request.md b/doc/models/upsert-prepaid-configuration-request.md index b76bb1b0..6076ac75 100644 --- a/doc/models/upsert-prepaid-configuration-request.md +++ b/doc/models/upsert-prepaid-configuration-request.md @@ -11,16 +11,19 @@ | --- | --- | --- | --- | --- | --- | | `prepaidConfiguration` | [`UpsertPrepaidConfiguration`](../../doc/models/upsert-prepaid-configuration.md) | Required | - | getPrepaidConfiguration(): UpsertPrepaidConfiguration | setPrepaidConfiguration(UpsertPrepaidConfiguration prepaidConfiguration): void | -## Example (as JSON) - -```json -{ - "prepaid_configuration": { - "initial_funding_amount_in_cents": 74, - "replenish_to_amount_in_cents": 76, - "auto_replenish": false, - "replenish_threshold_amount_in_cents": 20 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpsertPrepaidConfigurationRequestBuilder; +use AdvancedBillingLib\Models\Builders\UpsertPrepaidConfigurationBuilder; + +$upsertPrepaidConfigurationRequest = UpsertPrepaidConfigurationRequestBuilder::init( + UpsertPrepaidConfigurationBuilder::init() + ->initialFundingAmountInCents(74) + ->replenishToAmountInCents(76) + ->autoReplenish(false) + ->replenishThresholdAmountInCents(20) + ->build() +)->build(); ``` diff --git a/doc/models/upsert-prepaid-configuration.md b/doc/models/upsert-prepaid-configuration.md index 1ac58226..7e2add54 100644 --- a/doc/models/upsert-prepaid-configuration.md +++ b/doc/models/upsert-prepaid-configuration.md @@ -14,14 +14,16 @@ | `autoReplenish` | `?bool` | Optional | - | getAutoReplenish(): ?bool | setAutoReplenish(?bool autoReplenish): void | | `replenishThresholdAmountInCents` | `?int` | Optional | - | getReplenishThresholdAmountInCents(): ?int | setReplenishThresholdAmountInCents(?int replenishThresholdAmountInCents): void | -## Example (as JSON) - -```json -{ - "initial_funding_amount_in_cents": 40, - "replenish_to_amount_in_cents": 42, - "auto_replenish": false, - "replenish_threshold_amount_in_cents": 242 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UpsertPrepaidConfigurationBuilder; + +$upsertPrepaidConfiguration = UpsertPrepaidConfigurationBuilder::init() + ->initialFundingAmountInCents(244) + ->replenishToAmountInCents(246) + ->autoReplenish(false) + ->replenishThresholdAmountInCents(190) + ->build(); ``` diff --git a/doc/models/usage-response.md b/doc/models/usage-response.md index 67a05bd8..2df19c88 100644 --- a/doc/models/usage-response.md +++ b/doc/models/usage-response.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `usage` | [`Usage`](../../doc/models/usage.md) | Required | - | getUsage(): Usage | setUsage(Usage usage): void | -## Example (as JSON) - -```json -{ - "usage": { - "id": 150, - "memo": "memo2", - "created_at": "2016-03-13T12:52:32.123Z", - "price_point_id": 28, - "quantity": 28 - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UsageResponseBuilder; +use AdvancedBillingLib\Models\Builders\UsageBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$usageResponse = UsageResponseBuilder::init( + UsageBuilder::init() + ->id(150) + ->memo('memo2') + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->pricePointId(28) + ->quantity( + 28 + ) + ->build() +)->build(); ``` diff --git a/doc/models/usage.md b/doc/models/usage.md index eab42427..8e79e45d 100644 --- a/doc/models/usage.md +++ b/doc/models/usage.md @@ -19,15 +19,20 @@ | `componentHandle` | `?string` | Optional | - | getComponentHandle(): ?string | setComponentHandle(?string componentHandle): void | | `subscriptionId` | `?int` | Optional | - | getSubscriptionId(): ?int | setSubscriptionId(?int subscriptionId): void | -## Example (as JSON) - -```json -{ - "id": 252, - "memo": "memo8", - "created_at": "2016-03-13T12:52:32.123Z", - "price_point_id": 126, - "quantity": 130 -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\UsageBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$usage = UsageBuilder::init() + ->id(150) + ->memo('memo2') + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->pricePointId(28) + ->quantity( + 28 + ) + ->build(); ``` diff --git a/doc/models/void-invoice-event-data.md b/doc/models/void-invoice-event-data.md index d1cad509..4fcd576f 100644 --- a/doc/models/void-invoice-event-data.md +++ b/doc/models/void-invoice-event-data.md @@ -18,22 +18,29 @@ Example schema for an `void_invoice` event | `isAdvanceInvoice` | `bool` | Required | If true, the invoice is an advance invoice. | getIsAdvanceInvoice(): bool | setIsAdvanceInvoice(bool isAdvanceInvoice): void | | `reason` | `string` | Required | The reason for the void. | getReason(): string | setReason(string reason): void | -## Example (as JSON) - -```json -{ - "credit_note_attributes": { - "uid": "uid2", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": "number0" - }, - "memo": "memo6", - "applied_amount": "applied_amount6", - "transaction_time": "2016-03-13T12:52:32.123Z", - "is_advance_invoice": false, - "reason": "reason8" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\VoidInvoiceEventDataBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$voidInvoiceEventData = VoidInvoiceEventDataBuilder::init( + false, + 'reason8' +) + ->creditNoteAttributes( + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number('number0') + ->build() + ) + ->memo('memo6') + ->appliedAmount('applied_amount6') + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/doc/models/void-invoice-event.md b/doc/models/void-invoice-event.md index 3cf8d0b7..dfa04835 100644 --- a/doc/models/void-invoice-event.md +++ b/doc/models/void-invoice-event.md @@ -15,38 +15,48 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::VOID_INVOICE` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`VoidInvoiceEventData`](../../doc/models/void-invoice-event-data.md) | Required | Example schema for an `void_invoice` event | getEventData(): VoidInvoiceEventData | setEventData(VoidInvoiceEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 16, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "void_invoice", - "event_data": { - "credit_note_attributes": { - "uid": "uid2", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": "number0" - }, - "memo": "memo0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z", - "is_advance_invoice": false, - "reason": "reason2" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\VoidInvoiceEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\VoidInvoiceEventDataBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; + +$voidInvoiceEvent = VoidInvoiceEventBuilder::init( + 236, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::VOID_INVOICE, + VoidInvoiceEventDataBuilder::init( + false, + 'reason2' + ) + ->creditNoteAttributes( + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number('number0') + ->build() + ) + ->memo('memo0') + ->appliedAmount('applied_amount2') + ->transactionTime(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() +)->build(); ``` diff --git a/doc/models/void-invoice-request.md b/doc/models/void-invoice-request.md index 80a69451..2c90cb18 100644 --- a/doc/models/void-invoice-request.md +++ b/doc/models/void-invoice-request.md @@ -11,13 +11,16 @@ | --- | --- | --- | --- | --- | --- | | `void` | [`VoidInvoice`](../../doc/models/void-invoice.md) | Required | - | getVoid(): VoidInvoice | setVoid(VoidInvoice void): void | -## Example (as JSON) - -```json -{ - "void": { - "reason": "reason6" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\VoidInvoiceRequestBuilder; +use AdvancedBillingLib\Models\Builders\VoidInvoiceBuilder; + +$voidInvoiceRequest = VoidInvoiceRequestBuilder::init( + VoidInvoiceBuilder::init( + 'reason6' + )->build() +)->build(); ``` diff --git a/doc/models/void-invoice.md b/doc/models/void-invoice.md index 1d80bb17..08c45a89 100644 --- a/doc/models/void-invoice.md +++ b/doc/models/void-invoice.md @@ -11,11 +11,13 @@ | --- | --- | --- | --- | --- | --- | | `reason` | `string` | Required | **Constraints**: *Minimum Length*: `1` | getReason(): string | setReason(string reason): void | -## Example (as JSON) +## Example -```json -{ - "reason": "reason2" -} +```php +use AdvancedBillingLib\Models\Builders\VoidInvoiceBuilder; + +$voidInvoice = VoidInvoiceBuilder::init( + 'reason8' +)->build(); ``` diff --git a/doc/models/void-remainder-event-data.md b/doc/models/void-remainder-event-data.md index 9911c4b6..95da57a3 100644 --- a/doc/models/void-remainder-event-data.md +++ b/doc/models/void-remainder-event-data.md @@ -16,20 +16,24 @@ Example schema for an `void_remainder` event | `appliedAmount` | `string` | Required | The amount of the void. | getAppliedAmount(): string | setAppliedAmount(string appliedAmount): void | | `transactionTime` | `DateTime` | Required | The time the refund was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" | getTransactionTime(): \DateTime | setTransactionTime(\DateTime transactionTime): void | -## Example (as JSON) - -```json -{ - "credit_note_attributes": { - "uid": "uid2", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": "number0" - }, - "memo": "memo6", - "applied_amount": "applied_amount4", - "transaction_time": "2016-03-13T12:52:32.123Z" -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\VoidRemainderEventDataBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$voidRemainderEventData = VoidRemainderEventDataBuilder::init( + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number('number0') + ->build(), + 'memo6', + 'applied_amount6', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') +)->build(); ``` diff --git a/doc/models/void-remainder-event.md b/doc/models/void-remainder-event.md index ce3ac6ca..15c90aff 100644 --- a/doc/models/void-remainder-event.md +++ b/doc/models/void-remainder-event.md @@ -15,36 +15,43 @@ | `eventType` | [`string(InvoiceEventType)`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType::VOID_REMAINDER` | getEventType(): string | setEventType(string eventType): void | | `eventData` | [`VoidRemainderEventData`](../../doc/models/void-remainder-event-data.md) | Required | Example schema for an `void_remainder` event | getEventData(): VoidRemainderEventData | setEventData(VoidRemainderEventData eventData): void | -## Example (as JSON) - -```json -{ - "id": 128, - "timestamp": "2016-03-13T12:52:32.123Z", - "invoice": { - "issue_date": "2024-01-01", - "due_date": "2024-01-01", - "paid_date": "2024-01-01", - "public_url_expires_on": "2024-01-21", - "id": 166, - "uid": "uid6", - "site_id": 92, - "customer_id": 204, - "subscription_id": 20 - }, - "event_type": "void_remainder", - "event_data": { - "credit_note_attributes": { - "uid": "uid2", - "site_id": 72, - "customer_id": 184, - "subscription_id": 0, - "number": "number0" - }, - "memo": "memo0", - "applied_amount": "applied_amount2", - "transaction_time": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\VoidRemainderEventBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; +use AdvancedBillingLib\Models\Builders\InvoiceBuilder; +use AdvancedBillingLib\Models\InvoiceEventType; +use AdvancedBillingLib\Models\Builders\VoidRemainderEventDataBuilder; +use AdvancedBillingLib\Models\Builders\CreditNoteBuilder; + +$voidRemainderEvent = VoidRemainderEventBuilder::init( + 198, + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z'), + InvoiceBuilder::init() + ->id(166) + ->uid('uid6') + ->siteId(92) + ->customerId(204) + ->subscriptionId(20) + ->issueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->dueDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->paidDate(DateTimeHelper::fromSimpleDate('2024-01-01')) + ->publicUrlExpiresOn(DateTimeHelper::fromSimpleDate('2024-01-21')) + ->build(), + InvoiceEventType::VOID_REMAINDER, + VoidRemainderEventDataBuilder::init( + CreditNoteBuilder::init() + ->uid('uid2') + ->siteId(72) + ->customerId(184) + ->subscriptionId(0) + ->number('number0') + ->build(), + 'memo0', + 'applied_amount2', + DateTimeHelper::fromRfc3339DateTimeRequired('2016-03-13T12:52:32.123Z') + )->build() +)->build(); ``` diff --git a/doc/models/webhook-order.md b/doc/models/webhook-order.md index 528b979f..0fd6bf70 100644 --- a/doc/models/webhook-order.md +++ b/doc/models/webhook-order.md @@ -12,3 +12,11 @@ | `NEWEST_FIRST` | | `OLDEST_FIRST` | +## Example + +```php +use AdvancedBillingLib\Models\WebhookOrder; + +$webhookOrder = WebhookOrder::NEWEST_FIRST; +``` + diff --git a/doc/models/webhook-response.md b/doc/models/webhook-response.md index a9fdaacf..19d79530 100644 --- a/doc/models/webhook-response.md +++ b/doc/models/webhook-response.md @@ -11,17 +11,23 @@ | --- | --- | --- | --- | --- | --- | | `webhook` | [`?Webhook`](../../doc/models/webhook.md) | Optional | - | getWebhook(): ?Webhook | setWebhook(?Webhook webhook): void | -## Example (as JSON) - -```json -{ - "webhook": { - "event": "event2", - "id": 18, - "created_at": "2016-03-13T12:52:32.123Z", - "last_error": "last_error4", - "last_error_at": "2016-03-13T12:52:32.123Z" - } -} +## Example + +```php +use AdvancedBillingLib\Models\Builders\WebhookResponseBuilder; +use AdvancedBillingLib\Models\Builders\WebhookBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$webhookResponse = WebhookResponseBuilder::init() + ->webhook( + WebhookBuilder::init() + ->event('event2') + ->id(18) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->lastError('last_error4') + ->lastErrorAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build() + ) + ->build(); ``` diff --git a/doc/models/webhook-status.md b/doc/models/webhook-status.md index 9202a9bf..c069a65d 100644 --- a/doc/models/webhook-status.md +++ b/doc/models/webhook-status.md @@ -14,3 +14,11 @@ | `PENDING` | | `PAUSED` | +## Example + +```php +use AdvancedBillingLib\Models\WebhookStatus; + +$webhookStatus = WebhookStatus::SUCCESSFUL; +``` + diff --git a/doc/models/webhook-subscription.md b/doc/models/webhook-subscription.md index 85990e59..c064d99e 100644 --- a/doc/models/webhook-subscription.md +++ b/doc/models/webhook-subscription.md @@ -39,6 +39,7 @@ | `SUBSCRIPTION_CARD_UPDATE` | | `SUBSCRIPTION_GROUP_CARD_UPDATE` | | `SUBSCRIPTION_PRODUCT_CHANGE` | +| `SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED` | | `SUBSCRIPTION_STATE_CHANGE` | | `TRIAL_END_NOTICE` | | `UPCOMING_RENEWAL_NOTICE` | @@ -48,3 +49,11 @@ | `SUBSCRIPTION_PREPAYMENT_ACCOUNT_BALANCE_CHANGED` | | `SUBSCRIPTION_SERVICE_CREDIT_ACCOUNT_BALANCE_CHANGED` | +## Example + +```php +use AdvancedBillingLib\Models\WebhookSubscription; + +$webhookSubscription = WebhookSubscription::DIRECT_DEBIT_PAYMENT_PENDING; +``` + diff --git a/doc/models/webhook.md b/doc/models/webhook.md index 1865ba9f..5ab5e529 100644 --- a/doc/models/webhook.md +++ b/doc/models/webhook.md @@ -10,27 +10,30 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `event` | `?string` | Optional | A string describing which event type produced the given webhook | getEvent(): ?string | setEvent(?string event): void | -| `id` | `?int` | Optional | The unique identifier for the webhooks (unique across all of Chargify). This is not changed on a retry/replay of the same webhook, so it may be used to avoid duplicate action for the same event. | getId(): ?int | setId(?int id): void | +| `id` | `?int` | Optional | The unique identifier for the webhook (unique across all of Chargify). This is not changed on a retry/replay of the same webhook, so it may be used to avoid duplicate action for the same event. | getId(): ?int | setId(?int id): void | | `createdAt` | `?DateTime` | Optional | Timestamp indicating when the webhook was created | getCreatedAt(): ?\DateTime | setCreatedAt(?\DateTime createdAt): void | | `lastError` | `?string` | Optional | Text describing the status code and/or error from the last failed attempt to send the Webhook. When a webhook is retried and accepted, this field will be cleared. | getLastError(): ?string | setLastError(?string lastError): void | | `lastErrorAt` | `?DateTime` | Optional | Timestamp indicating when the last non-acceptance occurred. If a webhook is later resent and accepted, this field will be cleared. | getLastErrorAt(): ?\DateTime | setLastErrorAt(?\DateTime lastErrorAt): void | | `acceptedAt` | `?DateTime` | Optional | Timestamp indicating when the webhook was accepted by the merchant endpoint. When a webhook is explicitly replayed by the merchant, this value will be cleared until it is accepted again. | getAcceptedAt(): ?\DateTime | setAcceptedAt(?\DateTime acceptedAt): void | | `lastSentAt` | `?DateTime` | Optional | Timestamp indicating when the most recent attempt was made to send the webhook | getLastSentAt(): ?\DateTime | setLastSentAt(?\DateTime lastSentAt): void | | `lastSentUrl` | `?string` | Optional | The url that the endpoint was last sent to. | getLastSentUrl(): ?string | setLastSentUrl(?string lastSentUrl): void | -| `successful` | `?bool` | Optional | A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most recent attempt. (Acceptance is defined by receiving a “200 OK” HTTP response within a reasonable timeframe, i.e. 15 seconds) | getSuccessful(): ?bool | setSuccessful(?bool successful): void | +| `successful` | `?bool` | Optional | “A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most recent attempt. (Acceptance is defined by receiving a “200 OK” HTTP response within a reasonable timeframe, e.g., 15 seconds.)” | getSuccessful(): ?bool | setSuccessful(?bool successful): void | | `body` | `?string` | Optional | The data sent within the webhook post | getBody(): ?string | setBody(?string body): void | | `signature` | `?string` | Optional | The calculated webhook signature | getSignature(): ?string | setSignature(?string signature): void | | `signatureHmacSha256` | `?string` | Optional | The calculated HMAC-SHA-256 webhook signature | getSignatureHmacSha256(): ?string | setSignatureHmacSha256(?string signatureHmacSha256): void | -## Example (as JSON) +## Example -```json -{ - "event": "event6", - "id": 154, - "created_at": "2016-03-13T12:52:32.123Z", - "last_error": "last_error8", - "last_error_at": "2016-03-13T12:52:32.123Z" -} +```php +use AdvancedBillingLib\Models\Builders\WebhookBuilder; +use AdvancedBillingLib\Utils\DateTimeHelper; + +$webhook = WebhookBuilder::init() + ->event('event2') + ->id(18) + ->createdAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->lastError('last_error4') + ->lastErrorAt(DateTimeHelper::fromRfc3339DateTime('2016-03-13T12:52:32.123Z')) + ->build(); ``` diff --git a/src/AdvancedBillingClient.php b/src/AdvancedBillingClient.php index 19654aba..9053927f 100644 --- a/src/AdvancedBillingClient.php +++ b/src/AdvancedBillingClient.php @@ -147,7 +147,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('AB SDK PHP:9.1.0 on OS {os-info}') + ->userAgent('AB SDK PHP:10.0.0 on OS {os-info}') ->globalConfig($this->getGlobalConfiguration()) ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::PRODUCTION) diff --git a/src/Controllers/APIExportsController.php b/src/Controllers/APIExportsController.php index c2a6ee5a..b32c1747 100644 --- a/src/Controllers/APIExportsController.php +++ b/src/Controllers/APIExportsController.php @@ -116,9 +116,8 @@ public function listExportedSubscriptions(array $options): array } /** - * Creates a proforma invoices export and returns a batch job object. - * - * It is only available for Relationship Invoicing architecture. + * Creates a proforma invoices export and returns a batch job object. Proforma invoices are only + * available on Relationship Invoicing sites. * * @return BatchJobResponse Response from the API call * @@ -194,7 +193,8 @@ public function exportSubscriptions(): BatchJobResponse } /** - * Returns a batch job object for a proforma invoices export. + * Returns a batch job object for a proforma invoices export. Proforma invoices are only available on + * Relationship Invoicing sites. * * @param string $batchId Id of a Batch Job. * diff --git a/src/Controllers/AdvanceInvoiceController.php b/src/Controllers/AdvanceInvoiceController.php index 645d8163..50c16797 100644 --- a/src/Controllers/AdvanceInvoiceController.php +++ b/src/Controllers/AdvanceInvoiceController.php @@ -24,18 +24,20 @@ class AdvanceInvoiceController extends BaseController { /** - * Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio. - * zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on - * advance invoices, including eligibility for generating one; for the most part, they function like - * any other invoice, except they are issued early and have special behavior upon being voided. - * A subscription may only have one advance invoice per billing period. Attempting to issue an advance - * invoice when one already exists will return an error. - * That said, regeneration of the invoice may be forced with the params `force: true`, which will void - * an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one - * will be generated. - * We recommend using either the create or preview endpoints for proforma invoices to preview this - * advance invoice before using this endpoint to generate it. + * Issues an invoice in advance for a subscription's next renewal date. For the most part, advance + * invoices function like any other invoice, except they are issued early and have special behavior + * upon being voided. For more information on advance invoices, including eligibility for generating + * one, see [Issue Invoice In Advance](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue- + * Invoice-In-Advance). * + * A subscription can only have one advance invoice per billing period. Attempting to issue an advance + * invoice when one already exists returns an error. + * + * Regeneration of the invoice can be forced with the params `force: true`, which voids an advance + * invoice if one exists and generates a new one. If no advance invoice exists, a new one is generated. + * + * Consider using either the create or preview endpoints for proforma invoices to preview this advance + * invoice before using this endpoint to generate it. * * @param int $subscriptionId The Chargify id of the subscription. * @param IssueAdvanceInvoiceRequest|null $body @@ -96,10 +98,12 @@ public function readAdvanceInvoice(int $subscriptionId): Invoice } /** - * Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. - * A `reason` is required in order to void, and the invoice must have an open status. Voiding will - * cause any prepayments and credits that were applied to the invoice to be returned to the - * subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice). + * Voids a subscription's existing advance invoice. Once voided, it can later be regenerated if desired. + * + * A `reason` is required to void, and the invoice must have an open status. Voiding causes 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 [Invoice]($m/Invoice). * * @param int $subscriptionId The Chargify id of the subscription. * @param VoidInvoiceRequest|null $body diff --git a/src/Controllers/BillingPortalController.php b/src/Controllers/BillingPortalController.php index 59f656ed..940e2148 100644 --- a/src/Controllers/BillingPortalController.php +++ b/src/Controllers/BillingPortalController.php @@ -29,31 +29,22 @@ class BillingPortalController extends BaseController * Enables Billing Portal access for a customer, with an option to send an invitation email at the same * time. * - * ## Billing Portal Documentation - * - * Full documentation on how the Billing Portal operates within the Advanced Billing UI can be located - * [here](https://maxio.zendesk.com/hc/en-us/articles/24252412965133-Billing-Portal-Overview). - * - * This documentation is focused on how to configure the Billing Portal Settings, as well as Subscriber - * Interaction and Merchant Management of the Billing Portal. - * - * You can use this endpoint to enable Billing Portal access for a Customer, with the option of sending - * the Customer an Invitation email at the same time. - * * ## Billing Portal Security * - * If your customer has been invited to the Billing Portal, then they will receive a link to manage - * their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, - * and receipts. **This link changes periodically for security and is only valid for 65 days.** + * If your customer has been invited to the Billing Portal, they receive a link to manage their + * subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and + * receipts. **This link changes periodically for security and is only valid for 65 days.** * * If you need to provide your customer their Management URL through other means, you can retrieve it - * via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for - * merchants to generate the URL without requesting it from Advanced Billing. + * [via the API]($e/Billing%20Portal/readBillingPortalLink). Because the URL is cryptographically + * signed with a timestamp, merchants cannot generate the URL without requesting it through the API. + * + * To prevent abuse and overuse, request a new URL only when absolutely necessary. Management URLs are + * good for 65 days, so you should re-use a previously generated one as much as possible. If you use + * the URL frequently (such as to display on your website), **do not** make an API request every time. * - * In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely - * necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as - * much as possible. If you use the URL frequently (such as to display on your website), **do not** - * make an API request to Advanced Billing every time. + * For more information configuring the Billing Portal, see [Billing Portal Overview](https://maxio. + * zendesk.com/hc/en-us/articles/24252412965133-Billing-Portal-Overview). * * @param int $customerId The Chargify id of the customer * @param int|null $autoInvite When set to 1, an Invitation email will be sent to the Customer. @@ -91,16 +82,16 @@ public function enableBillingPortalForCustomer(int $customerId, ?int $autoInvite /** * Returns the exact URL required for a subscriber to access the Billing Portal. * - * ## Rules for Management Link API + * ## Management Link Request Rules * - * + When retrieving a management URL, multiple requests for the same customer in a short period will - * return the **same** URL - * + We will not generate a new URL for 15 days + * + When retrieving a management URL, multiple requests for the same customer in a short period return + * the **same** URL + * + A new URL is not generated for 15 days * + You must cache and remember this URL if you are going to need it again within 15 days * + Only request a new URL after the `new_link_available_at` date * + You are limited to 15 requests for the same URL. If you make more than 15 requests before - * `new_link_available_at`, you will be blocked from further Management URL requests (with a response - * code `429`) + * `new_link_available_at`, you are blocked from further Management URL requests (with a response code + * `429`). * * @param int $customerId The Chargify id of the customer * diff --git a/src/Controllers/ComponentPricePointsController.php b/src/Controllers/ComponentPricePointsController.php index 258fb4b3..4547a766 100644 --- a/src/Controllers/ComponentPricePointsController.php +++ b/src/Controllers/ComponentPricePointsController.php @@ -112,10 +112,6 @@ public function createComponentPricePoint( * * You may specify the component by using either the numeric id or the `handle:gold` syntax. * - * When fetching a component's price points, if you have defined multiple currencies at the site level, - * you can optionally pass the `?currency_prices=true` query param to include an array of currency - * price data in the response. - * * If the price point is set to `use_site_exchange_rate: true`, it will return pricing based on the * current exchange rate. If the flag is set to false, it will return all of the defined prices for * each currency. @@ -301,7 +297,7 @@ public function updateComponentPricePoint( * @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 bool|null $currencyPrices Include an array of currency price data + * @param bool|null $currencyPrices Include an array of currency price data. * * @return ComponentPricePointCurrencyOverageResponse Response from the API call * diff --git a/src/Controllers/ComponentsController.php b/src/Controllers/ComponentsController.php index a1abf83f..7fb5316a 100644 --- a/src/Controllers/ComponentsController.php +++ b/src/Controllers/ComponentsController.php @@ -42,9 +42,20 @@ class ComponentsController extends BaseController * the start of every billing period. If you want to bill for a quantity of something that does not * change unless you change it, then you want quantity components, instead. * + * #### Hybrid Pricing + * A `volume`, `tiered`, or `stairstep` metered component can combine its primary pricing with a + * secondary pricing model (the `overage_pricing` parameter) so both bill as a single invoice line item + * instead of two. This does not apply to metered components configured for event-based billing (metric, + * meter, or formula). See [Hybrid Pricing](page:introduction/basic-concepts/hybrid-pricing) for + * requirements and configuration details. + * * For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en- * us/articles/24261141522189-Components-Overview). * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending + * `"tax_code": ""` returns `422`. + * * @param string $productFamilyId Either the product family's id or its handle prefixed with * `handle:` * @param CreateMeteredComponent|null $body @@ -86,7 +97,7 @@ public function createMeteredComponent( * Creates a Quantity Based component definition under the specified product family. A Quantity Based * component can then be added and “allocated” for a subscription. * - * When defining a Quantity Based component, you can choose one of 2 types: + * When defining a Quantity Based component, you can choose one of two types: * #### Recurring * Recurring quantity-based components are used to bill for the number of some unit (think monthly * software user licenses or the number of pairs of socks in a box-a-month club). This is most commonly @@ -100,9 +111,21 @@ public function createMeteredComponent( * The allocated quantity for one-time quantity-based components immediately gets reset back to zero * after the allocation is made. * + * For more information, see [Components Overview](https://maxio.zendesk.com/hc/en- + * us/articles/24261141522189-Components-Overview). + * #### Hybrid Pricing + * A `volume`, `tiered`, or `stairstep` component can combine its primary pricing with a secondary + * pricing model (the `overage_pricing` parameter) so both bill as a single invoice line item instead + * of two. See [Hybrid Pricing](page:introduction/basic-concepts/hybrid-pricing) for requirements and + * configuration details. + * * For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en- * us/articles/24261141522189-Components-Overview). * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending + * `"tax_code": ""` returns `422`. + * * @param string $productFamilyId Either the product family's id or its handle prefixed with * `handle:` * @param CreateQuantityBasedComponent|null $body @@ -150,6 +173,10 @@ public function createQuantityBasedComponent( * For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en- * us/articles/24261141522189-Components-Overview). * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending + * `"tax_code": ""` returns `422`. + * * @param string $productFamilyId Either the product family's id or its handle prefixed with * `handle:` * @param CreateOnOffComponent|null $body @@ -194,11 +221,15 @@ public function createOnOffComponent( * Prepaid components allow customers to pre-purchase units that can be used up over time on their * subscription. In a sense, they are the mirror image of metered components; while metered components * charge at the end of the period for the amount of units used, prepaid components are charged for at - * the time of purchase, and we subsequently keep track of the usage against the amount purchased. + * the time of purchase, and usage is subsequently tracked against the amount purchased. * - * For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en- + * For more information, see [Components Overview](https://maxio.zendesk.com/hc/en- * us/articles/24261141522189-Components-Overview). * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`; sending + * a blank value results in a validation error. + * * @param string $productFamilyId Either the product family's id or its handle prefixed with * `handle:` * @param CreatePrepaidComponent|null $body @@ -249,9 +280,13 @@ public function createPrepaidUsageComponent( * So, instead of reporting usage directly for each component (as you would with metered components), * the usage is derived from analysis of your events. * - * For more information on components, see our documentation [here](https://maxio.zendesk.com/hc/en- + * For more information, see [Components Overview](https://maxio.zendesk.com/hc/en- * us/articles/24261141522189-Components-Overview). * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`; sending + * a blank value results in a validation error. + * * @param string $productFamilyId Either the product family's id or its handle prefixed with * `handle:` * @param CreateEBBComponent|null $body @@ -348,6 +383,10 @@ public function readComponent(int $productFamilyId, string $componentId): Compon * You may read the component by either the component's id or handle. When using the handle, it must be * prefixed with `handle:`. * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending + * `"tax_code": ""` returns `422`. + * * @param int $productFamilyId The Advanced Billing id of the product family to which the * component belongs * @param string $componentId Either the Advanced Billing id of the component or the handle for @@ -464,6 +503,10 @@ public function listComponents(array $options): array * You may read the component by either the component's id or handle. When using the handle, it must be * prefixed with `handle:`. * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, taxable components must include a non-blank `tax_code`. Sending + * `"tax_code": ""` returns `422`. + * * @param string $componentId The id or handle of the component * @param UpdateComponentRequest|null $body * diff --git a/src/Controllers/CouponsController.php b/src/Controllers/CouponsController.php index 8903d8c8..2d85f594 100644 --- a/src/Controllers/CouponsController.php +++ b/src/Controllers/CouponsController.php @@ -33,15 +33,8 @@ class CouponsController extends BaseController /** * Creates a coupon under the specified product family. * - * You can create either a flat amount coupon by specifying amount_in_cents, or a percentage coupon by - * specifying percentage - * You can restrict a coupon to only apply to specific products / components by optionally passing in - * `restricted_products` and/or `restricted_components` objects in the format: - * `{ "": boolean_value }` - * - * Coupons can be administered in the Advanced Billing application or created via API. See [creating - * coupons](https://maxio.zendesk.com/hc/en-us/articles/24261212433165-Creating-Editing-Deleting- - * Coupons) for more information. + * You can create either a flat amount coupon, by specifying `amount_in_cents`, or percentage coupon by + * specifying `percentage`. * * See [Apply Coupons to Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101- * Coupons-and-Subscriptions) for information on applying a coupon to a subscription in the Advanced @@ -111,19 +104,18 @@ public function listCouponsForProductFamily(array $options): array } /** - * Searches for a coupon by code, returning a 404 if no coupon is found. By passing a code parameter, - * the find will attempt to locate a coupon that matches that code. + * Searches for a coupon by code. * * If you have more than one product family and if the coupon you are trying to find does not belong to - * the default product family in your site, then you will need to specify (either in the url or as a - * query string param) the product family id. + * the default product family in your site, you need to specify (either in the URL or as a query string + * param) the `product_family_id`. * * @param int|null $productFamilyId The Advanced Billing id of the product family to which the * coupon belongs * @param string|null $code The code of the coupon - * @param bool|null $currencyPrices When fetching coupons, if you have defined multiple - * currencies at the site level, you can optionally pass the `?currency_prices=true` - * query param to include an array of currency price data in the response. + * @param bool|null $currencyPrices (Optional) If you have defined multiple currencies at the + * site level, you can pass `?currency_prices=true` to include an array of currency + * price data in the response. * * @return CouponResponse Response from the API call * @@ -148,24 +140,21 @@ public function findCoupon( } /** - * Returns a coupon by its Advanced Billing-assigned ID. You must identify the Coupon in this call by - * the ID parameter that Advanced Billing assigns. - * If instead you would like to find a Coupon using a Coupon code, see the Coupon Find method. + * Returns a coupon by its system-assigned ID. You must identify the Coupon in this call by the ID + * parameter assigned to it. * - * When fetching a coupon, if you have defined multiple currencies at the site level, you can - * optionally pass the `?currency_prices=true` query param to include an array of currency price data - * in the response. + * If instead you would like to find a Coupon using a Coupon code, use the [Find + * Coupon]($e/Coupons/findCoupon) endpoint. * - * If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current - * exchange rate. If the flag is set to false, it will return all of the defined prices for each - * currency. + * If the coupon is set to `use_site_exchange_rate: true`, it returns pricing based on the current + * exchange rate. If the flag is set to false, it returns all of the defined prices for each currency. * * @param int $productFamilyId The Advanced Billing id of the product family to which the coupon * belongs * @param int $couponId The Advanced Billing id of the coupon - * @param bool|null $currencyPrices When fetching coupons, if you have defined multiple - * currencies at the site level, you can optionally pass the `?currency_prices=true` - * query param to include an array of currency price data in the response. + * @param bool|null $currencyPrices (Optional) If you have defined multiple currencies at the + * site level, you can pass `?currency_prices=true` to include an array of currency + * price data in the response. * * @return CouponResponse Response from the API call * @@ -319,30 +308,21 @@ public function readCouponUsage(int $productFamilyId, int $couponId): array /** * Verifies whether a specific coupon code is valid. This method is useful for validating coupon codes - * that are entered by a customer. If the coupon is found and is valid, the coupon will be returned - * with a 200 status code. - * - * If the coupon is invalid, the status code will be 404 and the response will say why it is invalid. - * If the coupon is valid, the status code will be 200 and the coupon will be returned. The following - * reasons for invalidity are supported: - * - * + Coupon not found - * + Coupon is invalid - * + Coupon expired + * that are entered by a customer. * * If you have more than one product family and if the coupon you are validating does not belong to the - * first product family in your site, then you will need to specify the product family, either in the - * url or as a query string param. This can be done by supplying the id or the handle in the `handle:my- - * family` format. + * first product family in your site, you need to specify the product family, either in the URL or as a + * query string param. This can be done by supplying the id or the handle in the `handle:my-family` + * format. * - * Eg. + * Supplying the `product_family_handle` in the URL: * * ``` * https://.chargify.com/product_families/handle:/coupons/validate. * ?code= * ``` * - * Or: + * Supplying the `product_family_id` as a query parameter: * * ``` * https://.chargify.com/coupons/validate.? @@ -422,8 +402,6 @@ public function createOrUpdateCouponCurrencyPrices( /** * Creates subcodes for an existing coupon. * - * ## Coupon Subcodes Intro - * * Coupon Subcodes allow you to create a set of unique codes that allow you to expand the use of one * coupon. * @@ -439,27 +417,12 @@ public function createOrUpdateCouponCurrencyPrices( * + DP80302 * + SPRINGBALTIMORE * - * Coupon subcodes can be administered in the Admin Interface or via the API. - * * When creating a coupon subcode, you must specify a coupon to attach it to using the coupon_id. Valid * coupon subcodes are all capital letters, contain only letters and numbers, and do not have any - * spaces. Lowercase letters will be capitalized before the subcode is created. - * - * ## Coupon Subcodes Documentation + * spaces. Lowercase letters are capitalized before the subcode is created. * - * Full documentation on how to create coupon subcodes in the Advanced Billing UI can be located - * [here](https://maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes). - * - * Additionally, for documentation on how to apply a coupon to a Subscription within the Advanced - * Billing UI, see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101- - * Coupons-and-Subscriptions). - * - * ## Create Coupon Subcode - * - * This request allows you to create specific subcodes underneath an existing coupon code. - * - * *Note*: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), - * you must encode them for use in the URL. + * Note: If you are using any of the allowed special characters ("%", "@", "+", "-", "_", and "."), you + * must encode them for use in the URL. * * % to %25 * @ to %40 @@ -469,7 +432,11 @@ public function createOrUpdateCouponCurrencyPrices( * . to %2E * * So, if the coupon subcode is `20%OFF`, the URL to delete this coupon subcode would be: `https: - * //.chargify.com/coupons/567/codes/20%25OFF.` + * //.chargify.com/coupons/567/codes/20%25OFF.`. + * + * For more information on coupon codes and applying coupons to subscriptions, see [Coupon Codes](https: + * //maxio.zendesk.com/hc/en-us/articles/24261208729229-Coupon-Codes) and [Coupons and + * Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions). * * @param int $couponId The Advanced Billing id of the coupon * @param CouponSubcodes|null $body @@ -580,7 +547,7 @@ public function updateCouponSubcodes(int $couponId, ?CouponSubcodes $body = null * ## Percent Encoding Example * * Or if the coupon subcode is 20%OFF, the URL to delete this coupon subcode would be: @https: - * //.chargify.com/coupons/567/codes/20%25OFF. + * //.chargify.com/coupons/567/codes/20%25OFF.. * * @param int $couponId The Advanced Billing id of the coupon to which the subcode belongs * @param string $subcode The subcode of the coupon diff --git a/src/Controllers/CustomersController.php b/src/Controllers/CustomersController.php index 5609bf71..9d39d8de 100644 --- a/src/Controllers/CustomersController.php +++ b/src/Controllers/CustomersController.php @@ -29,41 +29,38 @@ class CustomersController extends BaseController { /** * Creates a new customer; can also be created alongside a new subscription. The only validation - * restriction is that you may only create one customer for a given reference value. + * restriction is that you can only create one customer for a given reference value. * * If provided, the `reference` value must be unique. It represents a unique identifier for the * customer from your own app, i.e. the customer’s ID. This allows you to retrieve a given customer via - * a piece of shared information. Alternatively, you may choose to leave `reference` blank, and store - * Advanced Billing’s unique ID for the customer, which is in the `id` attribute. + * a piece of shared information. Alternatively, you can choose to leave `reference` blank, and store + * the system-assigned unique ID for the customer, which is in the `id` attribute. * - * Full documentation on how to locate, create and edit Customers in the Advanced Billing UI can be - * located [here](https://maxio.zendesk.com/hc/en-us/articles/24252190590093-Customer-Details). + * For more information, see [Customer Details](https://maxio.zendesk.com/hc/en- + * us/articles/24252190590093-Customer-Details). * * ## Required Country Format * - * Advanced Billing requires that you use the ISO Standard Country codes when formatting country - * attribute of the customer. + * Format the country attribute of the customer using the ISO Standard Country codes. * - * Countries should be formatted as 2 characters. For more information, see the following wikipedia - * article on [ISO_3166-1.](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) + * Countries should be formatted as two characters. For more information, see [ISO 3166-1](http://en. + * wikipedia.org/wiki/ISO_3166-1#Current_codes). * * ## Required State Format * - * Advanced Billing requires that you use the ISO Standard State codes when formatting state attribute - * of the customer. + * Format the state attribute of the customer using the ISO Standard State codes. * - * + US States (2 characters): [ISO_3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US) + * + US States (two characters): see [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2:US). * - * + States Outside the US (2-3 characters): To find the correct state codes outside of the US, go to - * [ISO_3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in the - * “ISO 3166-2 codes” column next to country you wish to populate. + * + States Outside the US (two to three characters): To find the correct state codes outside the US, + * go to [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and click on the link in + * the “ISO 3166-2 codes” column next to the country you wish to populate. * * ## Locale * - * Advanced Billing allows you to attribute a language/region to your customer to deliver invoices in - * any required language. - * For more: [Customer Locale](https://maxio.zendesk.com/hc/en-us/articles/24286672013709-Customer- - * Locale) + * You can attribute a language/region to the customer to deliver invoices in any required language. + * For more information, see [Customer Locale](https://maxio.zendesk.com/hc/en- + * us/articles/24286672013709-Customer-Locale). * * @param CreateCustomerRequest|null $body * @@ -237,6 +234,11 @@ public function readCustomerByReference(string $reference): CustomerResponse /** * Lists all subscriptions that belong to a customer. * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, subscriptions no longer require an associated product. For + * subscriptions without an associated product, 'product', 'product_price_point_id', and + * 'product_price_point_type' are returned as 'null'. + * * @param int $customerId The Chargify id of the customer * * @return SubscriptionResponse[] Response from the API call diff --git a/src/Controllers/EventsBasedBillingSegmentsController.php b/src/Controllers/EventsBasedBillingSegmentsController.php index c1ae6910..ac5fe61e 100644 --- a/src/Controllers/EventsBasedBillingSegmentsController.php +++ b/src/Controllers/EventsBasedBillingSegmentsController.php @@ -121,10 +121,10 @@ public function listSegmentsForPricePoint(array $options): ListSegmentsResponse } /** - * Updates a single segment for a component with a segmented metric. It allows you to update the - * pricing for the segment. + * Updates a single segment for a component with a segmented metric. You can also update the pricing + * for the segment. * - * You may specify component and/or price point by using either the numeric ID or the `handle:gold` + * You can specify component and/or price point by using either the numeric ID or the `handle:gold` * syntax. * * @param string $componentId ID or Handle of the Component diff --git a/src/Controllers/EventsController.php b/src/Controllers/EventsController.php index 654b02cd..e7f0aaa0 100644 --- a/src/Controllers/EventsController.php +++ b/src/Controllers/EventsController.php @@ -25,20 +25,14 @@ class EventsController extends BaseController /** * Lists events for a site. * - * ## Events Intro + * Events include various activity that happens around a Site. This information is **especially** + * useful to track down issues that arise when subscriptions are not created due to errors. * - * Advanced Billing Events include various activity that happens around a Site. This information is - * **especially** useful to track down issues that arise when subscriptions are not created due to - * errors. + * Within the UI, Events are referred to as Site Activity. For more information, see [Site + * Activity](https://maxio.zendesk.com/hc/en-us/articles/24250671733517-Site-Activity). * - * Within the Advanced Billing UI, "Events" are referred to as "Site Activity". Full documentation on - * how to view Events / Site Activity in the Advanced Billing UI can be located [here](https://maxio. - * zendesk.com/hc/en-us/articles/24250671733517-Site-Activity). - * - * ## List Events for a Site - * - * This method will retrieve a list of events for a site. Use query string filters to narrow down - * results. You may use the `key` filter as part of your query string to narrow down results. + * Use query string filters to narrow down results. You can use the `filter` parameter to filter by + * event key. * * ### Legacy Filters * @@ -52,8 +46,8 @@ class EventsController extends BaseController * + `zferral_revenue_post_success` - (Specific to the deprecated Zferral integration) * * ## Event Key - * The event type is identified by the key property. You can check supported keys - * [here]($m/Event%20Key). + * The event type is identified by the key property. See [Event Key]($m/Event%20Key) for a complete + * list of supported keys. * * ## Event Specific Data * @@ -69,7 +63,7 @@ class EventsController extends BaseController * "event": { * "id": 351, * "key": "subscription_product_change", - * "message": "Product changed on Marky Mark's subscription from 'Basic' to 'Pro'", + * "message": "Product changed on Mark Alan's subscription from 'Basic' to 'Pro'", * "subscription_id": 205, * "event_specific_data": { * "new_product_id": 3, @@ -87,7 +81,7 @@ class EventsController extends BaseController * "event": { * "id": 353, * "key": "subscription_state_change", - * "message": "State changed on Marky Mark's subscription to Pro from trialing to active", + * "message": "State changed on Mark Alan's subscription to Pro from trialing to active", * "subscription_id": 205, * "event_specific_data": { * "new_subscription_state": "active", @@ -98,6 +92,23 @@ class EventsController extends BaseController * } * ``` * + * ## Enhanced Catalog Experience + * + * If you’re using the [enhanced Catalog experience](page:help/announcements/2026-announcements#new- + * catalog-experience-and-terminology), you’ll see updated naming in webhook events and messages. + * + * Event name changes: + * + * - subscription_product_change → subscription_plan_change + * - component_allocation_change → allocation_change + * - component_billing_date_change → product_billing_date_change + * + * Message updates: + * + * - “Plan changed on Subscription from previous plan to new plan” + * - “Successful payment for allocation changes to Product on Subscription” + * - “Failed payment for allocation changes to Product on Subscription” + * * @param array $options Array with all options for search * * @return EventResponse[] Response from the API call @@ -140,8 +151,8 @@ public function listEvents(array $options): array * Lists events for a subscription. * * ## Event Key - * The event type is identified by the key property. You can check supported keys - * [here]($m/Event%20Key). + * The event type is identified by the key property. See [Event Key]($m/Event%20Key) for a complete + * list of supported keys. * * ## Event Specific Data * @@ -149,6 +160,23 @@ public function listEvents(array $options): array * While some events share the same schema for `event_specific_data`, others may not include it at all. * For precise mappings from key to event_specific_data, refer to [Event]($m/Event). * + * ## Enhanced Catalog Experience + * + * If you’re using the [enhanced Catalog experience](page:help/announcements/2026-announcements#new- + * catalog-experience-and-terminology), you’ll see updated naming in webhook events and messages. + * + * Event name changes: + * + * - subscription_product_change → subscription_plan_change + * - component_allocation_change → allocation_change + * - component_billing_date_change → product_billing_date_change + * + * Message updates: + * + * - “Successful payment for allocation changes to Product on Subscription” + * - “Failed payment for allocation changes to Product on Subscription” + * - “Plan changed on Subscription from previous plan to new plan” + * * @param array $options Array with all options for search * * @return EventResponse[] Response from the API call @@ -183,6 +211,21 @@ public function listSubscriptionEvents(array $options): array /** * Returns the total count of events for a given site. * + * If you’re using the [enhanced Catalog experience](page:help/announcements/2026-announcements#new- + * catalog-experience-and-terminology), you’ll see updated naming in webhook events and messages. + * + * Event name changes: + * + * - subscription_product_change → subscription_plan_change + * - component_allocation_change → allocation_change + * - component_billing_date_change → product_billing_date_change + * + * Message updates: + * + * - “Successful payment for allocation changes to Product on Subscription” + * - “Failed payment for allocation changes to Product on Subscription” + * - “Plan changed on Subscription from previous plan to new plan” + * * @param array $options Array with all options for search * * @return CountResponse Response from the API call diff --git a/src/Controllers/InsightsController.php b/src/Controllers/InsightsController.php index abc096fa..92be6f8d 100644 --- a/src/Controllers/InsightsController.php +++ b/src/Controllers/InsightsController.php @@ -58,8 +58,8 @@ public function readSiteStats(): SiteSummary * @deprecated * * @param \DateTime|null $atTime submit a timestamp in ISO8601 format to request MRR for a - * historic time - * @param int|null $subscriptionId submit the id of a subscription in order to limit results + * historic time. + * @param int|null $subscriptionId submit the id of a subscription in order to limit results. * * @return MRRResponse Response from the API call * @@ -142,8 +142,7 @@ public function listMrrMovements(array $options): ListMRRResponse } /** - * This endpoint returns your site's current MRR, including plan and usage breakouts split per - * subscription. + * Lists your site's current MRR, including plan and usage breakouts split per subscription. * * @deprecated * diff --git a/src/Controllers/InvoicesController.php b/src/Controllers/InvoicesController.php index ef686174..fa3c749a 100644 --- a/src/Controllers/InvoicesController.php +++ b/src/Controllers/InvoicesController.php @@ -35,6 +35,7 @@ use AdvancedBillingLib\Models\RecordPaymentResponse; use AdvancedBillingLib\Models\RefundInvoiceRequest; use AdvancedBillingLib\Models\SendInvoiceRequest; +use AdvancedBillingLib\Models\UpdateInvoiceRequest; use AdvancedBillingLib\Models\VoidInvoiceRequest; use Core\Request\Parameters\BodyParam; use Core\Request\Parameters\HeaderParam; @@ -46,7 +47,7 @@ class InvoicesController extends BaseController { /** - * Refund an invoice, segment, or consolidated invoice. + * Refunds an invoice, segment, or consolidated invoice. * * ## Partial Refund for Consolidated Invoice * @@ -87,9 +88,10 @@ public function refundInvoice(string $uid, ?RefundInvoiceRequest $body = null): } /** - * By default, invoices returned on the index will only include totals, not detailed breakdowns for - * `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`, or `refunds`. To include - * breakdowns, pass the specific field as a key in the query with a value set to `true`. + * Lists invoices for a site. By default, invoices returned on the index will only include totals, not + * detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`, + * or `refunds`. To include breakdowns, pass the specific field as a key in the query with a value set + * to `true`. * * @param array $options Array with all options for search * @@ -147,7 +149,7 @@ public function listInvoices(array $options): ListInvoicesResponse } /** - * Use this endpoint to retrieve the details for an invoice. + * Returns the details for an invoice. * * ## PDF Invoice retrieval * @@ -181,8 +183,8 @@ public function readInvoice(string $uid): Invoice } /** - * This endpoint returns a list of invoice events. Each event contains event "data" (such as an applied - * payment) as well as a snapshot of the `invoice` at the time of event completion. + * Lists invoice events for a site. Each event contains event "data" (such as an applied payment) as + * well as a snapshot of the `invoice` at the time of event completion. * * Exposed event types are: * @@ -240,7 +242,8 @@ public function listInvoiceEvents(array $options): ListInvoiceEventsResponse /** * Applies a payment of a given type against a specific invoice. If you would like to apply a payment - * across multiple invoices, you can use the Bulk Payment endpoint. + * across multiple invoices, you can use the [Record Payment for Multiple + * Invoices]($e/Invoices/recordPaymentForMultipleInvoices) endpoint. * * @param string $uid The unique identifier for the invoice, this does not refer to the public * facing invoice number. @@ -274,32 +277,11 @@ public function recordPaymentForInvoice(string $uid, ?CreateInvoicePaymentReques } /** - * This API call should be used when you want to record an external payment against multiple invoices. + * Records an external payment against multiple invoices. * * To apply a payment to multiple invoices, at minimum, specify the `amount` and `applications` (i.e., * `invoice_uid` and `amount`) details. * - * ``` - * { - * "payment": { - * "memo": "to pay the bills", - * "details": "check number 8675309", - * "method": "check", - * "amount": "250.00", - * "applications": [ - * { - * "invoice_uid": "inv_8gk5bwkct3gqt", - * "amount": "100.00" - * }, - * { - * "invoice_uid": "inv_7bc6bwkct3lyt", - * "amount": "150.00" - * } - * ] - * } - * } - * ``` - * * Note that the invoice payment amounts must be greater than 0. Total amount must be greater or equal * to invoices payment amount sum. * @@ -330,7 +312,8 @@ public function recordPaymentForMultipleInvoices( } /** - * Credit Notes are like inverse invoices. They reduce the amount a customer owes. + * Lists credit notes for a site. Credit Notes are like inverse invoices. They reduce the amount a + * customer owes. * * By default, the credit notes returned by this endpoint will exclude the arrays of `line_items`, * `discounts`, `taxes`, `applications`, or `refunds`. To include these arrays, pass the specific field @@ -363,7 +346,7 @@ public function listCreditNotes(array $options): ListCreditNotesResponse } /** - * Use this endpoint to retrieve the details for a credit note. + * Returns the details for a credit note. * * @param string $uid The unique identifier of the credit note * @@ -383,7 +366,7 @@ public function readCreditNote(string $uid): CreditNote } /** - * Record an external payment made against a subscription that will pay partially or in full one or + * Records an external payment made against a subscription that will pay partially or in full one or * more invoices. * * Payment will be applied starting with the oldest open invoice and then next oldest, and so on until @@ -426,9 +409,8 @@ public function recordPaymentForSubscription( } /** - * This endpoint allows you to reopen any invoice with the "canceled" status. Invoices enter "canceled" - * status if they were open at the time the subscription was canceled (whether through dunning or an - * intentional cancellation). + * Reopens any invoice with the "canceled" status. Invoices enter "canceled" status if they were open + * at the time the subscription was canceled (whether through dunning or an intentional cancellation). * * Invoices with "canceled" status are no longer considered to be due. Once reopened, they are * considered due for payment. Payment may then be captured in one of the following ways: @@ -474,8 +456,8 @@ public function reopenInvoice(string $uid): Invoice } /** - * This endpoint allows you to void any invoice with the "open" or "canceled" status. It will also - * allow voiding of an invoice with the "pending" status if it is not a consolidated invoice. + * Voids any invoice with the "open" or "canceled" status. It will also allow voiding of an invoice + * with the "pending" status if it is not a consolidated invoice. * * @param string $uid The unique identifier for the invoice, this does not refer to the public * facing invoice number. @@ -510,8 +492,9 @@ public function voidInvoice(string $uid, ?VoidInvoiceRequest $body = null): Invo } /** - * Invoice segments returned on the index will only include totals, not detailed breakdowns for - * `line_items`, `discounts`, `taxes`, `credits`, `payments`, or `custom_fields`. + * Lists segments for a consolidated invoice. Invoice segments returned on the index will only include + * totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, or + * `custom_fields`. * * @param array $options Array with all options for search * @@ -539,7 +522,7 @@ public function listConsolidatedInvoiceSegments(array $options): ConsolidatedInv } /** - * This endpoint will allow you to create an ad hoc invoice. + * Creates an ad hoc invoice. * * ### Basic Behavior * @@ -788,10 +771,164 @@ public function createInvoice(int $subscriptionId, ?CreateInvoiceRequest $body = } /** - * 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. + * Updates an ad hoc invoice while it is in the `draft` state. + * + * **Important: only invoices with the `adhoc` role and `draft` status can be updated.** Any other + * invoice — issued, or with a different role (e.g. `renewal`, `signup`) — cannot be updated through + * this endpoint and the request returns a `422` error. If the invoice does not belong to the provided + * subscription, a `404` error is returned. + * + * Only the attributes submitted in the request are changed — omitted attributes keep their current + * values. + * + * ### Line Items + * + * The `line_items` array describes changes to the invoice's line items. Line items not referenced in + * the array remain unchanged. + * + * #### Adding a line item + * + * A line item without a `uid` is added to the invoice. The same line item types and options as on + * invoice creation are supported (custom items, `product_id`, `component_id`, price points, period + * date ranges, taxes). + * + * #### Updating a line item + * + * A line item with the `uid` of an existing line item updates that line item with the submitted + * attributes. Amounts and taxes are recalculated. + * + * #### Removing a line item + * + * A line item with a `uid` and `"_destroy": true` is removed from the invoice. Other line items remain + * unchanged. + * + * Referencing a `uid` which does not exist on the invoice returns a `422` error. + * + * ### Coupons + * + * When the `coupons` key is present, the submitted coupons replace all discounts currently applied to + * the invoice. Send an empty array to remove all discounts. Coupon options are the same as on invoice + * creation. + * + * ### Invoice Options + * + * #### Issue Date and Net Terms + * + * The `issue_date` parameter can be sent to change the invoice's issue date. Only today or dates in + * the past are accepted. The date is interpreted and validated in your site's time zone, using the + * `YYYY-MM-DD` format. The `net_terms` parameter indicates the number of days after the issue date on + * which the invoice is due. The due date is recalculated whenever the issue date or net terms change. + * + * #### Addresses + * + * The seller, shipping and billing addresses can be sent to replace the addresses on the invoice. Each + * address requires to send a `first_name` at a minimum in order to work. Taxes are recalculated after + * an address change. + * + * #### Memo and Payment Instructions + * + * A custom memo can be sent with the `memo` parameter. Likewise, custom payment instructions can be + * sent with the `payment_instructions` parameter. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param string $uid The unique identifier for the invoice, this does not refer to the public + * facing invoice number. + * @param UpdateInvoiceRequest|null $body + * + * @return InvoiceResponse Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function updateInvoice( + int $subscriptionId, + string $uid, + ?UpdateInvoiceRequest $body = null + ): InvoiceResponse { + $_reqBuilder = $this->requestBuilder( + RequestMethod::PUT, + '/subscriptions/{subscription_id}/invoices/{uid}.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('uid', $uid)->required(), + HeaderParam::init('Content-Type', 'application/json'), + BodyParam::init($body) + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '404', + ErrorType::initWithErrorTemplate( + 'Not Found:\'{$response.body}\'', + ErrorListResponseException::class + ) + ) + ->throwErrorOn( + '422', + ErrorType::initWithErrorTemplate( + 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', + ErrorArrayMapResponseException::class + ) + ) + ->type(InvoiceResponse::class); + + return $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Deletes an ad hoc invoice while it is in the `draft` state. + * + * **Important: only invoices with the `adhoc` role and `draft` status can be deleted.** Any other + * invoice — issued, or with a different role (e.g. `renewal`, `signup`) — cannot be deleted through + * this endpoint and the request returns a `422` error. Issued invoices should be voided instead. If + * the invoice does not belong to the provided subscription, a `404` error is returned. + * + * A successful deletion returns a `204 No Content` response and the invoice is permanently removed. + * + * @param int $subscriptionId The Chargify id of the subscription. + * @param string $uid The unique identifier for the invoice, this does not refer to the public + * facing invoice number. + * + * @return void Response from the API call + * + * @throws ApiException Thrown if API call fails + */ + public function deleteInvoice(int $subscriptionId, string $uid): void + { + $_reqBuilder = $this->requestBuilder( + RequestMethod::DELETE, + '/subscriptions/{subscription_id}/invoices/{uid}.json' + ) + ->auth('BasicAuth') + ->parameters( + TemplateParam::init('subscription_id', $subscriptionId)->required(), + TemplateParam::init('uid', $uid)->required() + ); + + $_resHandler = $this->responseHandler() + ->throwErrorOn( + '404', + ErrorType::initWithErrorTemplate( + 'Not Found:\'{$response.body}\'', + ErrorListResponseException::class + ) + ) + ->throwErrorOn( + '422', + ErrorType::initWithErrorTemplate( + 'HTTP Response Not OK. Status code: {$statusCode}. Response: \'{$response.body}\'.', + ErrorListResponseException::class + ) + ); + + $this->execute($_reqBuilder, $_resHandler); + } + + /** + * Sends an invoice to the customer 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 @@ -837,9 +974,10 @@ public function sendInvoice(string $uid, ?SendInvoiceRequest $body = null): void } /** - * Customer information may change after an invoice is issued, which may lead to a mismatch between - * customer information that is present on an open invoice and actual customer information. This - * endpoint allows you to preview these differences, if any. + * Previews the effect of customer information changes on an open invoice. Customer information may + * change after an invoice is issued, which may lead to a mismatch between customer information that is + * present on an open invoice and actual customer information. This endpoint allows you to preview + * these differences, if any. * * The endpoint doesn't accept a request body. Customer information differences are calculated on the * application side. @@ -879,9 +1017,9 @@ public function previewCustomerInformationChanges(string $uid): CustomerChangesP } /** - * This endpoint updates customer information on an open invoice and returns the updated invoice. If - * you would like to preview changes that will be applied, use the - * `/invoices/{uid}/customer_information/preview.json` endpoint first. + * Updates customer information on an open invoice and returns the updated invoice. If you would like + * to preview changes that will be applied, use the `/invoices/{uid}/customer_information/preview.json` + * endpoint first. * * The endpoint doesn't accept a request body. Customer information differences are calculated on the * application side. @@ -920,9 +1058,8 @@ public function updateCustomerInformation(string $uid): Invoice } /** - * 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. + * Issues 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/OffersController.php b/src/Controllers/OffersController.php index fd1d60c9..1610f9c8 100644 --- a/src/Controllers/OffersController.php +++ b/src/Controllers/OffersController.php @@ -26,17 +26,15 @@ class OffersController extends BaseController { /** - * Creates an offer within your Advanced Billing site. - * - * ## Documentation + * Creates an offer within your site. * * Offers allow you to package complicated combinations of products, components and coupons into a * convenient package which can then be subscribed to just like products. * * Once an offer is defined it can be used as an alternative to the product when creating subscriptions. * - * Full documentation on how to use offers in the Advanced Billing UI can be located [here](https: - * //maxio.zendesk.com/hc/en-us/articles/24261295098637-Offers-Overview). + * For more information, see [Offers](https://maxio.zendesk.com/hc/en-us/articles/24261295098637-Offers- + * Overview) in the product documentation. * * ## Using a Product Price Point * diff --git a/src/Controllers/PaymentProfilesController.php b/src/Controllers/PaymentProfilesController.php index 134ca556..5344ad51 100644 --- a/src/Controllers/PaymentProfilesController.php +++ b/src/Controllers/PaymentProfilesController.php @@ -122,8 +122,8 @@ public function createPaymentProfile(?CreatePaymentProfileRequest $body = null): } /** - * Returns all active payment profiles for a site, or for one customer within a site. If no payment - * profiles are found, this endpoint will return an empty array, not a 404. + * Lists all active payment profiles for a site, or for one customer within a site. If no payment + * profiles are found, this endpoint returns an empty array. * * @param array $options Array with all options for search * @@ -290,8 +290,8 @@ public function updatePaymentProfile( /** * Deletes an unused payment profile. * - * If the payment profile is in use by one or more subscriptions or groups, a 422 and error message - * will be returned. + * If the payment profile is in use by one or more subscriptions or groups, an error message is + * returned. * * @param int $paymentProfileId The Chargify id of the payment profile * @@ -321,12 +321,12 @@ public function deleteUnusedPaymentProfile(int $paymentProfileId): void /** * Deletes a payment profile belonging to the customer on the subscription. * - * + If the customer has multiple subscriptions, the payment profile will be removed from all of them. + * If the customer has multiple subscriptions, the payment profile is removed from all of them. * - * + If you delete the default payment profile for a subscription, you will need to specify another - * payment profile to be the default through the api, or either prompt the user to enter a card in the - * billing portal or on the self-service page, or visit the Payment Details tab on the subscription in - * the Admin UI and use the “Add New Credit Card” or “Make Active Payment Method” link, (depending on + * If you delete the default payment profile for a subscription, you need to specify another payment + * profile to be the default through the API, or either prompt the user to enter a card in the billing + * portal or on the self-service page, or visit the Payment Details tab on the subscription in 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. @@ -463,8 +463,8 @@ public function changeSubscriptionDefaultPaymentProfile( } /** - * This will change the default payment profile on the subscription group to the existing payment - * profile with the id specified. + * Changes the default payment profile on the subscription group to the existing payment profile with + * the specified ID. * * 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. @@ -507,8 +507,9 @@ public function changeSubscriptionGroupDefaultPaymentProfile( } /** - * One Time Tokens aka Advanced Billing Tokens house the credit card or ACH (Authorize.Net or Stripe - * only) data for a customer. + * Returns the one-time token data, including credit card or ACH details, associated with the provided + * token ID. One Time Tokens aka Advanced Billing Tokens house the credit card or ACH (Authorize.Net or + * Stripe only) data for a customer. * * You can use One Time Tokens while creating a subscription or payment profile instead of passing all * bank account or credit card data directly to a given API endpoint. @@ -542,7 +543,7 @@ public function readOneTimeToken(string $chargifyToken): GetOneTimeTokenRequest } /** - * You can send a "request payment update" email to the customer associated with the subscription. + * Sends a "request payment update" email to the customer associated with the subscription. * * If you attempt to send a "request payment update" email more than five times within a 30-minute * period, you will receive a `422` response with an error message in the body. This error message will diff --git a/src/Controllers/ProductFamiliesController.php b/src/Controllers/ProductFamiliesController.php index 12ae75f7..116f3356 100644 --- a/src/Controllers/ProductFamiliesController.php +++ b/src/Controllers/ProductFamiliesController.php @@ -83,8 +83,8 @@ public function listProductsForProductFamily(array $options): array } /** - * Creates a Product Family within your Advanced Billing site. Create a Product Family to act as a - * container for your products, components, and coupons. + * Creates a Product Family within your site. Create a Product Family to act as a container for your + * products, components, and coupons. * * Full documentation on how Product Families operate within the Advanced Billing UI can be located * [here](https://maxio.zendesk.com/hc/en-us/articles/24261098936205-Product-Families). @@ -115,7 +115,7 @@ public function createProductFamily(?CreateProductFamilyRequest $body = null): P } /** - * Returns a list of Product Families for a site. + * Lists Product Families for a site. * * @param array $options Array with all options for search * diff --git a/src/Controllers/ProductPricePointsController.php b/src/Controllers/ProductPricePointsController.php index a8c6913e..a09b3ad5 100644 --- a/src/Controllers/ProductPricePointsController.php +++ b/src/Controllers/ProductPricePointsController.php @@ -155,12 +155,11 @@ public function updateProductPricePoint( * @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-product-price-point-handle` for a string handle. - * @param bool|null $currencyPrices When fetching a product's price points, if you have defined - * multiple currencies at the site level, you can optionally pass the ? - * currency_prices=true query param to include an array of currency price data in the - * response. If the product price point is set to use_site_exchange_rate: true, it will - * return pricing based on the current exchange rate. If the flag is set to false, it - * will return all of the defined prices for each currency. + * @param bool|null $currencyPrices (Optional) If you have defined multiple currencies at the + * site level, you can pass ?currency_prices=true to include an array of currency price + * data in the response. If the product price point is set to use_site_exchange_rate: + * true, it will return pricing based on the current exchange rate. If the flag is set + * to false, it will return all of the defined prices for each currency. * * @return ProductPricePointResponse Response from the API call * diff --git a/src/Controllers/ProductsController.php b/src/Controllers/ProductsController.php index bee66a90..9e805fef 100644 --- a/src/Controllers/ProductsController.php +++ b/src/Controllers/ProductsController.php @@ -27,12 +27,15 @@ class ProductsController extends BaseController { /** - * Creates a product in your Advanced Billing site. + * Creates a product in your site. * - * See the following product documentation for more information: + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, the `auto_create_signup_page` parameter is not supported. If + * `auto_create_signup_page` is included (with any value) an error is returned. * - * + [Products Documentation](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products- - * Overview) + * For more information, see: + * + * + [Products Overview](https://maxio.zendesk.com/hc/en-us/articles/24261090117645-Products-Overview) * + [Changing a Subscription's Product](https://maxio.zendesk.com/hc/en-us/articles/24252069837581- * Product-Changes-and-Migrations) * diff --git a/src/Controllers/ProformaInvoicesController.php b/src/Controllers/ProformaInvoicesController.php index 9972bf67..a08f8f70 100644 --- a/src/Controllers/ProformaInvoicesController.php +++ b/src/Controllers/ProformaInvoicesController.php @@ -33,10 +33,9 @@ class ProformaInvoicesController extends BaseController { /** - * Creates a consolidated proforma invoice asynchronously. It will return a 201 with no message, or a - * 422 with any errors. To find and view the new consolidated proforma invoice, you may poll the - * subscription group listing for proforma invoices; only one consolidated proforma invoice may be - * created per group at a time. + * Creates a consolidated proforma invoice asynchronously. To find and view the new consolidated + * proforma invoice, you can poll the subscription group listing for proforma invoices; only one + * consolidated proforma invoice can be created per group at a time. * * If the information becomes outdated, simply void the old consolidated proforma invoice and generate * a new one. @@ -313,10 +312,10 @@ public function voidProformaInvoice(string $proformaInvoiceUid, ?VoidInvoiceRequ } /** - * Returns a preview of the data that will be included on a given subscription's proforma invoice if - * one were to be generated. It will have similar line items and totals as a renewal preview, but the - * response will be presented in the format of a proforma invoice. Consequently it will include - * additional information such as the name and addresses that will appear on the proforma invoice. + * Previews the data that will be included on a given subscription's proforma invoice if one were to be + * generated. It will have similar line items and totals as a renewal preview, but the response will be + * presented in the format of a proforma invoice. Consequently it will include additional information + * such as the name and addresses that will appear on the proforma invoice. * * The preview endpoint is subject to all the same conditions as the proforma invoice endpoint. For * example, previews are only available on the Relationship Invoicing architecture, and previews cannot diff --git a/src/Controllers/ReasonCodesController.php b/src/Controllers/ReasonCodesController.php index 23fb6e2e..bc7a56ef 100644 --- a/src/Controllers/ReasonCodesController.php +++ b/src/Controllers/ReasonCodesController.php @@ -28,24 +28,14 @@ class ReasonCodesController extends BaseController /** * Creates a reason code for a given site. * - * # Reason Codes Intro - * * Reason Codes are a way to gain a high-level view of why your customers are cancelling the * subscription to your product or service. * * Add a set of churn reason codes to be displayed in-app and/or the Maxio Billing Portal. As your * subscribers decide to cancel their subscription, learn why they decided to cancel. * - * ## Reason Code Documentation - * - * Full documentation on how Reason Codes operate within Advanced Billing can be located under the - * following links. - * - * [Churn Reason Codes](https://maxio.zendesk.com/hc/en-us/articles/24286647554701-Churn-Reason-Codes) - * - * ## Create Reason Code - * - * This method gives a merchant the option to create reason codes for a given site. + * For more information, see [Churn Reason Codes](https://maxio.zendesk.com/hc/en- + * us/articles/24286647554701-Churn-Reason-Codes). * * @param CreateReasonCodeRequest|null $body * diff --git a/src/Controllers/ReferralCodesController.php b/src/Controllers/ReferralCodesController.php index 3e6b79aa..cca42f65 100644 --- a/src/Controllers/ReferralCodesController.php +++ b/src/Controllers/ReferralCodesController.php @@ -23,15 +23,8 @@ class ReferralCodesController extends BaseController * Validates whether a referral code is valid and applicable within your site. This method is useful * for validating referral codes that are entered by a customer. * - * ## Referrals Documentation - * - * Full documentation on how to use the referrals feature in the Advanced Billing UI can be located - * [here](https://maxio.zendesk.com/hc/en-us/sections/24286965611405-Referrals). - * - * ## Server Response - * - * If the referral code is valid the status code will be `200` and the referral code will be returned. - * If the referral code is invalid, a `404` response will be returned. + * For more information, see [Understanding Referrals](https://docs.maxio.com/hc/en- + * us/articles/24286981223693-Understanding-Referrals) in the product documentation. * * @param string $code The referral code you are trying to validate * diff --git a/src/Controllers/SalesCommissionsController.php b/src/Controllers/SalesCommissionsController.php index 9e7c0c27..9291b851 100644 --- a/src/Controllers/SalesCommissionsController.php +++ b/src/Controllers/SalesCommissionsController.php @@ -37,7 +37,7 @@ class SalesCommissionsController extends BaseController * seller has the Advanced Analytics component enabled. For further information on getting access to * Advanced Analytics contact Maxio support. * - * > Note: The request is at seller level, it means `<>` variable will be replaced by `app` + * > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. * * @param array $options Array with all options for search * @@ -66,7 +66,7 @@ public function listSalesCommissionSettings(array $options): array } /** - * Returns a sales rep list with details. + * Lists sales reps with details. * * ## Modified Authentication Process * @@ -81,7 +81,7 @@ public function listSalesCommissionSettings(array $options): array * seller has the Advanced Analytics component enabled. For further information on getting access to * Advanced Analytics contact Maxio support. * - * > Note: The request is at seller level, it means `<>` variable will be replaced by `app` + * > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. * * @param array $options Array with all options for search * @@ -122,7 +122,7 @@ public function listSalesReps(array $options): array * seller has the Advanced Analytics component enabled. For further information on getting access to * Advanced Analytics contact Maxio support. * - * > Note: The request is at seller level, it means `<>` variable will be replaced by `app` + * > Note: The request is at seller level, it means `<>` variable will be replaced by `app`. * * @param string $sellerId The Chargify id of your seller account * @param string $salesRepId The Advanced Billing id of sales rep. diff --git a/src/Controllers/SitesController.php b/src/Controllers/SitesController.php index 8bda61d9..2f12423a 100644 --- a/src/Controllers/SitesController.php +++ b/src/Controllers/SitesController.php @@ -22,21 +22,21 @@ class SitesController extends BaseController /** * Retrieves site data. * - * Full documentation on Sites in the Advanced Billing UI can be located [here](https://maxio.zendesk. - * com/hc/en-us/sections/24250550707085-Sites). - * - * Specifically, the [Clearing Site Data](https://maxio.zendesk.com/hc/en-us/articles/24250617028365- - * Clearing-Site-Data) section is relevant to this endpoint documentation. + * For more information, see [Sites](https://maxio.zendesk.com/hc/en-us/sections/24250550707085-Sites) + * in the product documentation. Specifically, the [Clearing Site Data](https://maxio.zendesk.com/hc/en- + * us/articles/24250617028365-Clearing-Site-Data) section is relevant to this endpoint. * * #### Relationship invoicing enabled - * If the site has RI enabled then you will see more settings like: + * If the site has Relationship invoicing enabled, additional properties are returned in the response: * + * ``` * "customer_hierarchy_enabled": true, * "whopays_enabled": true, * "whopays_default_payer": "self" - * You can read more about these settings here: - * [Who Pays & Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer- - * Hierarchies-WhoPays) + * ``` + * + * For more information, see [Who Pays & Customer Hierarchy](https://maxio.zendesk.com/hc/en- + * us/articles/24252185211533-Customer-Hierarchies-WhoPays). * * @return SiteResponse Response from the API call * @@ -84,7 +84,7 @@ public function clearSite(?string $cleanupScope = CleanupScope::ALL): void } /** - * Returns public keys used for Maxio.js (formerly Chargify.js). + * Lists public keys used for Maxio.js (formerly Chargify.js). * * @param array $options Array with all options for search * diff --git a/src/Controllers/SubscriptionComponentsController.php b/src/Controllers/SubscriptionComponentsController.php index 7fa853d1..d43b4abb 100644 --- a/src/Controllers/SubscriptionComponentsController.php +++ b/src/Controllers/SubscriptionComponentsController.php @@ -275,7 +275,7 @@ public function allocateComponent( } /** - * Returns the 50 most recent Allocations, ordered by most recent first. + * Lists the 50 most recent Allocations, ordered by most recent first. * * ## On/Off Components * @@ -665,8 +665,8 @@ public function createUsage( } /** - * Returns a list of usages associated with a subscription for a particular metered component. This - * will display the previously recorded components for a subscription. + * Lists usages associated with a subscription for a particular metered component. This will display + * the previously recorded components for a subscription. * * This endpoint is not compatible with quantity-based components. * @@ -730,18 +730,18 @@ public function listUsages(array $options): array /** * Activates an event-based component for a single subscription. * - * In order to bill your subscribers on your Events data under the Events-Based Billing feature, the - * components must be activated for the subscriber. + * To bill your subscribers on your Events data under the Events-Based Billing feature, the components + * must be activated for the subscriber. * - * Learn more about the role of activation in the [Events-Based Billing docs](https://maxio.zendesk. - * com/hc/en-us/articles/24260323329805-Events-Based-Billing-Overview). + * For more information, see [Design Your Catalog](https://docs.maxio.com/hc/en- + * us/articles/24181036583053-Design-Your-Catalog?method=componenttypes). * * Use this endpoint to activate an event-based component for a single subscription. Activating an - * event-based component causes Advanced Billing to bill for events when the subscription is renewed. + * event-based component causes billing for events when the subscription is renewed. * - * *Note: it is possible to stream events for a subscription at any time, regardless of component + * Note: it is possible to stream events for a subscription at any time, regardless of component * activation status. The activation status only determines if the subscription should be billed for - * event-based component usage at renewal.* + * event-based component usage at renewal. * * @param int $subscriptionId The Advanced Billing id of the subscription * @param int $componentId The Advanced Billing id of the component @@ -800,8 +800,6 @@ public function deactivateEventBasedComponent(int $subscriptionId, int $componen /** * Records a single event for Events-Based Billing. * - * ## Documentation - * * Events-Based Billing is an evolved form of metered billing that is based on data-rich events * streamed in real-time from your system to Advanced Billing. * @@ -810,15 +808,11 @@ public function deactivateEventBasedComponent(int $subscriptionId, int $componen * * This API allows you to stream events into the Advanced Billing data ingestion engine. * - * Learn more about the feature in general in the [Events-Based Billing help docs](https://maxio. - * zendesk.com/hc/en-us/articles/24260323329805-Events-Based-Billing-Overview). - * - * ## Record Event - * - * Use this endpoint to record a single event. + * For more information, see [Design Your Catalog](https://docs.maxio.com/hc/en- + * us/articles/24181036583053-Design-Your-Catalog?method=componenttypes). * - * *Note: this endpoint differs from the standard Chargify API endpoints in that the URL subdomain will - * be `events` and your site subdomain will be included in the URL path. For example:* + * Note: this endpoint differs from the standard URL for this API in that `events` and your site + * subdomain are included in the path. For example: * * ``` * https://events.chargify.com/my-site-subdomain/events/my-stream-api-handle @@ -826,7 +820,8 @@ public function deactivateEventBasedComponent(int $subscriptionId, int $componen * * @param string $apiHandle Identifies the Stream for which the event should be published. * @param string|null $storeUid If you've attached your own Keen project as an Advanced Billing - * event data-store, use this parameter to indicate the data-store. + * event data-store, use this parameter to indicate the data-store. This applies to + * Legacy Metering sites only — it has no effect on Maxio Metering sites. * @param EBBEvent|null $body * * @return void Response from the API call @@ -851,15 +846,16 @@ public function recordEvent(string $apiHandle, ?string $storeUid = null, ?EBBEve /** * Records a collection of events. * - * *Note: this endpoint differs from the standard Chargify API endpoints in that the subdomain will be - * `events` and your site subdomain will be included in the URL path.* + * Note: this endpoint differs from the standard URL for this API in that `events` and your site + * subdomain are included in the path. * * A maximum of 1000 events can be published in a single request. A 422 will be returned if this limit * is exceeded. * * @param string $apiHandle Identifies the Stream for which the events should be published. * @param string|null $storeUid If you've attached your own Keen project as an Advanced Billing - * event data-store, use this parameter to indicate the data-store. + * event data-store, use this parameter to indicate the data-store. This applies to + * Legacy Metering sites only — it has no effect on Maxio Metering sites. * @param EBBEvent[]|null $body * * @return void Response from the API call diff --git a/src/Controllers/SubscriptionGroupsController.php b/src/Controllers/SubscriptionGroupsController.php index e269ff28..a970b4d2 100644 --- a/src/Controllers/SubscriptionGroupsController.php +++ b/src/Controllers/SubscriptionGroupsController.php @@ -110,8 +110,8 @@ public function createSubscriptionGroup(?CreateSubscriptionGroupRequest $body = } /** - * Returns an array of subscription groups for the site. The response is paginated and will return a - * `meta` key with pagination information. + * Lists subscription groups for the site. The response is paginated and will return a `meta` key with + * pagination information. * * #### Account Balance Information * @@ -238,7 +238,7 @@ public function deleteSubscriptionGroup(string $uid): DeleteSubscriptionGroupRes /** * Finds the subscription group associated with a subscription. * - * If the subscription is not in a group, the endpoint will return a 404 code. + * If the subscription is not in a group, this endpoint returns an error. * * @param string $subscriptionId The Advanced Billing id of the subscription associated with the * subscription group @@ -261,10 +261,11 @@ public function findSubscriptionGroup(string $subscriptionId): FullSubscriptionG } /** - * For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en- - * us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https: - * //maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer- - * hierarchies) features, it is possible to add existing subscriptions to subscription groups. + * Adds an existing subscription to a subscription group. For sites making use of the [Relationship + * Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices- + * Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en-us/articles/24252185211533- + * Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is possible to add existing + * subscriptions to subscription groups. * * Passing `group` parameters with a `target` containing a `type` and optional `id` is all that's * needed. When the `target` parameter specifies a `"customer"` or `"subscription"` that is already @@ -314,10 +315,11 @@ public function addSubscriptionToGroup( } /** - * For sites making use of the [Relationship Billing](https://maxio.zendesk.com/hc/en- - * us/articles/24252287829645-Advanced-Billing-Invoices-Overview) and [Customer Hierarchy](https: - * //maxio.zendesk.com/hc/en-us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer- - * hierarchies) features, it is possible to remove an existing subscription from a subscription group. + * Removes an existing subscription from a subscription group. For sites making use of the + * [Relationship Billing](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing- + * Invoices-Overview) and [Customer Hierarchy](https://maxio.zendesk.com/hc/en- + * us/articles/24252185211533-Customer-Hierarchies-WhoPays#customer-hierarchies) features, it is + * possible to remove an existing subscription from a subscription group. * * @param int $subscriptionId The Chargify id of the subscription. * diff --git a/src/Controllers/SubscriptionNotesController.php b/src/Controllers/SubscriptionNotesController.php index 2781f506..5c58f919 100644 --- a/src/Controllers/SubscriptionNotesController.php +++ b/src/Controllers/SubscriptionNotesController.php @@ -26,14 +26,14 @@ class SubscriptionNotesController extends BaseController /** * Creates a note for a subscription. * - * ## How to Use Subscription Notes - * * Notes allow you to record information about a particular Subscription in a free text format. * - * If you have structured data such as birth date, color, etc., consider using Metadata instead. + * If you have structured data such as birth date, color, etc., consider using + * [Metadata]($e/Custom%20Fields/createMetadata) instead. * - * 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). + * For more information, see [Adding Notes](https://docs.maxio.com/hc/en-us/articles/24251654953997- + * Understanding-the-Subscription-Summary-Page#billing-portal-status:~:text=documentation%20for%20more.- + * ,Adding%20Notes,-Notes%20are%20optional) in the product documentation. * * @param int $subscriptionId The Chargify id of the subscription. * @param UpdateSubscriptionNoteRequest|null $body diff --git a/src/Controllers/SubscriptionProductsController.php b/src/Controllers/SubscriptionProductsController.php index f225891d..8eb10e10 100644 --- a/src/Controllers/SubscriptionProductsController.php +++ b/src/Controllers/SubscriptionProductsController.php @@ -27,26 +27,23 @@ class SubscriptionProductsController extends BaseController /** * Migrates a subscription to a different product. * - * In order to create a migration, you must pass the `product_id` or `product_handle` in the object - * when you send a POST request. You may also pass either a `product_price_point_id` or + * To create a migration, you must pass the `product_id` or `product_handle` in the object when you + * send a POST request. You can also pass either a `product_price_point_id` or * `product_price_point_handle` to choose which price point the subscription is moved to. If no price - * point identifier is passed the subscription will be moved to the products default price point. The - * response will be the updated subscription. + * point identifier is passed, the subscription is moved to the product's default price point. The + * response is the updated subscription. * * ## Valid Subscriptions * - * Subscriptions should be in the `active` or `trialing` state in order to be migrated. + * Subscriptions should be in the `active` or `trialing` state to be migrated. * * (For backwards compatibility reasons, it is possible to migrate a subscription that is in the * `trial_ended` state via the API, however this is not recommended. Since `trial_ended` is an end-of- * life state, the subscription should be canceled, the product changed, and then the subscription can * be reactivated.) * - * ## Migrations Documentation - * - * Full documentation on how to record Migrations in the Advanced Billing UI can be located - * [here](https://maxio.zendesk.com/hc/en-us/articles/24181589372429-Data-Migration-to-Advanced- - * Billing). + * For more information, see [Product Changes and Migrations](https://docs.maxio.com/hc/en- + * us/articles/24252069837581-Product-Changes-and-Migrations). * * ## Failed Migrations * diff --git a/src/Controllers/SubscriptionRenewalsController.php b/src/Controllers/SubscriptionRenewalsController.php index fc4005fa..d545a69c 100644 --- a/src/Controllers/SubscriptionRenewalsController.php +++ b/src/Controllers/SubscriptionRenewalsController.php @@ -235,7 +235,7 @@ public function lockInScheduledRenewalImmediately( } /** - * Returns a scheduled renewal configuration to an editable state. + * Restores a scheduled renewal configuration to an editable state. * * @param int $subscriptionId The Chargify id of the subscription. * @param int $id The renewal id. @@ -305,6 +305,11 @@ public function cancelScheduledRenewalConfiguration( /** * Adds product and component line items to the scheduled renewal. * + * If your site has list vs sales pricing enabled, accepts renewal_configuration_item.custom_price. + * list_price_point_id, validates and persists it; omitted value follows existing/default behavior; + * with list vs sales pricing disabled, parameter is ignored (no validation/behavioral impact). This + * functionality is supported in the API, but is not currently supported in SDKs. + * * @param int $subscriptionId The Chargify id of the subscription. * @param int $scheduledRenewalsConfigurationId The scheduled renewal configuration id. * @param ScheduledRenewalConfigurationItemRequest|null $body @@ -345,6 +350,11 @@ public function createScheduledRenewalConfigurationItem( /** * Updates an existing configuration item’s pricing and quantity. * + * If you site has list vs sales pricing enabled, accepts renewal_configuration_item.custom_price. + * list_price_point_id, validates and persists it; omitted value follows existing/default behavior; + * with list vs sales pricing disabled, parameter is ignored (no validation/behavioral impact). This + * functionality is supported in the API, but is not currently supported in SDKs. + * * @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. diff --git a/src/Controllers/SubscriptionStatusController.php b/src/Controllers/SubscriptionStatusController.php index 2a628840..44497bd5 100644 --- a/src/Controllers/SubscriptionStatusController.php +++ b/src/Controllers/SubscriptionStatusController.php @@ -545,15 +545,15 @@ public function cancelDunning(int $subscriptionId): SubscriptionResponse * be charged on their next renewal. * * The "Next Billing" amount and "Next Billing" date are already represented in the UI on each - * Subscriber's Summary. For more information, see our documentation [here](https://maxio.zendesk. - * com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). + * Subscriber's Summary. For more information, see [Subscriber Interface Overview](https://maxio. + * zendesk.com/hc/en-us/articles/24252493695757-Subscriber-Interface-Overview). * * ## Optional Component Fields * - * This endpoint is particularly useful due to the fact that it will return the computed billing amount - * for the base product and the components which are in use by a subscriber. + * This endpoint is particularly useful because it returns the computed billing amount for the base + * product and the components which are in use by a subscriber. * - * By default, the preview will include billing details for all components _at their **current** + * By default, the preview includes billing details for all components _at their **current** * quantities_. This means: * * * Current `allocated_quantity` for quantity-based components @@ -562,17 +562,17 @@ public function cancelDunning(int $subscriptionId): SubscriptionResponse * * Current metric quantity value for events recorded thus far for events-based components * * In the above statements, "current" means the quantity or value as of the call to the renewal preview - * endpoint. We do not predict end-of-period values for components, so metered or events-based usage + * endpoint. End-of-period values for components are not predicted, so metered or events-based usage * may be less than it will eventually be at the end of the period. * - * Optionally, **you may provide your own custom quantities** for any component to see a billing + * Optionally, **you can provide your own custom quantities** for any component to see a billing * preview for non-current quantities. This is accomplished by sending a request body with data under * the `components` key. See the request body documentation below. * - * ## Subscription Side Effects + * ## Preview Behavior * - * 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. + * Sending a `POST` request to this endpoint returns preview data without modifying the subscription. + * This method previews data, but does not log any changes against a subscription. * * @param int $subscriptionId The Chargify id of the subscription. * @param RenewalPreviewRequest|null $body diff --git a/src/Controllers/SubscriptionsController.php b/src/Controllers/SubscriptionsController.php index 46b65ea5..ff1720c7 100644 --- a/src/Controllers/SubscriptionsController.php +++ b/src/Controllers/SubscriptionsController.php @@ -19,9 +19,12 @@ use AdvancedBillingLib\Exceptions\SubscriptionResponseErrorException; use AdvancedBillingLib\Models\ActivateSubscriptionRequest; use AdvancedBillingLib\Models\AddCouponsRequest; +use AdvancedBillingLib\Models\CollectionMethod1; use AdvancedBillingLib\Models\CreateSubscriptionRequest; +use AdvancedBillingLib\Models\GroupStatus; use AdvancedBillingLib\Models\OverrideSubscriptionRequest; use AdvancedBillingLib\Models\PrepaidConfigurationResponse; +use AdvancedBillingLib\Models\QScope; use AdvancedBillingLib\Models\SortingDirection; use AdvancedBillingLib\Models\SubscriptionDateField; use AdvancedBillingLib\Models\SubscriptionInclude; @@ -56,6 +59,61 @@ class SubscriptionsController extends BaseController * Select an option from the **Request Examples** drop-down on the right side of the portal to see * examples of common scenarios for creating subscriptions. * + * ## List vs Sales Pricing + * + * When a subscription uses custom pricing as the sales price, you can optionally provide a list price + * for any item. If omitted, the list price defaults to the sales price. The difference between the + * list price and sales price is used to calculate implicit discounts, which appear on Invoices and in + * reporting. List price can also support revenue allocations in [Advanced Revenue](https://docs.maxio. + * com/hc/en-us/articles/24177001342861-Create-and-Configure-RevenueBooks). + * + * If your site has list pricing enabled, the API accepts `custom_price.list_price_point_id` for custom + * pricing, validates and persists it, and returns list price metadata in subscription responses. If + * list pricing is disabled, this input is ignored and related response fields are omitted. + * + * When list pricing is enabled: + * + * - Subscription → Product `product_price_point_list_price_point_id` (integer) + * - `product_price_point_list_price_point_handle` (string) + * - Subscription Components (when components are included in the response, such as with subscriptions + * built from components or component serialization paths) `component_id` (integer) + * - `price_point_id` (integer) + * - `list_price_point_id` (integer) + * + * When list pricing is disabled: + * + * - Subscription → Product `product_price_point_list_price_point_id`: omitted + * - `product_price_point_list_price_point_handle`: omitted + * - Subscription Components `list_price_point_id`: omitted + * + * This functionality is supported in the API, but is not currently supported in SDKs. + * + * ## Subscriptions can now work independently from the catalog + * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, you can create subscriptions without a `product_id` or + * `product_handle` using POST /subscriptions, building them entirely from components. + * + * A valid subscription must include at least one active component with: + * - a positive `allocated_quantity`, + * - a positive `unit_balance`, or + * - 'enabled: true' (for on/off components) + * - a configured metered component + * + * `component_id` can be provided as a numeric ID or in handle: format. If `trial_interval` and + * `trial_interval_unit` are included, they are applied at creation. + * + * In the response, product and product price point fields are null, and component details are returned + * instead. + * + * This functionality is supported in the API, but is not currently supported in SDKs. + * + * ## Payment information + * + * Payment information may be required to create a subscription, depending on the options for the + * Product being subscribed. See [product options](https://docs.maxio.com/hc/en- + * us/articles/24261076617869-Edit-Products) for more information. See the [Payments + * Profile]($e/Payment%20Profiles/createPaymentProfile) endpoint for details on payment parameters. * See the [Subscription Signups](page:introduction/basic-concepts/subscription-signup) article for * more information on working with subscriptions in Advanced Billing. * @@ -112,8 +170,13 @@ public function createSubscription(?CreateSubscriptionRequest $body = null): Sub } /** - * 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. + * Lists subscriptions for a site. Use the query string filters and pagination to control responses + * from the server. + * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, some subscriptions may not have an associated product. For + * subscriptions without an associated product, 'product', 'product_price_point_id', and + * 'product_price_point_type' are returned as 'null'. * * ## Search for a subscription * @@ -138,14 +201,36 @@ public function listSubscriptions(array $options): array ->parameters( QueryParam::init('page', $options)->unIndexed()->extract('page', 1), QueryParam::init('per_page', $options)->unIndexed()->extract('perPage', 20), + QueryParam::init('sort', $options) + ->unIndexed() + ->extract('sort', SubscriptionSort::SIGNUP_DATE) + ->serializeBy([SubscriptionSort::class, 'checkValue']), + QueryParam::init('direction', $options) + ->unIndexed() + ->extract('direction') + ->serializeBy([SortingDirection::class, 'checkValue']), QueryParam::init('state', $options) ->unIndexed() ->extract('state') ->serializeBy([SubscriptionStateFilter::class, 'checkValue']), - QueryParam::init('product', $options)->unIndexed()->extract('product'), + QueryParam::init('product', $options) + ->unIndexed() + ->extract('product') + ->strictType('anyOf(oneOf(int,string),null)'), + QueryParam::init('q', $options)->unIndexed()->extract('q'), + QueryParam::init('q_scope', $options) + ->unIndexed() + ->extract('qScope') + ->serializeBy([QScope::class, 'checkValue']), + QueryParam::init('customer_id', $options)->unIndexed()->extract('customerId'), QueryParam::init('product_price_point_id', $options)->unIndexed()->extract('productPricePointId'), QueryParam::init('coupon', $options)->unIndexed()->extract('coupon'), QueryParam::init('coupon_code', $options)->unIndexed()->extract('couponCode'), + QueryParam::init('collection_method', $options) + ->unIndexed() + ->extract('collectionMethod') + ->serializeBy([CollectionMethod1::class, 'checkValue']), + QueryParam::init('branding_theme_id', $options)->unIndexed()->extract('brandingThemeId'), QueryParam::init('date_field', $options) ->unIndexed() ->extract('dateField') @@ -167,14 +252,13 @@ public function listSubscriptions(array $options): array ->extract('endDatetime') ->serializeBy([DateTimeHelper::class, 'toRfc3339DateTime']), QueryParam::init('metadata', $options)->unIndexed()->extract('metadata'), - QueryParam::init('direction', $options) - ->unIndexed() - ->extract('direction') - ->serializeBy([SortingDirection::class, 'checkValue']), - QueryParam::init('sort', $options) + QueryParam::init('group_status', $options) ->unIndexed() - ->extract('sort', SubscriptionSort::SIGNUP_DATE) - ->serializeBy([SubscriptionSort::class, 'checkValue']), + ->extract('groupStatus') + ->serializeBy([GroupStatus::class, 'checkValue']), + QueryParam::init('dunning_exemption', $options)->unIndexed()->extract('dunningExemption'), + QueryParam::init('payment_gateways', $options)->unIndexed()->extract('paymentGateways'), + QueryParam::init('currencies', $options)->unIndexed()->extract('currencies'), QueryParam::init('include', $options) ->unIndexed() ->extract('mInclude') @@ -265,10 +349,15 @@ public function listSubscriptions(array $options): array * eligible for calendar billing**. * * > Note: If you change the product associated with a subscription that contains a `snap_day` and - * immediately `READ/GET` the subscription data, it will still contain original `snap_day`. The - * `snap_day` will reset to null on the next billing cycle. This is because a product change is + * immediately READ/GET the subscription data, it will still contain the original `snap_day`. The + * `snap_day` will be reset to `null` on the next billing cycle. This is because a product change is * instantaneous and only affects the product associated with a subscription. * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, some subscriptions may not have an associated product. For + * subscriptions without an associated product, `product`, `product_price_point_id`, and + * `product_price_point_type` are returned as `null`. + * * @param int $subscriptionId The Chargify id of the subscription. * @param UpdateSubscriptionRequest|null $body * @@ -304,6 +393,11 @@ public function updateSubscription( /** * Retrieves subscription details. * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, some subscriptions may not have an associated product. For + * subscriptions without an associated product, 'product', 'product_price_point_id', and + * 'product_price_point_type' are returned as 'null'. + * * ## Self-Service Page token * * Self-Service Page token for the subscription is not returned by default. If this information is @@ -421,7 +515,7 @@ public function findSubscription(?string $reference = null): SubscriptionRespons /** * Purges an individual subscription for sites in test mode. * - * Provide the subscription ID in the url. To confirm, supply the customer ID in the query string + * Provide the subscription ID in the URL. To confirm, supply the customer ID in the query string * `ack` parameter. You may also delete the customer record and/or payment profiles by passing * `cascade` parameters. For example, to delete just the customer record, the query params would be: `? * ack={customer_id}&cascade[]=customer` @@ -508,37 +602,54 @@ public function updatePrepaidSubscriptionConfiguration( * * The "Next Billing" amount and "Next Billing" date are represented in each Subscriber's Summary. * - * A subscription will not be created by utilizing this endpoint; it is meant to serve as a prediction. + * This endpoint does not create a subscription; it is meant to serve as a prediction. * - * For more information, see our documentation [here](https://maxio.zendesk.com/hc/en- + * For more information, see [Subscriber Interface Overview](https://maxio.zendesk.com/hc/en- * us/articles/24252493695757-Subscriber-Interface-Overview). * + * ## Subscriptions can now work independently from the catalog + * + * If you have the new [Catalog experience](page:help/announcements/2026-announcements#new-catalog- + * experience-and-terminology) enabled, you can create subscriptions without a `product_id` or + * `product_handle` using POST /subscriptions, building them entirely from components. + * + * A valid subscription must include at least one active component with: + * - a positive `allocated_quantity`, + * - a positive `unit_balance`, or + * - 'enabled: true' (for on/off components) + * + * `component_id` can be provided as a numeric ID or in handle: format. If `trial_interval` and + * `trial_interval_unit` are included, they are applied at creation. + * + * In the response, product and product price point fields are null, and component details are returned + * instead. + * + * This functionality is supported in the API, but is not currently supported in SDKs. + * * ## Taxable Subscriptions * - * This endpoint will preview taxes applicable to a purchase. In order for taxes to be previewed, the - * following conditions must be met: + * This endpoint previews taxes applicable to a purchase. For taxes to be previewed, the following + * conditions must be met: * * + Taxes must be configured on the subscription * + The preview must be for the purchase of a taxable product or component, or combination of the two. - * + The subscription payload must contain a full billing or shipping address in order to calculate - * tax + * + The subscription payload must contain a full billing or shipping address to calculate tax * - * For more information about creating taxable previews, see our documentation guide on how to create - * [taxable subscriptions.](https://maxio.zendesk.com/hc/en-us/sections/24287012349325-Taxes) + * For more information about creating taxable previews, see [Taxes](https://maxio.zendesk.com/hc/en- + * us/sections/24287012349325-Taxes). * * You do **not** need to include a card number to generate tax information when you are previewing a * subscription. However, when you actually want to create the subscription, you must include the - * credit card information if you want the billing address to be stored in Advanced Billing. The - * billing address and the credit card information are stored together within the payment profile - * object. Also, you may not send a billing address to Advanced Billing without payment profile - * information, as the address is stored on the card. + * credit card information if you want the billing address to be stored. The billing address and the + * credit card information are stored together within the payment profile object. Also, you cannot send + * a billing address without payment profile information, as the address is stored on the card. * * You can pass shipping and billing addresses and still decide not to calculate taxes. To do that, * pass `skip_billing_manifest_taxes: true` attribute. * * ## Non-taxable Subscriptions * - * If you'd like to calculate subscriptions that do not include tax you may leave off the billing + * If you'd like to calculate subscriptions that do not include tax, you can leave off the billing * information. * * @param CreateSubscriptionRequest|null $body @@ -616,9 +727,9 @@ public function applyCouponsToSubscription( /** * Removes a coupon from an existing subscription. * - * For more information on the expected behavior of removing a coupon from a subscription, see our - * documentation [here.](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and- - * Subscriptions#removing-a-coupon) + * For more information on the expected behavior of removing a coupon from a subscription, see [Coupons + * and Subscriptions](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 string|null $couponCode The coupon code @@ -653,21 +764,18 @@ public function removeCouponFromSubscription(int $subscriptionId, ?string $coupo /** * Activates awaiting signup and trialing subscriptions. This feature is only available on the - * Relationship Invoicing architecture. Subscriptions in a group may not be activated immediately. - * - * For details on how the activation works, and how to activate subscriptions through the application, - * see [activation](#). + * Relationship Invoicing architecture. Subscriptions in a group cannot be activated immediately. * * The `revert_on_failure` parameter controls the behavior upon activation failure. - * - If set to `true` and something goes wrong i.e. payment fails, then Advanced Billing will not - * change the subscription's state. The subscription’s billing period will also remain the same. - * - If set to `false` and something goes wrong i.e. payment fails, then Advanced Billing will continue - * through with the activation and enter an end of life state. For trialing subscriptions, that will - * either be trial ended (if the trial is no obligation), past due (if the trial has an obligation), or - * canceled (if the site has no dunning strategy, or has a strategy that says to cancel immediately). - * For awaiting signup subscriptions, that will always be canceled. - * - * The default activation failure behavior can be configured per activation attempt, or you may set a + * - If set to `true` and something goes wrong i.e. payment fails, the subscription's state does not + * change. The subscription’s billing period also remains the same. + * - If set to `false` and something goes wrong i.e. payment fails, the activation continues and enters + * an end of life state. For trialing subscriptions, that is either trial ended (if the trial is no + * obligation), past due (if the trial has an obligation), or canceled (if the site has no dunning + * strategy, or has a strategy that says to cancel immediately). For awaiting signup subscriptions, + * that is always canceled. + * + * The default activation failure behavior can be configured per activation attempt, or you can set a * default value under Config > Settings > Subscription Activation Settings. * * ## Activation Scenarios @@ -700,11 +808,11 @@ public function removeCouponFromSubscription(int $subscriptionId, ?string $coupo * * ### Activate Trialing subscription * - * You can read more about the behavior of trialing subscriptions [here](https://maxio.zendesk. - * com/hc/en-us/articles/24252155721869-Trialing-Subscriptions). - * When the `revert_on_failure` parameter is set to `true`, the subscription's state will remain as - * Trialing, we will void the invoice from activation and return any prepayments and credits applied to - * the invoice back to the subscription. + * For more information about the behavior of trialing subscriptions, see [Trialing + * Subscriptions](https://maxio.zendesk.com/hc/en-us/articles/24252155721869-Trialing-Subscriptions). + * When the `revert_on_failure` parameter is set to `true`, the subscription's state remains Trialing; + * the invoice from activation is voided, and any prepayments and credits applied to the invoice are + * returned to the subscription. * * * @param int $subscriptionId The Chargify id of the subscription. diff --git a/src/Controllers/WebhooksController.php b/src/Controllers/WebhooksController.php index 42e6aa3e..aba03bb8 100644 --- a/src/Controllers/WebhooksController.php +++ b/src/Controllers/WebhooksController.php @@ -139,7 +139,7 @@ public function createEndpoint(?CreateOrUpdateEndpointRequest $body = null): End } /** - * Returns created endpoints for a site. + * Lists endpoints configured for a site. * * @return Endpoint[] Response from the API call * diff --git a/src/Models/AccountBalances.php b/src/Models/AccountBalances.php index fbf9cdbe..7ed07c2e 100644 --- a/src/Models/AccountBalances.php +++ b/src/Models/AccountBalances.php @@ -42,7 +42,7 @@ class AccountBalances implements \JsonSerializable /** * Returns Open Invoices. - * The balance, in cents, of the sum of the subscription's open, payable invoices. + * The balance, in cents, of the sum of the subscription's open, payable invoices. */ public function getOpenInvoices(): ?AccountBalance { @@ -51,7 +51,7 @@ public function getOpenInvoices(): ?AccountBalance /** * Sets Open Invoices. - * The balance, in cents, of the sum of the subscription's open, payable invoices. + * The balance, in cents, of the sum of the subscription's open, payable invoices. * * @maps open_invoices */ @@ -62,7 +62,7 @@ public function setOpenInvoices(?AccountBalance $openInvoices): void /** * Returns Pending Invoices. - * The balance, in cents, of the sum of the subscription's pending, payable invoices. + * The balance, in cents, of the sum of the subscription's pending, payable invoices. */ public function getPendingInvoices(): ?AccountBalance { @@ -71,7 +71,7 @@ public function getPendingInvoices(): ?AccountBalance /** * Sets Pending Invoices. - * The balance, in cents, of the sum of the subscription's pending, payable invoices. + * The balance, in cents, of the sum of the subscription's pending, payable invoices. * * @maps pending_invoices */ diff --git a/src/Models/ActivateSubscriptionRequest.php b/src/Models/ActivateSubscriptionRequest.php index 85a9ad89..8395da9d 100644 --- a/src/Models/ActivateSubscriptionRequest.php +++ b/src/Models/ActivateSubscriptionRequest.php @@ -23,9 +23,9 @@ class ActivateSubscriptionRequest implements \JsonSerializable /** * Returns Revert on Failure. * You may choose how to handle the activation failure. `true` means do not change the subscription’s - * state and billing period. `false` means to continue through with the activation and enter an end of - * life state. If this parameter is omitted or `null` is passed it will default to value set in the - * site settings (default: `true`) + * state and billing period. `false` means to continue through with the activation and enter an end-of- + * life state. If this parameter is omitted or `null` is passed it will default to the value set in the + * site settings (default: `true`). */ public function getRevertOnFailure(): ?bool { @@ -38,9 +38,9 @@ public function getRevertOnFailure(): ?bool /** * Sets Revert on Failure. * You may choose how to handle the activation failure. `true` means do not change the subscription’s - * state and billing period. `false` means to continue through with the activation and enter an end of - * life state. If this parameter is omitted or `null` is passed it will default to value set in the - * site settings (default: `true`) + * state and billing period. `false` means to continue through with the activation and enter an end-of- + * life state. If this parameter is omitted or `null` is passed it will default to the value set in the + * site settings (default: `true`). * * @maps revert_on_failure */ @@ -52,9 +52,9 @@ public function setRevertOnFailure(?bool $revertOnFailure): void /** * Unsets Revert on Failure. * You may choose how to handle the activation failure. `true` means do not change the subscription’s - * state and billing period. `false` means to continue through with the activation and enter an end of - * life state. If this parameter is omitted or `null` is passed it will default to value set in the - * site settings (default: `true`) + * state and billing period. `false` means to continue through with the activation and enter an end-of- + * life state. If this parameter is omitted or `null` is passed it will default to the value set in the + * site settings (default: `true`). */ public function unsetRevertOnFailure(): void { diff --git a/src/Models/AgreementAcceptance.php b/src/Models/AgreementAcceptance.php index 0f859363..e069f644 100644 --- a/src/Models/AgreementAcceptance.php +++ b/src/Models/AgreementAcceptance.php @@ -70,7 +70,7 @@ public function setIpAddress(?string $ipAddress): void /** * Returns Terms Url. - * Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url + * Required when creating a subscription with Maxio Payments. Either terms_url or privacy_policy_url is * required when providing agreement_acceptance params. */ public function getTermsUrl(): ?string @@ -80,7 +80,7 @@ public function getTermsUrl(): ?string /** * Sets Terms Url. - * Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url + * Required when creating a subscription with Maxio Payments. Either terms_url or privacy_policy_url is * required when providing agreement_acceptance params. * * @maps terms_url diff --git a/src/Models/AllocateComponents.php b/src/Models/AllocateComponents.php index e7f7f92a..7701264d 100644 --- a/src/Models/AllocateComponents.php +++ b/src/Models/AllocateComponents.php @@ -206,7 +206,7 @@ public function unsetDowngradeCredit(): void /** * Returns Payment Collection Method. * (Optional) If not passed, the allocation(s) will use the payment collection method on the - * subscription + * subscription. */ public function getPaymentCollectionMethod(): ?string { @@ -216,7 +216,7 @@ public function getPaymentCollectionMethod(): ?string /** * Sets Payment Collection Method. * (Optional) If not passed, the allocation(s) will use the payment collection method on the - * subscription + * subscription. * * @maps payment_collection_method * @factory \AdvancedBillingLib\Models\CollectionMethod::checkValue diff --git a/src/Models/Allocation.php b/src/Models/Allocation.php index 638730b2..959afd26 100644 --- a/src/Models/Allocation.php +++ b/src/Models/Allocation.php @@ -143,7 +143,7 @@ class Allocation implements \JsonSerializable /** * Returns Allocation Id. - * The allocation unique id + * The allocation unique ID */ public function getAllocationId(): ?int { @@ -152,7 +152,7 @@ public function getAllocationId(): ?int /** * Sets Allocation Id. - * The allocation unique id + * The allocation unique ID * * @maps allocation_id */ @@ -164,7 +164,7 @@ public function setAllocationId(?int $allocationId): void /** * Returns Component Id. * The integer component ID for the allocation. This references a component that you have created in - * your Product setup + * your Product setup. */ public function getComponentId(): ?int { @@ -174,7 +174,7 @@ public function getComponentId(): ?int /** * Sets Component Id. * The integer component ID for the allocation. This references a component that you have created in - * your Product setup + * your Product setup. * * @maps component_id */ @@ -185,8 +185,7 @@ public function setComponentId(?int $componentId): void /** * Returns Component Handle. - * The handle of the component. This references a component that you have created in your Product - * setup + * The handle of the component. This references a component that you have created in your Product setup. */ public function getComponentHandle(): ?string { @@ -198,8 +197,7 @@ public function getComponentHandle(): ?string /** * Sets Component Handle. - * The handle of the component. This references a component that you have created in your Product - * setup + * The handle of the component. This references a component that you have created in your Product setup. * * @maps component_handle */ @@ -210,8 +208,7 @@ public function setComponentHandle(?string $componentHandle): void /** * Unsets Component Handle. - * The handle of the component. This references a component that you have created in your Product - * setup + * The handle of the component. This references a component that you have created in your Product setup. */ public function unsetComponentHandle(): void { @@ -220,7 +217,7 @@ public function unsetComponentHandle(): void /** * Returns Subscription Id. - * The integer subscription ID for the allocation. This references a unique subscription in your Site + * The integer subscription ID for the allocation. This references a unique subscription in your Site. */ public function getSubscriptionId(): ?int { @@ -229,7 +226,7 @@ public function getSubscriptionId(): ?int /** * Sets Subscription Id. - * The integer subscription ID for the allocation. This references a unique subscription in your Site + * The integer subscription ID for the allocation. This references a unique subscription in your Site. * * @maps subscription_id */ @@ -240,7 +237,7 @@ public function setSubscriptionId(?int $subscriptionId): void /** * Returns Quantity. - * The allocated quantity set in to effect by the allocation. String for components supporting + * The allocated quantity set into effect by the allocation. String for components supporting * fractional quantities * * @return int|string|null @@ -252,7 +249,7 @@ public function getQuantity() /** * Sets Quantity. - * The allocated quantity set in to effect by the allocation. String for components supporting + * The allocated quantity set into effect by the allocation. String for components supporting * fractional quantities * * @maps quantity @@ -326,7 +323,8 @@ public function unsetMemo(): void /** * Returns Timestamp. - * The time that the allocation was recorded, in format and UTC timezone, i.e. 2012-11-20T22:00:37Z + * The time that the allocation was recorded, in ISO 8601 format and UTC timezone, e.g., 2012-11-20T22: + * 00:37Z */ public function getTimestamp(): ?\DateTime { @@ -335,7 +333,8 @@ public function getTimestamp(): ?\DateTime /** * Sets Timestamp. - * The time that the allocation was recorded, in format and UTC timezone, i.e. 2012-11-20T22:00:37Z + * The time that the allocation was recorded, in ISO 8601 format and UTC timezone, e.g., 2012-11-20T22: + * 00:37Z * * @maps timestamp * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime @@ -466,7 +465,7 @@ public function setPricePointHandle(?string $pricePointHandle): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -477,7 +476,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * diff --git a/src/Models/AllocationPreviewItem.php b/src/Models/AllocationPreviewItem.php index 14763b47..c77f7286 100644 --- a/src/Models/AllocationPreviewItem.php +++ b/src/Models/AllocationPreviewItem.php @@ -391,7 +391,7 @@ public function setPricePointId(?int $pricePointId): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -402,7 +402,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * diff --git a/src/Models/AllocationPreviewLineItem.php b/src/Models/AllocationPreviewLineItem.php index 968f7d14..a6985c78 100644 --- a/src/Models/AllocationPreviewLineItem.php +++ b/src/Models/AllocationPreviewLineItem.php @@ -212,7 +212,7 @@ public function setComponentHandle(?string $componentHandle): void /** * Returns Direction. - * Visible when using Fine-grained Component Control + * Visible when using Fine-grained Component Control. */ public function getDirection(): ?string { @@ -221,7 +221,7 @@ public function getDirection(): ?string /** * Sets Direction. - * Visible when using Fine-grained Component Control + * Visible when using Fine-grained Component Control. * * @maps direction * @factory \AdvancedBillingLib\Models\AllocationPreviewDirection::checkValue diff --git a/src/Models/ApplePayPaymentProfile.php b/src/Models/ApplePayPaymentProfile.php index f146d9bb..4e207349 100644 --- a/src/Models/ApplePayPaymentProfile.php +++ b/src/Models/ApplePayPaymentProfile.php @@ -176,7 +176,7 @@ public function setLastName(?string $lastName): void /** * Returns Customer Id. - * The Chargify-assigned id for the customer record to which the Apple Pay account belongs + * The Chargify-assigned ID for the customer record to which the Apple Pay account belongs */ public function getCustomerId(): ?int { @@ -185,7 +185,7 @@ public function getCustomerId(): ?int /** * Sets Customer Id. - * The Chargify-assigned id for the customer record to which the Apple Pay account belongs + * The Chargify-assigned ID for the customer record to which the Apple Pay account belongs * * @maps customer_id */ diff --git a/src/Models/ApplyCreditNoteEventData.php b/src/Models/ApplyCreditNoteEventData.php index 92554046..2c5540e6 100644 --- a/src/Models/ApplyCreditNoteEventData.php +++ b/src/Models/ApplyCreditNoteEventData.php @@ -274,7 +274,7 @@ public function setRole(?string $role): void /** * Returns Consolidated Invoice. - * Shows whether it was applied to consolidated invoice or not + * Shows whether it was applied to consolidated invoice or not. */ public function getConsolidatedInvoice(): ?bool { @@ -283,7 +283,7 @@ public function getConsolidatedInvoice(): ?bool /** * Sets Consolidated Invoice. - * Shows whether it was applied to consolidated invoice or not + * Shows whether it was applied to consolidated invoice or not. * * @maps consolidated_invoice */ diff --git a/src/Models/BankAccountAttributes.php b/src/Models/BankAccountAttributes.php index dcc3f7a3..869d21b2 100644 --- a/src/Models/BankAccountAttributes.php +++ b/src/Models/BankAccountAttributes.php @@ -117,8 +117,8 @@ public function setBankName(?string $bankName): void /** * Returns Bank Routing Number. - * (Required when creating a subscription with ACH. Optional when creating a subscription with - * GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API + * (Required when creating a subscription with ACH; optional when creating a subscription with + * GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API. */ public function getBankRoutingNumber(): ?string { @@ -127,8 +127,8 @@ public function getBankRoutingNumber(): ?string /** * Sets Bank Routing Number. - * (Required when creating a subscription with ACH. Optional when creating a subscription with - * GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API + * (Required when creating a subscription with ACH; optional when creating a subscription with + * GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API. * * @maps bank_routing_number */ @@ -183,7 +183,7 @@ public function setBankAccountType(?string $bankAccountType): void /** * Returns Bank Branch Code. * (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be - * provided + * provided. */ public function getBankBranchCode(): ?string { @@ -193,7 +193,7 @@ public function getBankBranchCode(): ?string /** * Sets Bank Branch Code. * (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be - * provided + * provided. * * @maps bank_branch_code */ @@ -205,7 +205,7 @@ public function setBankBranchCode(?string $bankBranchCode): void /** * Returns Bank Iban. * (Optional when creating a subscription with GoCardless). International Bank Account Number. - * Alternatively, local bank details can be provided + * Alternatively, local bank details can be provided. */ public function getBankIban(): ?string { @@ -215,7 +215,7 @@ public function getBankIban(): ?string /** * Sets Bank Iban. * (Optional when creating a subscription with GoCardless). International Bank Account Number. - * Alternatively, local bank details can be provided + * Alternatively, local bank details can be provided. * * @maps bank_iban */ diff --git a/src/Models/BankAccountPaymentProfile.php b/src/Models/BankAccountPaymentProfile.php index 1c83210f..b9bd6047 100644 --- a/src/Models/BankAccountPaymentProfile.php +++ b/src/Models/BankAccountPaymentProfile.php @@ -148,7 +148,7 @@ public function __construct(string $paymentType) * Returns Id. * The Chargify-assigned ID of the stored bank account. This value can be used as an input to * payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the - * same customer + * same customer. */ public function getId(): ?int { @@ -159,7 +159,7 @@ public function getId(): ?int * Sets Id. * The Chargify-assigned ID of the stored bank account. This value can be used as an input to * payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the - * same customer + * same customer. * * @maps id */ @@ -210,7 +210,7 @@ public function setLastName(?string $lastName): void /** * Returns Customer Id. - * The Chargify-assigned id for the customer record to which the bank account belongs + * The Chargify-assigned ID for the customer record to which the bank account belongs */ public function getCustomerId(): ?int { @@ -219,7 +219,7 @@ public function getCustomerId(): ?int /** * Sets Customer Id. - * The Chargify-assigned id for the customer record to which the bank account belongs + * The Chargify-assigned ID for the customer record to which the bank account belongs * * @maps customer_id */ @@ -519,7 +519,7 @@ public function setBankName(?string $bankName): void /** * Returns Masked Bank Routing Number. * A string representation of the stored bank routing number with all but the last 4 digits marked with - * X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account + * X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account. */ public function getMaskedBankRoutingNumber(): ?string { @@ -532,7 +532,7 @@ public function getMaskedBankRoutingNumber(): ?string /** * Sets Masked Bank Routing Number. * A string representation of the stored bank routing number with all but the last 4 digits marked with - * X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account + * X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account. * * @maps masked_bank_routing_number */ @@ -544,7 +544,7 @@ public function setMaskedBankRoutingNumber(?string $maskedBankRoutingNumber): vo /** * Unsets Masked Bank Routing Number. * A string representation of the stored bank routing number with all but the last 4 digits marked with - * X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account + * X's (i.e. 'XXXXXXX1111'). payment_type will be bank_account. */ public function unsetMaskedBankRoutingNumber(): void { @@ -554,7 +554,7 @@ public function unsetMaskedBankRoutingNumber(): void /** * Returns Masked Bank Account Number. * A string representation of the stored bank account number with all but the last 4 digits marked with - * X's (i.e. 'XXXXXXX1111') + * X's (i.e. 'XXXXXXX1111'). */ public function getMaskedBankAccountNumber(): ?string { @@ -567,7 +567,7 @@ public function getMaskedBankAccountNumber(): ?string /** * Sets Masked Bank Account Number. * A string representation of the stored bank account number with all but the last 4 digits marked with - * X's (i.e. 'XXXXXXX1111') + * X's (i.e. 'XXXXXXX1111'). * * @maps masked_bank_account_number */ @@ -579,7 +579,7 @@ public function setMaskedBankAccountNumber(?string $maskedBankAccountNumber): vo /** * Unsets Masked Bank Account Number. * A string representation of the stored bank account number with all but the last 4 digits marked with - * X's (i.e. 'XXXXXXX1111') + * X's (i.e. 'XXXXXXX1111'). */ public function unsetMaskedBankAccountNumber(): void { @@ -650,8 +650,8 @@ public function setPaymentType(string $paymentType): void /** * Returns Verified. - * denotes whether a bank account has been verified by providing the amounts of two small deposits made - * into the account + * Denotes whether a bank account has been verified by providing the amounts of two small deposits made + * into the account. */ public function getVerified(): ?bool { @@ -660,8 +660,8 @@ public function getVerified(): ?bool /** * Sets Verified. - * denotes whether a bank account has been verified by providing the amounts of two small deposits made - * into the account + * Denotes whether a bank account has been verified by providing the amounts of two small deposits made + * into the account. * * @maps verified */ diff --git a/src/Models/Builders/ComponentBuilder.php b/src/Models/Builders/ComponentBuilder.php index 02104860..ec386bf4 100644 --- a/src/Models/Builders/ComponentBuilder.php +++ b/src/Models/Builders/ComponentBuilder.php @@ -577,6 +577,26 @@ public function unsetIntervalUnit(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/CreateCustomerBuilder.php b/src/Models/Builders/CreateCustomerBuilder.php index c057fe9c..271c27b2 100644 --- a/src/Models/Builders/CreateCustomerBuilder.php +++ b/src/Models/Builders/CreateCustomerBuilder.php @@ -185,6 +185,17 @@ public function taxExempt(?bool $value): self return $this; } + /** + * Sets surcharging field. + * + * @param bool|null $value + */ + public function surcharging(?bool $value): self + { + $this->instance->setSurcharging($value); + return $this; + } + /** * Sets tax exempt reason field. * @@ -236,6 +247,26 @@ public function unsetSalesforceId(): self return $this; } + /** + * Sets branding theme id field. + * + * @param int|null $value + */ + public function brandingThemeId(?int $value): self + { + $this->instance->setBrandingThemeId($value); + return $this; + } + + /** + * Unsets branding theme id field. + */ + public function unsetBrandingThemeId(): self + { + $this->instance->unsetBrandingThemeId(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/CreateOrUpdateProductBuilder.php b/src/Models/Builders/CreateOrUpdateProductBuilder.php index 72691c21..31db13d0 100644 --- a/src/Models/Builders/CreateOrUpdateProductBuilder.php +++ b/src/Models/Builders/CreateOrUpdateProductBuilder.php @@ -197,6 +197,26 @@ public function taxCode(?string $value): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/CreateProductFamilyBuilder.php b/src/Models/Builders/CreateProductFamilyBuilder.php index a9206f95..57db91ca 100644 --- a/src/Models/Builders/CreateProductFamilyBuilder.php +++ b/src/Models/Builders/CreateProductFamilyBuilder.php @@ -80,6 +80,17 @@ public function unsetDescription(): self return $this; } + /** + * Sets surcharging field. + * + * @param bool|null $value + */ + public function surcharging(?bool $value): self + { + $this->instance->setSurcharging($value); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/CreateSubscriptionBuilder.php b/src/Models/Builders/CreateSubscriptionBuilder.php index 0a03002f..6a0ab9e4 100644 --- a/src/Models/Builders/CreateSubscriptionBuilder.php +++ b/src/Models/Builders/CreateSubscriptionBuilder.php @@ -169,6 +169,26 @@ public function customerId(?int $value): self return $this; } + /** + * Sets branding theme id field. + * + * @param int|null $value + */ + public function brandingThemeId(?int $value): self + { + $this->instance->setBrandingThemeId($value); + return $this; + } + + /** + * Unsets branding theme id field. + */ + public function unsetBrandingThemeId(): self + { + $this->instance->unsetBrandingThemeId(); + return $this; + } + /** * Sets next billing at field. * diff --git a/src/Models/Builders/CreateSubscriptionComponentBuilder.php b/src/Models/Builders/CreateSubscriptionComponentBuilder.php index c030fd62..ab5444e1 100644 --- a/src/Models/Builders/CreateSubscriptionComponentBuilder.php +++ b/src/Models/Builders/CreateSubscriptionComponentBuilder.php @@ -64,9 +64,9 @@ public function enabled(?bool $value): self /** * Sets unit balance field. * - * @param int|null $value + * @param int|string|null $value */ - public function unitBalance(?int $value): self + public function unitBalance($value): self { $this->instance->setUnitBalance($value); return $this; diff --git a/src/Models/Builders/CreditCardPaymentProfileBuilder.php b/src/Models/Builders/CreditCardPaymentProfileBuilder.php index a4b1763c..0d33ddfb 100644 --- a/src/Models/Builders/CreditCardPaymentProfileBuilder.php +++ b/src/Models/Builders/CreditCardPaymentProfileBuilder.php @@ -95,6 +95,15 @@ public function cardType(?string $value): self return $this; } + /** + * Unsets card type field. + */ + public function unsetCardType(): self + { + $this->instance->unsetCardType(); + return $this; + } + /** * Sets expiration month field. * diff --git a/src/Models/Builders/CustomerAttributesBuilder.php b/src/Models/Builders/CustomerAttributesBuilder.php index 5932c63f..cde2c456 100644 --- a/src/Models/Builders/CustomerAttributesBuilder.php +++ b/src/Models/Builders/CustomerAttributesBuilder.php @@ -212,6 +212,17 @@ public function taxExempt(?bool $value): self return $this; } + /** + * Sets surcharging field. + * + * @param bool|null $value + */ + public function surcharging(?bool $value): self + { + $this->instance->setSurcharging($value); + return $this; + } + /** * Sets vat number field. * diff --git a/src/Models/Builders/CustomerBuilder.php b/src/Models/Builders/CustomerBuilder.php index e1a946d2..077c5aab 100644 --- a/src/Models/Builders/CustomerBuilder.php +++ b/src/Models/Builders/CustomerBuilder.php @@ -435,6 +435,17 @@ public function taxExempt(?bool $value): self return $this; } + /** + * Sets surcharging field. + * + * @param bool|null $value + */ + public function surcharging(?bool $value): self + { + $this->instance->setSurcharging($value); + return $this; + } + /** * Sets vat number field. * @@ -595,6 +606,26 @@ public function unsetMaxioid(): self return $this; } + /** + * Sets branding theme id field. + * + * @param int|null $value + */ + public function brandingThemeId(?int $value): self + { + $this->instance->setBrandingThemeId($value); + return $this; + } + + /** + * Unsets branding theme id field. + */ + public function unsetBrandingThemeId(): self + { + $this->instance->unsetBrandingThemeId(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/EBBComponentBuilder.php b/src/Models/Builders/EBBComponentBuilder.php index fcecb053..abe9399c 100644 --- a/src/Models/Builders/EBBComponentBuilder.php +++ b/src/Models/Builders/EBBComponentBuilder.php @@ -168,6 +168,26 @@ public function unsetIntervalUnit(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/GetOneTimeTokenBankAccountPaymentProfileBuilder.php b/src/Models/Builders/GetOneTimeTokenBankAccountPaymentProfileBuilder.php new file mode 100644 index 00000000..ffca25a8 --- /dev/null +++ b/src/Models/Builders/GetOneTimeTokenBankAccountPaymentProfileBuilder.php @@ -0,0 +1,224 @@ +instance = $instance; + } + + /** + * Initializes a new Get One Time Token Bank Account Payment Profile Builder object. + * + * @param string $firstName + * @param string $lastName + * @param string $currentVault + * @param string $vaultToken + * @param string $billingAddress + * @param string $billingCity + * @param string $billingCountry + * @param string $billingState + * @param string $billingZip + * @param string $bankName + * @param string $maskedBankRoutingNumber + * @param string $maskedBankAccountNumber + * @param string $bankAccountType + * @param string $bankAccountHolderType + * @param string $paymentType + * @param bool $disabled + * @param int $siteGatewaySettingId + */ + public static function init( + string $firstName, + string $lastName, + string $currentVault, + string $vaultToken, + string $billingAddress, + string $billingCity, + string $billingCountry, + string $billingState, + string $billingZip, + string $bankName, + string $maskedBankRoutingNumber, + string $maskedBankAccountNumber, + string $bankAccountType, + string $bankAccountHolderType, + string $paymentType, + bool $disabled, + int $siteGatewaySettingId + ): self { + return new self(new GetOneTimeTokenBankAccountPaymentProfile( + $firstName, + $lastName, + $currentVault, + $vaultToken, + $billingAddress, + $billingCity, + $billingCountry, + $billingState, + $billingZip, + $bankName, + $maskedBankRoutingNumber, + $maskedBankAccountNumber, + $bankAccountType, + $bankAccountHolderType, + $paymentType, + $disabled, + $siteGatewaySettingId + )); + } + + /** + * Sets id field. + * + * @param string|null $value + */ + public function id(?string $value): self + { + $this->instance->setId($value); + return $this; + } + + /** + * Unsets id field. + */ + public function unsetId(): self + { + $this->instance->unsetId(); + return $this; + } + + /** + * Sets customer id field. + * + * @param string|null $value + */ + public function customerId(?string $value): self + { + $this->instance->setCustomerId($value); + return $this; + } + + /** + * Unsets customer id field. + */ + public function unsetCustomerId(): self + { + $this->instance->unsetCustomerId(); + return $this; + } + + /** + * Sets billing address 2 field. + * + * @param string|null $value + */ + public function billingAddress2(?string $value): self + { + $this->instance->setBillingAddress2($value); + return $this; + } + + /** + * Sets customer vault token field. + * + * @param string|null $value + */ + public function customerVaultToken(?string $value): self + { + $this->instance->setCustomerVaultToken($value); + return $this; + } + + /** + * Unsets customer vault token field. + */ + public function unsetCustomerVaultToken(): self + { + $this->instance->unsetCustomerVaultToken(); + return $this; + } + + /** + * Sets gateway handle field. + * + * @param string|null $value + */ + public function gatewayHandle(?string $value): self + { + $this->instance->setGatewayHandle($value); + return $this; + } + + /** + * Unsets gateway handle field. + */ + public function unsetGatewayHandle(): self + { + $this->instance->unsetGatewayHandle(); + return $this; + } + + /** + * Sets verified field. + * + * @param bool|null $value + */ + public function verified(?bool $value): self + { + $this->instance->setVerified($value); + return $this; + } + + /** + * Unsets verified field. + */ + public function unsetVerified(): self + { + $this->instance->unsetVerified(); + 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 Get One Time Token Bank Account Payment Profile object. + */ + public function build(): GetOneTimeTokenBankAccountPaymentProfile + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/GetOneTimeTokenRequestBuilder.php b/src/Models/Builders/GetOneTimeTokenRequestBuilder.php index 7b1b1bef..1fd86e5f 100644 --- a/src/Models/Builders/GetOneTimeTokenRequestBuilder.php +++ b/src/Models/Builders/GetOneTimeTokenRequestBuilder.php @@ -10,6 +10,7 @@ namespace AdvancedBillingLib\Models\Builders; +use AdvancedBillingLib\Models\GetOneTimeTokenBankAccountPaymentProfile; use AdvancedBillingLib\Models\GetOneTimeTokenPaymentProfile; use AdvancedBillingLib\Models\GetOneTimeTokenRequest; use Core\Utils\CoreHelper; @@ -34,9 +35,9 @@ private function __construct(GetOneTimeTokenRequest $instance) /** * Initializes a new Get One Time Token Request Builder object. * - * @param GetOneTimeTokenPaymentProfile $paymentProfile + * @param GetOneTimeTokenPaymentProfile|GetOneTimeTokenBankAccountPaymentProfile $paymentProfile */ - public static function init(GetOneTimeTokenPaymentProfile $paymentProfile): self + public static function init($paymentProfile): self { return new self(new GetOneTimeTokenRequest($paymentProfile)); } diff --git a/src/Models/Builders/InvoiceBuilder.php b/src/Models/Builders/InvoiceBuilder.php index 8f312ad4..13251af8 100644 --- a/src/Models/Builders/InvoiceBuilder.php +++ b/src/Models/Builders/InvoiceBuilder.php @@ -723,6 +723,26 @@ public function publicUrlExpiresOn(?\DateTime $value): self return $this; } + /** + * Sets branding theme id field. + * + * @param int|null $value + */ + public function brandingThemeId(?int $value): self + { + $this->instance->setBrandingThemeId($value); + return $this; + } + + /** + * Unsets branding theme id field. + */ + public function unsetBrandingThemeId(): self + { + $this->instance->unsetBrandingThemeId(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/ListSubscriptionGroupPrepaymentBuilder.php b/src/Models/Builders/ListSubscriptionGroupPrepaymentBuilder.php index b4361a8e..35449c73 100644 --- a/src/Models/Builders/ListSubscriptionGroupPrepaymentBuilder.php +++ b/src/Models/Builders/ListSubscriptionGroupPrepaymentBuilder.php @@ -10,8 +10,8 @@ namespace AdvancedBillingLib\Models\Builders; -use AdvancedBillingLib\Models\ListSubcriptionGroupPrepaymentItem; use AdvancedBillingLib\Models\ListSubscriptionGroupPrepayment; +use AdvancedBillingLib\Models\ListSubscriptionGroupPrepaymentItem; use Core\Utils\CoreHelper; /** @@ -34,9 +34,9 @@ private function __construct(ListSubscriptionGroupPrepayment $instance) /** * Initializes a new List Subscription Group Prepayment Builder object. * - * @param ListSubcriptionGroupPrepaymentItem $prepayment + * @param ListSubscriptionGroupPrepaymentItem $prepayment */ - public static function init(ListSubcriptionGroupPrepaymentItem $prepayment): self + public static function init(ListSubscriptionGroupPrepaymentItem $prepayment): self { return new self(new ListSubscriptionGroupPrepayment($prepayment)); } diff --git a/src/Models/Builders/ListSubcriptionGroupPrepaymentItemBuilder.php b/src/Models/Builders/ListSubscriptionGroupPrepaymentItemBuilder.php similarity index 81% rename from src/Models/Builders/ListSubcriptionGroupPrepaymentItemBuilder.php rename to src/Models/Builders/ListSubscriptionGroupPrepaymentItemBuilder.php index 8961bed4..829429c8 100644 --- a/src/Models/Builders/ListSubcriptionGroupPrepaymentItemBuilder.php +++ b/src/Models/Builders/ListSubscriptionGroupPrepaymentItemBuilder.php @@ -10,32 +10,32 @@ namespace AdvancedBillingLib\Models\Builders; -use AdvancedBillingLib\Models\ListSubcriptionGroupPrepaymentItem; +use AdvancedBillingLib\Models\ListSubscriptionGroupPrepaymentItem; use Core\Utils\CoreHelper; /** - * Builder for model ListSubcriptionGroupPrepaymentItem + * Builder for model ListSubscriptionGroupPrepaymentItem * - * @see ListSubcriptionGroupPrepaymentItem + * @see ListSubscriptionGroupPrepaymentItem */ -class ListSubcriptionGroupPrepaymentItemBuilder +class ListSubscriptionGroupPrepaymentItemBuilder { /** - * @var ListSubcriptionGroupPrepaymentItem + * @var ListSubscriptionGroupPrepaymentItem */ private $instance; - private function __construct(ListSubcriptionGroupPrepaymentItem $instance) + private function __construct(ListSubscriptionGroupPrepaymentItem $instance) { $this->instance = $instance; } /** - * Initializes a new List Subcription Group Prepayment Item Builder object. + * Initializes a new List Subscription Group Prepayment Item Builder object. */ public static function init(): self { - return new self(new ListSubcriptionGroupPrepaymentItem()); + return new self(new ListSubscriptionGroupPrepaymentItem()); } /** @@ -150,9 +150,9 @@ public function additionalProperty(string $name, $value): self } /** - * Initializes a new List Subcription Group Prepayment Item object. + * Initializes a new List Subscription Group Prepayment Item object. */ - public function build(): ListSubcriptionGroupPrepaymentItem + public function build(): ListSubscriptionGroupPrepaymentItem { return CoreHelper::clone($this->instance); } diff --git a/src/Models/Builders/MeteredComponentBuilder.php b/src/Models/Builders/MeteredComponentBuilder.php index 93bc52a5..b99f187b 100644 --- a/src/Models/Builders/MeteredComponentBuilder.php +++ b/src/Models/Builders/MeteredComponentBuilder.php @@ -196,6 +196,26 @@ public function unsetIntervalUnit(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/MeteredUsageBuilder.php b/src/Models/Builders/MeteredUsageBuilder.php index 08e172ed..a571735a 100644 --- a/src/Models/Builders/MeteredUsageBuilder.php +++ b/src/Models/Builders/MeteredUsageBuilder.php @@ -34,7 +34,7 @@ private function __construct(MeteredUsage $instance) * Initializes a new Metered Usage Builder object. * * @param string $previousUnitBalance - * @param int $newUnitBalance + * @param int|string $newUnitBalance * @param int $usageQuantity * @param int $componentId * @param string $componentHandle @@ -42,7 +42,7 @@ private function __construct(MeteredUsage $instance) */ public static function init( string $previousUnitBalance, - int $newUnitBalance, + $newUnitBalance, int $usageQuantity, int $componentId, string $componentHandle, diff --git a/src/Models/Builders/OnOffComponentBuilder.php b/src/Models/Builders/OnOffComponentBuilder.php index 91f844e4..fe7d3e6f 100644 --- a/src/Models/Builders/OnOffComponentBuilder.php +++ b/src/Models/Builders/OnOffComponentBuilder.php @@ -212,6 +212,26 @@ public function unsetIntervalUnit(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/PrepaidUsageBuilder.php b/src/Models/Builders/PrepaidUsageBuilder.php index a0feecd6..a1085177 100644 --- a/src/Models/Builders/PrepaidUsageBuilder.php +++ b/src/Models/Builders/PrepaidUsageBuilder.php @@ -36,8 +36,8 @@ private function __construct(PrepaidUsage $instance) * * @param string $previousUnitBalance * @param string $previousOverageUnitBalance - * @param int $newUnitBalance - * @param int $newOverageUnitBalance + * @param int|string $newUnitBalance + * @param int|string $newOverageUnitBalance * @param int $usageQuantity * @param int $overageUsageQuantity * @param int $componentId @@ -48,8 +48,8 @@ private function __construct(PrepaidUsage $instance) public static function init( string $previousUnitBalance, string $previousOverageUnitBalance, - int $newUnitBalance, - int $newOverageUnitBalance, + $newUnitBalance, + $newOverageUnitBalance, int $usageQuantity, int $overageUsageQuantity, int $componentId, diff --git a/src/Models/Builders/PrepaidUsageComponentBuilder.php b/src/Models/Builders/PrepaidUsageComponentBuilder.php index a930c365..728f2b6c 100644 --- a/src/Models/Builders/PrepaidUsageComponentBuilder.php +++ b/src/Models/Builders/PrepaidUsageComponentBuilder.php @@ -264,6 +264,26 @@ public function publicSignupPageIds(?array $value): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/ProductBuilder.php b/src/Models/Builders/ProductBuilder.php index a95cf1f9..513cd72f 100644 --- a/src/Models/Builders/ProductBuilder.php +++ b/src/Models/Builders/ProductBuilder.php @@ -609,6 +609,26 @@ public function unsetProductPricePointHandle(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/ProductFamilyBuilder.php b/src/Models/Builders/ProductFamilyBuilder.php index bf18e1c9..00470505 100644 --- a/src/Models/Builders/ProductFamilyBuilder.php +++ b/src/Models/Builders/ProductFamilyBuilder.php @@ -111,6 +111,17 @@ public function unsetDescription(): self return $this; } + /** + * Sets surcharging field. + * + * @param bool|null $value + */ + public function surcharging(?bool $value): self + { + $this->instance->setSurcharging($value); + return $this; + } + /** * Sets created at field. * diff --git a/src/Models/Builders/QuantityBasedComponentBuilder.php b/src/Models/Builders/QuantityBasedComponentBuilder.php index bdde67db..e876c3cf 100644 --- a/src/Models/Builders/QuantityBasedComponentBuilder.php +++ b/src/Models/Builders/QuantityBasedComponentBuilder.php @@ -247,6 +247,26 @@ public function unsetIntervalUnit(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/SubscriptionComponentBuilder.php b/src/Models/Builders/SubscriptionComponentBuilder.php index 173239fc..0e3c55e6 100644 --- a/src/Models/Builders/SubscriptionComponentBuilder.php +++ b/src/Models/Builders/SubscriptionComponentBuilder.php @@ -98,9 +98,9 @@ public function enabled(?bool $value): self /** * Sets unit balance field. * - * @param int|null $value + * @param int|string|null $value */ - public function unitBalance(?int $value): self + public function unitBalance($value): self { $this->instance->setUnitBalance($value); return $this; diff --git a/src/Models/Builders/SubscriptionProductChangeBuilder.php b/src/Models/Builders/SubscriptionProductChangeBuilder.php index 0c873a70..1d9ec20e 100644 --- a/src/Models/Builders/SubscriptionProductChangeBuilder.php +++ b/src/Models/Builders/SubscriptionProductChangeBuilder.php @@ -41,6 +41,66 @@ public static function init(int $previousProductId, int $newProductId): self return new self(new SubscriptionProductChange($previousProductId, $newProductId)); } + /** + * Sets previous product price point id field. + * + * @param int|null $value + */ + public function previousProductPricePointId(?int $value): self + { + $this->instance->setPreviousProductPricePointId($value); + return $this; + } + + /** + * Unsets previous product price point id field. + */ + public function unsetPreviousProductPricePointId(): self + { + $this->instance->unsetPreviousProductPricePointId(); + return $this; + } + + /** + * Sets new product price point id field. + * + * @param int|null $value + */ + public function newProductPricePointId(?int $value): self + { + $this->instance->setNewProductPricePointId($value); + return $this; + } + + /** + * Unsets new product price point id field. + */ + public function unsetNewProductPricePointId(): self + { + $this->instance->unsetNewProductPricePointId(); + return $this; + } + + /** + * Sets effective at field. + * + * @param \DateTime|null $value + */ + public function effectiveAt(?\DateTime $value): self + { + $this->instance->setEffectiveAt($value); + return $this; + } + + /** + * Unsets effective at field. + */ + public function unsetEffectiveAt(): self + { + $this->instance->unsetEffectiveAt(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/UpdateComponentBuilder.php b/src/Models/Builders/UpdateComponentBuilder.php index d4ac4f9e..5ab73318 100644 --- a/src/Models/Builders/UpdateComponentBuilder.php +++ b/src/Models/Builders/UpdateComponentBuilder.php @@ -182,6 +182,26 @@ public function unsetUpgradeCharge(): self return $this; } + /** + * Sets unspsc code field. + * + * @param string|null $value + */ + public function unspscCode(?string $value): self + { + $this->instance->setUnspscCode($value); + return $this; + } + + /** + * Unsets unspsc code field. + */ + public function unsetUnspscCode(): self + { + $this->instance->unsetUnspscCode(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/UpdateCustomerBuilder.php b/src/Models/Builders/UpdateCustomerBuilder.php index a0d22756..9a1286a0 100644 --- a/src/Models/Builders/UpdateCustomerBuilder.php +++ b/src/Models/Builders/UpdateCustomerBuilder.php @@ -214,6 +214,17 @@ public function taxExempt(?bool $value): self return $this; } + /** + * Sets surcharging field. + * + * @param bool|null $value + */ + public function surcharging(?bool $value): self + { + $this->instance->setSurcharging($value); + return $this; + } + /** * Sets tax exempt reason field. * @@ -285,6 +296,26 @@ public function unsetSalesforceId(): self return $this; } + /** + * Sets branding theme id field. + * + * @param int|null $value + */ + public function brandingThemeId(?int $value): self + { + $this->instance->setBrandingThemeId($value); + return $this; + } + + /** + * Unsets branding theme id field. + */ + public function unsetBrandingThemeId(): self + { + $this->instance->unsetBrandingThemeId(); + return $this; + } + /** * Add an additional property to this model. * diff --git a/src/Models/Builders/UpdateInvoiceBuilder.php b/src/Models/Builders/UpdateInvoiceBuilder.php new file mode 100644 index 00000000..d6d3b61d --- /dev/null +++ b/src/Models/Builders/UpdateInvoiceBuilder.php @@ -0,0 +1,162 @@ +instance = $instance; + } + + /** + * Initializes a new Update Invoice Builder object. + */ + public static function init(): self + { + return new self(new UpdateInvoice()); + } + + /** + * Sets line items field. + * + * @param UpdateInvoiceItem[]|null $value + */ + public function lineItems(?array $value): self + { + $this->instance->setLineItems($value); + return $this; + } + + /** + * Sets issue date field. + * + * @param \DateTime|null $value + */ + public function issueDate(?\DateTime $value): self + { + $this->instance->setIssueDate($value); + return $this; + } + + /** + * Sets net terms field. + * + * @param int|null $value + */ + public function netTerms(?int $value): self + { + $this->instance->setNetTerms($value); + return $this; + } + + /** + * Sets payment instructions field. + * + * @param string|null $value + */ + public function paymentInstructions(?string $value): self + { + $this->instance->setPaymentInstructions($value); + return $this; + } + + /** + * Sets memo field. + * + * @param string|null $value + */ + public function memo(?string $value): self + { + $this->instance->setMemo($value); + return $this; + } + + /** + * Sets seller address field. + * + * @param CreateInvoiceAddress|null $value + */ + public function sellerAddress(?CreateInvoiceAddress $value): self + { + $this->instance->setSellerAddress($value); + return $this; + } + + /** + * Sets billing address field. + * + * @param CreateInvoiceAddress|null $value + */ + public function billingAddress(?CreateInvoiceAddress $value): self + { + $this->instance->setBillingAddress($value); + return $this; + } + + /** + * Sets shipping address field. + * + * @param CreateInvoiceAddress|null $value + */ + public function shippingAddress(?CreateInvoiceAddress $value): self + { + $this->instance->setShippingAddress($value); + return $this; + } + + /** + * Sets coupons field. + * + * @param CreateInvoiceCoupon[]|null $value + */ + public function coupons(?array $value): self + { + $this->instance->setCoupons($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 Update Invoice object. + */ + public function build(): UpdateInvoice + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/UpdateInvoiceItemBuilder.php b/src/Models/Builders/UpdateInvoiceItemBuilder.php new file mode 100644 index 00000000..0361d029 --- /dev/null +++ b/src/Models/Builders/UpdateInvoiceItemBuilder.php @@ -0,0 +1,214 @@ +instance = $instance; + } + + /** + * Initializes a new Update Invoice Item Builder object. + */ + public static function init(): self + { + return new self(new UpdateInvoiceItem()); + } + + /** + * Sets title field. + * + * @param string|null $value + */ + public function title(?string $value): self + { + $this->instance->setTitle($value); + return $this; + } + + /** + * Sets quantity field. + * + * @param float|string|null $value + */ + public function quantity($value): self + { + $this->instance->setQuantity($value); + return $this; + } + + /** + * Sets unit price field. + * + * @param float|string|null $value + */ + public function unitPrice($value): self + { + $this->instance->setUnitPrice($value); + return $this; + } + + /** + * Sets taxable field. + * + * @param bool|null $value + */ + public function taxable(?bool $value): self + { + $this->instance->setTaxable($value); + return $this; + } + + /** + * Sets tax code field. + * + * @param string|null $value + */ + public function taxCode(?string $value): self + { + $this->instance->setTaxCode($value); + return $this; + } + + /** + * Sets period range start field. + * + * @param string|null $value + */ + public function periodRangeStart(?string $value): self + { + $this->instance->setPeriodRangeStart($value); + return $this; + } + + /** + * Sets period range end field. + * + * @param string|null $value + */ + public function periodRangeEnd(?string $value): self + { + $this->instance->setPeriodRangeEnd($value); + return $this; + } + + /** + * Sets product id field. + * + * @param string|int|null $value + */ + public function productId($value): self + { + $this->instance->setProductId($value); + return $this; + } + + /** + * Sets component id field. + * + * @param string|int|null $value + */ + public function componentId($value): self + { + $this->instance->setComponentId($value); + return $this; + } + + /** + * Sets price point id field. + * + * @param string|int|null $value + */ + public function pricePointId($value): self + { + $this->instance->setPricePointId($value); + return $this; + } + + /** + * Sets product price point id field. + * + * @param string|int|null $value + */ + public function productPricePointId($value): self + { + $this->instance->setProductPricePointId($value); + return $this; + } + + /** + * Sets description field. + * + * @param string|null $value + */ + public function description(?string $value): self + { + $this->instance->setDescription($value); + return $this; + } + + /** + * Sets uid field. + * + * @param string|null $value + */ + public function uid(?string $value): self + { + $this->instance->setUid($value); + return $this; + } + + /** + * Sets destroy field. + * + * @param bool|null $value + */ + public function destroy(?bool $value): self + { + $this->instance->setDestroy($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 Update Invoice Item object. + */ + public function build(): UpdateInvoiceItem + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/UpdateInvoiceRequestBuilder.php b/src/Models/Builders/UpdateInvoiceRequestBuilder.php new file mode 100644 index 00000000..a67dd3d3 --- /dev/null +++ b/src/Models/Builders/UpdateInvoiceRequestBuilder.php @@ -0,0 +1,63 @@ +instance = $instance; + } + + /** + * Initializes a new Update Invoice Request Builder object. + * + * @param UpdateInvoice $invoice + */ + public static function init(UpdateInvoice $invoice): self + { + return new self(new UpdateInvoiceRequest($invoice)); + } + + /** + * 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 Update Invoice Request object. + */ + public function build(): UpdateInvoiceRequest + { + return CoreHelper::clone($this->instance); + } +} diff --git a/src/Models/Builders/UpdateSubscriptionBuilder.php b/src/Models/Builders/UpdateSubscriptionBuilder.php index ac3816ee..3ebaefff 100644 --- a/src/Models/Builders/UpdateSubscriptionBuilder.php +++ b/src/Models/Builders/UpdateSubscriptionBuilder.php @@ -151,6 +151,26 @@ public function nextBillingAt(?\DateTime $value): self return $this; } + /** + * Sets branding theme id field. + * + * @param int|null $value + */ + public function brandingThemeId(?int $value): self + { + $this->instance->setBrandingThemeId($value); + return $this; + } + + /** + * Unsets branding theme id field. + */ + public function unsetBrandingThemeId(): self + { + $this->instance->unsetBrandingThemeId(); + return $this; + } + /** * Sets expires at field. * diff --git a/src/Models/CalendarBilling.php b/src/Models/CalendarBilling.php index b597c56a..0d9148f5 100644 --- a/src/Models/CalendarBilling.php +++ b/src/Models/CalendarBilling.php @@ -14,7 +14,7 @@ use stdClass; /** - * (Optional). Cannot be used when also specifying next_billing_at + * (Optional). Cannot be used when also specifying next_billing_at. */ class CalendarBilling implements \JsonSerializable { diff --git a/src/Models/CancellationOptions.php b/src/Models/CancellationOptions.php index 8dbd6143..5936dc04 100644 --- a/src/Models/CancellationOptions.php +++ b/src/Models/CancellationOptions.php @@ -109,7 +109,7 @@ public function setCancelAtEndOfPeriod(?bool $cancelAtEndOfPeriod): void /** * Returns Scheduled Cancellation At. - * Schedules the cancellation on the provided date. This is option is not applicable for prepaid + * Schedules the cancellation on the provided date. This option is not applicable for prepaid * subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on * your site. */ @@ -123,7 +123,7 @@ public function getScheduledCancellationAt(): ?\DateTime /** * Sets Scheduled Cancellation At. - * Schedules the cancellation on the provided date. This is option is not applicable for prepaid + * Schedules the cancellation on the provided date. This option is not applicable for prepaid * subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on * your site. * @@ -137,7 +137,7 @@ public function setScheduledCancellationAt(?\DateTime $scheduledCancellationAt): /** * Unsets Scheduled Cancellation At. - * Schedules the cancellation on the provided date. This is option is not applicable for prepaid + * Schedules the cancellation on the provided date. This option is not applicable for prepaid * subscriptions. To use this option, the Schedule Subscription Cancellation feature must be enabled on * your site. */ diff --git a/src/Models/CollectionMethod1.php b/src/Models/CollectionMethod1.php new file mode 100644 index 00000000..7c9298ed --- /dev/null +++ b/src/Models/CollectionMethod1.php @@ -0,0 +1,44 @@ +intervalUnit = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the Component object to a human-readable string representation. * @@ -1170,6 +1213,7 @@ public function __toString(): string 'eventBasedBillingMetricId' => $this->eventBasedBillingMetricId, 'interval' => $this->interval, 'intervalUnit' => $this->getIntervalUnit(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -1320,6 +1364,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->intervalUnit)) { $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/ComponentCustomPrice.php b/src/Models/ComponentCustomPrice.php index 35e1f25a..760c378b 100644 --- a/src/Models/ComponentCustomPrice.php +++ b/src/Models/ComponentCustomPrice.php @@ -103,7 +103,7 @@ public function setTaxIncluded(?bool $taxIncluded): void /** * Returns Pricing Scheme. - * Omit for On/Off components + * Omit for On/Off components. */ public function getPricingScheme(): ?string { @@ -112,7 +112,7 @@ public function getPricingScheme(): ?string /** * Sets Pricing Scheme. - * Omit for On/Off components + * Omit for On/Off components. * * @maps pricing_scheme * @factory \AdvancedBillingLib\Models\PricingScheme::checkValue @@ -124,7 +124,7 @@ public function setPricingScheme(?string $pricingScheme): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -135,7 +135,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * @@ -184,7 +184,7 @@ public function unsetIntervalUnit(): void /** * Returns List Price Point Id. - * Optional id of the price point to use for list price calculations when + * (Optional) Id of the price point to use for list price calculations when * overriding the customer price. */ public function getListPricePointId(): ?int @@ -197,7 +197,7 @@ public function getListPricePointId(): ?int /** * Sets List Price Point Id. - * Optional id of the price point to use for list price calculations when + * (Optional) Id of the price point to use for list price calculations when * overriding the customer price. * * @maps list_price_point_id @@ -209,7 +209,7 @@ public function setListPricePointId(?int $listPricePointId): void /** * Unsets List Price Point Id. - * Optional id of the price point to use for list price calculations when + * (Optional) Id of the price point to use for list price calculations when * overriding the customer price. */ public function unsetListPricePointId(): void diff --git a/src/Models/ComponentPricePoint.php b/src/Models/ComponentPricePoint.php index 1cfcae8b..a645445e 100644 --- a/src/Models/ComponentPricePoint.php +++ b/src/Models/ComponentPricePoint.php @@ -180,7 +180,7 @@ public function setType(?string $type): void /** * Returns Default. - * Note: Refer to type attribute instead + * Note: Refer to type attribute instead. */ public function getDefault(): ?bool { @@ -189,7 +189,7 @@ public function getDefault(): ?bool /** * Sets Default. - * Note: Refer to type attribute instead + * Note: Refer to type attribute instead. * * @maps default */ @@ -440,7 +440,7 @@ public function setTaxIncluded(?bool $taxIncluded): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -454,7 +454,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * @@ -467,7 +467,7 @@ public function setInterval(?int $interval): void /** * Unsets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ diff --git a/src/Models/ComponentPricePointItem.php b/src/Models/ComponentPricePointItem.php index 687c0dc9..c05f0cd7 100644 --- a/src/Models/ComponentPricePointItem.php +++ b/src/Models/ComponentPricePointItem.php @@ -106,7 +106,7 @@ public function setPricingScheme(?string $pricingScheme): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -117,7 +117,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * diff --git a/src/Models/CouponPayload.php b/src/Models/CouponPayload.php index 5e25ad92..a2d3e133 100644 --- a/src/Models/CouponPayload.php +++ b/src/Models/CouponPayload.php @@ -112,7 +112,7 @@ public function setName(?string $name): void * Returns Code. * Required when creating a new coupon. The code is limited to 255 characters. May contain uppercase * alphanumeric characters and these special characters (which allow for email addresses to be used): - * “%”, “@”, “+”, “-”, “_”, and “.” + * “%”, “@”, “+”, “-”, “_”, and “.”. */ public function getCode(): ?string { @@ -123,7 +123,7 @@ public function getCode(): ?string * Sets Code. * Required when creating a new coupon. The code is limited to 255 characters. May contain uppercase * alphanumeric characters and these special characters (which allow for email addresses to be used): - * “%”, “@”, “+”, “-”, “_”, and “.” + * “%”, “@”, “+”, “-”, “_”, and “.”. * * @maps code */ @@ -157,7 +157,7 @@ public function setDescription(?string $description): void /** * Returns Percentage. * Required when creating a new percentage coupon. Can't be used together with amount_in_cents. - * Percentage discount + * Percentage discount. * * @return string|float|null */ @@ -169,7 +169,7 @@ public function getPercentage() /** * Sets Percentage. * Required when creating a new percentage coupon. Can't be used together with amount_in_cents. - * Percentage discount + * Percentage discount. * * @maps percentage * @mapsBy anyOf(oneOf(string,float),null) @@ -184,7 +184,7 @@ public function setPercentage($percentage): void /** * Returns Amount in Cents. * Required when creating a new flat amount coupon. Can't be used together with percentage. Flat USD - * discount + * discount. */ public function getAmountInCents(): ?int { @@ -194,7 +194,7 @@ public function getAmountInCents(): ?int /** * Sets Amount in Cents. * Required when creating a new flat amount coupon. Can't be used together with percentage. Flat USD - * discount + * discount. * * @maps amount_in_cents */ diff --git a/src/Models/CouponRequest.php b/src/Models/CouponRequest.php index 476e05ce..ba47939b 100644 --- a/src/Models/CouponRequest.php +++ b/src/Models/CouponRequest.php @@ -51,7 +51,7 @@ public function setCoupon(?CouponPayload $coupon): void /** * Returns Restricted Products. * An object where the keys are product IDs or handles (prefixed with 'handle:'), and the values are - * booleans indicating if the coupon should be applicable to the product + * booleans indicating if the coupon should be applicable to the product. * * @return array|null */ @@ -63,7 +63,7 @@ public function getRestrictedProducts(): ?array /** * Sets Restricted Products. * An object where the keys are product IDs or handles (prefixed with 'handle:'), and the values are - * booleans indicating if the coupon should be applicable to the product + * booleans indicating if the coupon should be applicable to the product. * * @maps restricted_products * @@ -77,7 +77,7 @@ public function setRestrictedProducts(?array $restrictedProducts): void /** * Returns Restricted Components. * An object where the keys are component IDs or handles (prefixed with 'handle:'), and the values are - * booleans indicating if the coupon should be applicable to the component + * booleans indicating if the coupon should be applicable to the component. * * @return array|null */ @@ -89,7 +89,7 @@ public function getRestrictedComponents(): ?array /** * Sets Restricted Components. * An object where the keys are component IDs or handles (prefixed with 'handle:'), and the values are - * booleans indicating if the coupon should be applicable to the component + * booleans indicating if the coupon should be applicable to the component. * * @maps restricted_components * diff --git a/src/Models/CouponUsage.php b/src/Models/CouponUsage.php index 7cf33ca8..98a2202a 100644 --- a/src/Models/CouponUsage.php +++ b/src/Models/CouponUsage.php @@ -176,7 +176,7 @@ public function unsetSavingsInCents(): void /** * Returns Revenue. - * Total revenue of the all subscriptions that have received a discount from this coupon. + * Total revenue of all subscriptions that have received a discount from this coupon. */ public function getRevenue(): ?int { @@ -188,7 +188,7 @@ public function getRevenue(): ?int /** * Sets Revenue. - * Total revenue of the all subscriptions that have received a discount from this coupon. + * Total revenue of all subscriptions that have received a discount from this coupon. * * @maps revenue */ @@ -199,7 +199,7 @@ public function setRevenue(?int $revenue): void /** * Unsets Revenue. - * Total revenue of the all subscriptions that have received a discount from this coupon. + * Total revenue of all subscriptions that have received a discount from this coupon. */ public function unsetRevenue(): void { @@ -208,7 +208,7 @@ public function unsetRevenue(): void /** * Returns Revenue in Cents. - * Total revenue of the all subscriptions that have received a discount from this coupon. + * Total revenue of all subscriptions that have received a discount from this coupon. */ public function getRevenueInCents(): ?int { @@ -217,7 +217,7 @@ public function getRevenueInCents(): ?int /** * Sets Revenue in Cents. - * Total revenue of the all subscriptions that have received a discount from this coupon. + * Total revenue of all subscriptions that have received a discount from this coupon. * * @maps revenue_in_cents */ diff --git a/src/Models/CreateAllocation.php b/src/Models/CreateAllocation.php index e2c1eb77..2307c5a7 100644 --- a/src/Models/CreateAllocation.php +++ b/src/Models/CreateAllocation.php @@ -102,7 +102,7 @@ public function __construct(float $quantity) * Returns Quantity. * 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. + * On/Off components, use 1 for on and 0 for off. */ public function getQuantity(): float { @@ -113,7 +113,7 @@ public function getQuantity(): float * Sets Quantity. * 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. + * On/Off components, use 1 for on and 0 for off. * * @required * @maps quantity diff --git a/src/Models/CreateComponentPricePoint.php b/src/Models/CreateComponentPricePoint.php index ec60ccad..7ee6ef27 100644 --- a/src/Models/CreateComponentPricePoint.php +++ b/src/Models/CreateComponentPricePoint.php @@ -197,7 +197,7 @@ public function setTaxIncluded(?bool $taxIncluded): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean * this price point would renew every 30 days. This property is only available for sites with * Multifrequency enabled. */ @@ -208,7 +208,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean * this price point would renew every 30 days. This property is only available for sites with * Multifrequency enabled. * diff --git a/src/Models/CreateCustomer.php b/src/Models/CreateCustomer.php index 0aa566b5..c5e1cfbe 100644 --- a/src/Models/CreateCustomer.php +++ b/src/Models/CreateCustomer.php @@ -95,6 +95,11 @@ class CreateCustomer implements \JsonSerializable */ private $taxExempt; + /** + * @var bool|null + */ + private $surcharging; + /** * @var string|null */ @@ -110,6 +115,11 @@ class CreateCustomer implements \JsonSerializable */ private $salesforceId = []; + /** + * @var array + */ + private $brandingThemeId = []; + /** * @param string $firstName * @param string $lastName @@ -415,6 +425,28 @@ public function setTaxExempt(?bool $taxExempt): void $this->taxExempt = $taxExempt; } + /** + * Returns Surcharging. + * Whether surcharging is enabled for the customer. Defaults to `true` when omitted. Only applied on + * sites where surcharging control is enabled. + */ + public function getSurcharging(): ?bool + { + return $this->surcharging; + } + + /** + * Sets Surcharging. + * Whether surcharging is enabled for the customer. Defaults to `true` when omitted. Only applied on + * sites where surcharging control is enabled. + * + * @maps surcharging + */ + public function setSurcharging(?bool $surcharging): void + { + $this->surcharging = $surcharging; + } + /** * Returns Tax Exempt Reason. */ @@ -497,6 +529,44 @@ public function unsetSalesforceId(): void $this->salesforceId = []; } + /** + * Returns Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + */ + public function getBrandingThemeId(): ?int + { + if (count($this->brandingThemeId) == 0) { + return null; + } + return $this->brandingThemeId['value']; + } + + /** + * Sets Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + * + * @maps branding_theme_id + */ + public function setBrandingThemeId(?int $brandingThemeId): void + { + $this->brandingThemeId['value'] = $brandingThemeId; + } + + /** + * Unsets Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + */ + public function unsetBrandingThemeId(): void + { + $this->brandingThemeId = []; + } + /** * Converts the CreateCustomer object to a human-readable string representation. * @@ -523,9 +593,11 @@ public function __toString(): string 'locale' => $this->locale, 'vatNumber' => $this->vatNumber, 'taxExempt' => $this->taxExempt, + 'surcharging' => $this->surcharging, 'taxExemptReason' => $this->taxExemptReason, 'parentId' => $this->getParentId(), 'salesforceId' => $this->getSalesforceId(), + 'brandingThemeId' => $this->getBrandingThemeId(), 'additionalProperties' => $this->additionalProperties ] ); @@ -613,6 +685,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->taxExempt)) { $json['tax_exempt'] = $this->taxExempt; } + if (isset($this->surcharging)) { + $json['surcharging'] = $this->surcharging; + } if (isset($this->taxExemptReason)) { $json['tax_exempt_reason'] = $this->taxExemptReason; } @@ -622,6 +697,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->salesforceId)) { $json['salesforce_id'] = $this->salesforceId['value']; } + if (!empty($this->brandingThemeId)) { + $json['branding_theme_id'] = $this->brandingThemeId['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/CreateInvoice.php b/src/Models/CreateInvoice.php index 658c754d..db60f63b 100644 --- a/src/Models/CreateInvoice.php +++ b/src/Models/CreateInvoice.php @@ -177,7 +177,7 @@ public function setMemo(?string $memo): void /** * Returns Seller Address. - * Overrides the defaults for the site + * Overrides the defaults for the site. */ public function getSellerAddress(): ?CreateInvoiceAddress { @@ -186,7 +186,7 @@ public function getSellerAddress(): ?CreateInvoiceAddress /** * Sets Seller Address. - * Overrides the defaults for the site + * Overrides the defaults for the site. * * @maps seller_address */ @@ -197,7 +197,7 @@ public function setSellerAddress(?CreateInvoiceAddress $sellerAddress): void /** * Returns Billing Address. - * Overrides the default for the customer + * Overrides the default for the customer. */ public function getBillingAddress(): ?CreateInvoiceAddress { @@ -206,7 +206,7 @@ public function getBillingAddress(): ?CreateInvoiceAddress /** * Sets Billing Address. - * Overrides the default for the customer + * Overrides the default for the customer. * * @maps billing_address */ @@ -217,7 +217,7 @@ public function setBillingAddress(?CreateInvoiceAddress $billingAddress): void /** * Returns Shipping Address. - * Overrides the default for the customer + * Overrides the default for the customer. */ public function getShippingAddress(): ?CreateInvoiceAddress { @@ -226,7 +226,7 @@ public function getShippingAddress(): ?CreateInvoiceAddress /** * Sets Shipping Address. - * Overrides the default for the customer + * Overrides the default for the customer. * * @maps shipping_address */ diff --git a/src/Models/CreateInvoiceItem.php b/src/Models/CreateInvoiceItem.php index 43154c25..e354a284 100644 --- a/src/Models/CreateInvoiceItem.php +++ b/src/Models/CreateInvoiceItem.php @@ -95,7 +95,7 @@ public function setTitle(?string $title): void /** * Returns Quantity. - * The quantity can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065. If you submit a + * The quantity can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit a * value with more than 8 decimal places, we will round it down to the 8th decimal place. * * @return float|string|null @@ -107,7 +107,7 @@ public function getQuantity() /** * Sets Quantity. - * The quantity can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065. If you submit a + * The quantity can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit a * value with more than 8 decimal places, we will round it down to the 8th decimal place. * * @maps quantity @@ -122,7 +122,7 @@ public function setQuantity($quantity): void /** * Returns Unit Price. - * The unit_price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065. If you submit + * The unit_price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit * a value with more than 8 decimal places, we will round it down to the 8th decimal place. * * @return float|string|null @@ -134,7 +134,7 @@ public function getUnitPrice() /** * Sets Unit Price. - * The unit_price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065. If you submit + * The unit_price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit * a value with more than 8 decimal places, we will round it down to the 8th decimal place. * * @maps unit_price diff --git a/src/Models/CreateMetafield.php b/src/Models/CreateMetafield.php index b7275843..7e7c0250 100644 --- a/src/Models/CreateMetafield.php +++ b/src/Models/CreateMetafield.php @@ -78,7 +78,7 @@ public function setScope(?MetafieldScope $scope): void /** * Returns Input Type. * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. */ public function getInputType(): ?string { @@ -88,7 +88,7 @@ public function getInputType(): ?string /** * Sets Input Type. * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. * * @maps input_type * @factory \AdvancedBillingLib\Models\MetafieldInput::checkValue diff --git a/src/Models/CreateOrUpdateEndpoint.php b/src/Models/CreateOrUpdateEndpoint.php index 0c90d274..c5a6c296 100644 --- a/src/Models/CreateOrUpdateEndpoint.php +++ b/src/Models/CreateOrUpdateEndpoint.php @@ -14,7 +14,7 @@ use stdClass; /** - * Used to Create or Update Endpoint + * Used to Create or Update Endpoint. */ class CreateOrUpdateEndpoint implements \JsonSerializable { diff --git a/src/Models/CreateOrUpdateEndpointRequest.php b/src/Models/CreateOrUpdateEndpointRequest.php index 53b06c4c..07d86087 100644 --- a/src/Models/CreateOrUpdateEndpointRequest.php +++ b/src/Models/CreateOrUpdateEndpointRequest.php @@ -14,7 +14,7 @@ use stdClass; /** - * Used to Create or Update Endpoint + * Used to Create or Update Endpoint. */ class CreateOrUpdateEndpointRequest implements \JsonSerializable { @@ -33,7 +33,7 @@ public function __construct(CreateOrUpdateEndpoint $endpoint) /** * Returns Endpoint. - * Used to Create or Update Endpoint + * Used to Create or Update Endpoint. */ public function getEndpoint(): CreateOrUpdateEndpoint { @@ -42,7 +42,7 @@ public function getEndpoint(): CreateOrUpdateEndpoint /** * Sets Endpoint. - * Used to Create or Update Endpoint + * Used to Create or Update Endpoint. * * @required * @maps endpoint diff --git a/src/Models/CreateOrUpdateProduct.php b/src/Models/CreateOrUpdateProduct.php index 98d4f199..f83abc7f 100644 --- a/src/Models/CreateOrUpdateProduct.php +++ b/src/Models/CreateOrUpdateProduct.php @@ -95,6 +95,11 @@ class CreateOrUpdateProduct implements \JsonSerializable */ private $taxCode; + /** + * @var array + */ + private $unspscCode = []; + /** * @param string $name * @param string $description @@ -243,8 +248,8 @@ public function setPriceInCents(int $priceInCents): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product would renew every 30 days. */ public function getInterval(): int { @@ -253,8 +258,8 @@ public function getInterval(): int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product would renew every 30 days. * * @required * @maps interval @@ -308,7 +313,7 @@ public function setTrialPriceInCents(?int $trialPriceInCents): void /** * Returns Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day * would mean this product trial would last 30 days. */ public function getTrialInterval(): ?int @@ -318,7 +323,7 @@ public function getTrialInterval(): ?int /** * Sets Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day * would mean this product trial would last 30 days. * * @maps trial_interval @@ -363,7 +368,7 @@ public function unsetTrialIntervalUnit(): void /** * Returns Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -378,7 +383,7 @@ public function getTrialType(): ?string /** * Sets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -393,7 +398,7 @@ public function setTrialType(?string $trialType): void /** * Unsets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -405,7 +410,7 @@ public function unsetTrialType(): void /** * Returns Expiration Interval. - * The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an + * The numerical expiration interval. e.g., an expiration_interval of ‘30’ coupled with an * expiration_interval_unit of day would mean this product would expire after 30 days. */ public function getExpirationInterval(): ?int @@ -415,7 +420,7 @@ public function getExpirationInterval(): ?int /** * Sets Expiration Interval. - * The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an + * The numerical expiration interval. e.g., an expiration_interval of ‘30’ coupled with an * expiration_interval_unit of day would mean this product would expire after 30 days. * * @maps expiration_interval @@ -498,6 +503,44 @@ public function setTaxCode(?string $taxCode): void $this->taxCode = $taxCode; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this product instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this product instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this product instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the CreateOrUpdateProduct object to a human-readable string representation. * @@ -524,6 +567,7 @@ public function __toString(): string 'expirationIntervalUnit' => $this->getExpirationIntervalUnit(), 'autoCreateSignupPage' => $this->autoCreateSignupPage, 'taxCode' => $this->taxCode, + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -610,6 +654,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->taxCode)) { $json['tax_code'] = $this->taxCode; } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/CreateOrUpdateSegmentPrice.php b/src/Models/CreateOrUpdateSegmentPrice.php index 894afa74..738c1f25 100644 --- a/src/Models/CreateOrUpdateSegmentPrice.php +++ b/src/Models/CreateOrUpdateSegmentPrice.php @@ -76,7 +76,7 @@ public function setEndingQuantity(?int $endingQuantity): void /** * Returns Unit Price. - * The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @return string|float */ @@ -87,7 +87,7 @@ public function getUnitPrice() /** * Sets Unit Price. - * The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @required * @maps unit_price diff --git a/src/Models/CreatePaymentProfile.php b/src/Models/CreatePaymentProfile.php index 31c91d89..72e18e0d 100644 --- a/src/Models/CreatePaymentProfile.php +++ b/src/Models/CreatePaymentProfile.php @@ -334,7 +334,7 @@ public function setCardType(?string $cardType): void /** * Returns Expiration Month. * (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit - * card expiration month, as an integer or string, i.e. 5 + * card expiration month, as an integer or string, e.g., 5 * * @return int|string|null */ @@ -346,7 +346,7 @@ public function getExpirationMonth() /** * Sets Expiration Month. * (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit - * card expiration month, as an integer or string, i.e. 5 + * card expiration month, as an integer or string, e.g., 5 * * @maps expiration_month * @mapsBy anyOf(oneOf(int,string),null) @@ -360,8 +360,8 @@ public function setExpirationMonth($expirationMonth): void /** * Returns Expiration Year. - * (Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card - * expiration year, as an integer or string, i.e. 2012 + * (Optional when performing an Import via vault_token, required otherwise) The 4-digit credit card + * expiration year, as an integer or string, e.g., 2012 * * @return int|string|null */ @@ -372,8 +372,8 @@ public function getExpirationYear() /** * Sets Expiration Year. - * (Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card - * expiration year, as an integer or string, i.e. 2012 + * (Optional when performing an Import via vault_token, required otherwise) The 4-digit credit card + * expiration year, as an integer or string, e.g., 2012 * * @maps expiration_year * @mapsBy anyOf(oneOf(int,string),null) @@ -387,7 +387,7 @@ public function setExpirationYear($expirationYear): void /** * Returns Billing Address. - * The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely + * The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely * passed through to the payment gateway. */ public function getBillingAddress(): ?string @@ -397,7 +397,7 @@ public function getBillingAddress(): ?string /** * Sets Billing Address. - * The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely + * The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely * passed through to the payment gateway. * * @maps billing_address @@ -409,7 +409,7 @@ public function setBillingAddress(?string $billingAddress): void /** * Returns Billing Address 2. - * Second line of the customer’s billing address i.e. Apt. 100 + * Second line of the customer’s billing address e.g., Apt. 100 */ public function getBillingAddress2(): ?string { @@ -421,7 +421,7 @@ public function getBillingAddress2(): ?string /** * Sets Billing Address 2. - * Second line of the customer’s billing address i.e. Apt. 100 + * Second line of the customer’s billing address e.g., Apt. 100 * * @maps billing_address_2 */ @@ -432,7 +432,7 @@ public function setBillingAddress2(?string $billingAddress2): void /** * Unsets Billing Address 2. - * Second line of the customer’s billing address i.e. Apt. 100 + * Second line of the customer’s billing address e.g., Apt. 100 */ public function unsetBillingAddress2(): void { @@ -441,7 +441,7 @@ public function unsetBillingAddress2(): void /** * Returns Billing City. - * The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed + * The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed * through to the payment gateway. */ public function getBillingCity(): ?string @@ -451,7 +451,7 @@ public function getBillingCity(): ?string /** * Sets Billing City. - * The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed + * The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed * through to the payment gateway. * * @maps billing_city @@ -463,9 +463,9 @@ public function setBillingCity(?string $billingCity): void /** * Returns Billing State. - * The credit card or bank account billing address state (i.e. MA). This value is merely passed through - * to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166- - * 1#Current_codes) in order to be valid for tax locale purposes. + * The credit card or bank account billing address state (e.g., MA). This value is merely passed + * through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia. + * org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. */ public function getBillingState(): ?string { @@ -474,9 +474,9 @@ public function getBillingState(): ?string /** * Sets Billing State. - * The credit card or bank account billing address state (i.e. MA). This value is merely passed through - * to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166- - * 1#Current_codes) in order to be valid for tax locale purposes. + * The credit card or bank account billing address state (e.g., MA). This value is merely passed + * through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia. + * org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. * * @maps billing_state */ @@ -487,10 +487,10 @@ public function setBillingState(?string $billingState): void /** * Returns Billing Country. - * The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en. - * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to - * the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s - * documentation. If creating an ACH subscription, only US is supported at this time. + * “The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https: + * //en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through + * to the payment gateway. Some gateways require country codes in a specific format. Check your + * gateway’s documentation. If creating an ACH subscription, only US is supported at this time.” */ public function getBillingCountry(): ?string { @@ -499,10 +499,10 @@ public function getBillingCountry(): ?string /** * Sets Billing Country. - * The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en. - * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to - * the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s - * documentation. If creating an ACH subscription, only US is supported at this time. + * “The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https: + * //en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through + * to the payment gateway. Some gateways require country codes in a specific format. Check your + * gateway’s documentation. If creating an ACH subscription, only US is supported at this time.” * * @maps billing_country */ @@ -513,7 +513,7 @@ public function setBillingCountry(?string $billingCountry): void /** * Returns Billing Zip. - * The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed + * The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed * through to the payment gateway. */ public function getBillingZip(): ?string @@ -523,7 +523,7 @@ public function getBillingZip(): ?string /** * Sets Billing Zip. - * The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed + * The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed * through to the payment gateway. * * @maps billing_zip @@ -737,7 +737,7 @@ public function setBankName(?string $bankName): void /** * Returns Bank Iban. * (Optional when creating with GoCardless, required with Stripe Direct Debit). International Bank - * Account Number. Alternatively, local bank details can be provided + * Account Number. Alternatively, local bank details can be provided. */ public function getBankIban(): ?string { @@ -747,7 +747,7 @@ public function getBankIban(): ?string /** * Sets Bank Iban. * (Optional when creating with GoCardless, required with Stripe Direct Debit). International Bank - * Account Number. Alternatively, local bank details can be provided + * Account Number. Alternatively, local bank details can be provided. * * @maps bank_iban */ @@ -759,7 +759,7 @@ public function setBankIban(?string $bankIban): void /** * Returns Bank Routing Number. * (Required when creating with ACH. Optional when creating a subscription with GoCardless). The - * routing number of the bank. It becomes bank_code while passing via GoCardless API + * routing number of the bank. It becomes bank_code while passing via GoCardless API. */ public function getBankRoutingNumber(): ?string { @@ -769,7 +769,7 @@ public function getBankRoutingNumber(): ?string /** * Sets Bank Routing Number. * (Required when creating with ACH. Optional when creating a subscription with GoCardless). The - * routing number of the bank. It becomes bank_code while passing via GoCardless API + * routing number of the bank. It becomes bank_code while passing via GoCardless API. * * @maps bank_routing_number */ @@ -803,7 +803,7 @@ public function setBankAccountNumber(?string $bankAccountNumber): void /** * Returns Bank Branch Code. * (Optional when creating with GoCardless, required with Stripe BECS or BACS Direct Debit) Branch/Sort - * code. Alternatively, an IBAN can be provided + * code. Alternatively, an IBAN can be provided. */ public function getBankBranchCode(): ?string { @@ -813,7 +813,7 @@ public function getBankBranchCode(): ?string /** * Sets Bank Branch Code. * (Optional when creating with GoCardless, required with Stripe BECS or BACS Direct Debit) Branch/Sort - * code. Alternatively, an IBAN can be provided + * code. Alternatively, an IBAN can be provided. * * @maps bank_branch_code */ diff --git a/src/Models/CreatePrepaidUsageComponentPricePoint.php b/src/Models/CreatePrepaidUsageComponentPricePoint.php index 44bdfea6..8f059264 100644 --- a/src/Models/CreatePrepaidUsageComponentPricePoint.php +++ b/src/Models/CreatePrepaidUsageComponentPricePoint.php @@ -207,7 +207,7 @@ public function setUseSiteExchangeRate(?bool $useSiteExchangeRate): void /** * Returns Rollover Prepaid Remainder. * (only for prepaid usage components) Boolean which controls whether or not remaining units should be - * rolled over to the next period + * rolled over to the next period. */ public function getRolloverPrepaidRemainder(): ?bool { @@ -217,7 +217,7 @@ public function getRolloverPrepaidRemainder(): ?bool /** * Sets Rollover Prepaid Remainder. * (only for prepaid usage components) Boolean which controls whether or not remaining units should be - * rolled over to the next period + * rolled over to the next period. * * @maps rollover_prepaid_remainder */ @@ -229,7 +229,7 @@ public function setRolloverPrepaidRemainder(?bool $rolloverPrepaidRemainder): vo /** * Returns Renew Prepaid Allocation. * (only for prepaid usage components) Boolean which controls whether or not the allocated quantity - * should be renewed at the beginning of each period + * should be renewed at the beginning of each period. */ public function getRenewPrepaidAllocation(): ?bool { @@ -239,7 +239,7 @@ public function getRenewPrepaidAllocation(): ?bool /** * Sets Renew Prepaid Allocation. * (only for prepaid usage components) Boolean which controls whether or not the allocated quantity - * should be renewed at the beginning of each period + * should be renewed at the beginning of each period. * * @maps renew_prepaid_allocation */ @@ -251,7 +251,7 @@ public function setRenewPrepaidAllocation(?bool $renewPrepaidAllocation): void /** * Returns Expiration Interval. * (only for prepaid usage components where rollover_prepaid_remainder is true) The number of - * `expiration_interval_unit`s after which rollover amounts should expire + * `expiration_interval_unit`s after which rollover amounts should expire. */ public function getExpirationInterval(): ?float { @@ -261,7 +261,7 @@ public function getExpirationInterval(): ?float /** * Sets Expiration Interval. * (only for prepaid usage components where rollover_prepaid_remainder is true) The number of - * `expiration_interval_unit`s after which rollover amounts should expire + * `expiration_interval_unit`s after which rollover amounts should expire. * * @maps expiration_interval */ @@ -273,7 +273,7 @@ public function setExpirationInterval(?float $expirationInterval): void /** * Returns Expiration Interval Unit. * (only for prepaid usage components where rollover_prepaid_remainder is true) A string representing - * the expiration interval unit for this component, either month or day + * the expiration interval unit for this component, either month or day. */ public function getExpirationIntervalUnit(): ?string { @@ -286,7 +286,7 @@ public function getExpirationIntervalUnit(): ?string /** * Sets Expiration Interval Unit. * (only for prepaid usage components where rollover_prepaid_remainder is true) A string representing - * the expiration interval unit for this component, either month or day + * the expiration interval unit for this component, either month or day. * * @maps expiration_interval_unit * @factory \AdvancedBillingLib\Models\ExpirationIntervalUnit::checkValue @@ -299,7 +299,7 @@ public function setExpirationIntervalUnit(?string $expirationIntervalUnit): void /** * Unsets Expiration Interval Unit. * (only for prepaid usage components where rollover_prepaid_remainder is true) A string representing - * the expiration interval unit for this component, either month or day + * the expiration interval unit for this component, either month or day. */ public function unsetExpirationIntervalUnit(): void { diff --git a/src/Models/CreatePrepayment.php b/src/Models/CreatePrepayment.php index f242cc9c..7fc31510 100644 --- a/src/Models/CreatePrepayment.php +++ b/src/Models/CreatePrepayment.php @@ -113,7 +113,7 @@ public function setMemo(string $memo): void /** * Returns Method. - * :- When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected + * When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected * using the default credit card payment profile and applied to the prepayment account balance. This is * especially useful for manual replenishment of prepaid subscriptions. */ @@ -124,7 +124,7 @@ public function getMethod(): string /** * Sets Method. - * :- When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected + * When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected * using the default credit card payment profile and applied to the prepayment account balance. This is * especially useful for manual replenishment of prepaid subscriptions. * diff --git a/src/Models/CreatePrepaymentMethod.php b/src/Models/CreatePrepaymentMethod.php index 6ccbbe9f..12f814e0 100644 --- a/src/Models/CreatePrepaymentMethod.php +++ b/src/Models/CreatePrepaymentMethod.php @@ -15,7 +15,7 @@ use stdClass; /** - * :- When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected + * When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected * using the default credit card payment profile and applied to the prepayment account balance. This is * especially useful for manual replenishment of prepaid subscriptions. */ diff --git a/src/Models/CreateProductFamily.php b/src/Models/CreateProductFamily.php index f74b28e1..a2704749 100644 --- a/src/Models/CreateProductFamily.php +++ b/src/Models/CreateProductFamily.php @@ -30,6 +30,11 @@ class CreateProductFamily implements \JsonSerializable */ private $description = []; + /** + * @var bool|null + */ + private $surcharging; + /** * @param string $name */ @@ -115,6 +120,28 @@ public function unsetDescription(): void $this->description = []; } + /** + * Returns Surcharging. + * Whether surcharging applies to this product family. Defaults to `true` when omitted. Only applied on + * sites where surcharging is enabled. + */ + public function getSurcharging(): ?bool + { + return $this->surcharging; + } + + /** + * Sets Surcharging. + * Whether surcharging applies to this product family. Defaults to `true` when omitted. Only applied on + * sites where surcharging is enabled. + * + * @maps surcharging + */ + public function setSurcharging(?bool $surcharging): void + { + $this->surcharging = $surcharging; + } + /** * Converts the CreateProductFamily object to a human-readable string representation. * @@ -128,6 +155,7 @@ public function __toString(): string 'name' => $this->name, 'handle' => $this->getHandle(), 'description' => $this->getDescription(), + 'surcharging' => $this->surcharging, 'additionalProperties' => $this->additionalProperties ] ); @@ -180,6 +208,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->description)) { $json['description'] = $this->description['value']; } + if (isset($this->surcharging)) { + $json['surcharging'] = $this->surcharging; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/CreateProductPricePoint.php b/src/Models/CreateProductPricePoint.php index 5c20f2fc..3d5082d0 100644 --- a/src/Models/CreateProductPricePoint.php +++ b/src/Models/CreateProductPricePoint.php @@ -163,8 +163,8 @@ public function setPriceInCents(int $priceInCents): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product price point would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product price point would renew every 30 days. */ public function getInterval(): int { @@ -173,8 +173,8 @@ public function getInterval(): int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product price point would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product price point would renew every 30 days. * * @required * @maps interval @@ -228,7 +228,7 @@ public function setTrialPriceInCents(?int $trialPriceInCents): void /** * Returns Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day * would mean this product price point trial would last 30 days. */ public function getTrialInterval(): ?int @@ -238,7 +238,7 @@ public function getTrialInterval(): ?int /** * Sets Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day * would mean this product price point trial would last 30 days. * * @maps trial_interval @@ -271,7 +271,7 @@ public function setTrialIntervalUnit(?string $trialIntervalUnit): void /** * Returns Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -286,7 +286,7 @@ public function getTrialType(): ?string /** * Sets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -301,7 +301,7 @@ public function setTrialType(?string $trialType): void /** * Unsets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -351,7 +351,7 @@ public function setInitialChargeAfterTrial(?bool $initialChargeAfterTrial): void /** * Returns Expiration Interval. - * The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an + * The numerical expiration interval. e.g., 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 @@ -361,7 +361,7 @@ public function getExpirationInterval(): ?int /** * Sets Expiration Interval. - * The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an + * The numerical expiration interval. e.g., 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 diff --git a/src/Models/CreateSubscription.php b/src/Models/CreateSubscription.php index 23e033c1..092e4baf 100644 --- a/src/Models/CreateSubscription.php +++ b/src/Models/CreateSubscription.php @@ -71,6 +71,11 @@ class CreateSubscription implements \JsonSerializable */ private $customerId; + /** + * @var array + */ + private $brandingThemeId = []; + /** * @var \DateTime|null */ @@ -511,6 +516,50 @@ public function setCustomerId(?int $customerId): void $this->customerId = $customerId; } + /** + * Returns Branding Theme Id. + * The ID of the Branding Theme to assign to this subscription. When set, this subscription-level + * Branding Theme is used instead of the customer's default Branding Theme for subscription-related + * documents and communications that use subscription theming. Pass null or an empty value to clear the + * subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not + * returned in the response. + */ + public function getBrandingThemeId(): ?int + { + if (count($this->brandingThemeId) == 0) { + return null; + } + return $this->brandingThemeId['value']; + } + + /** + * Sets Branding Theme Id. + * The ID of the Branding Theme to assign to this subscription. When set, this subscription-level + * Branding Theme is used instead of the customer's default Branding Theme for subscription-related + * documents and communications that use subscription theming. Pass null or an empty value to clear the + * subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not + * returned in the response. + * + * @maps branding_theme_id + */ + public function setBrandingThemeId(?int $brandingThemeId): void + { + $this->brandingThemeId['value'] = $brandingThemeId; + } + + /** + * Unsets Branding Theme Id. + * The ID of the Branding Theme to assign to this subscription. When set, this subscription-level + * Branding Theme is used instead of the customer's default Branding Theme for subscription-related + * documents and communications that use subscription theming. Pass null or an empty value to clear the + * subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not + * returned in the response. + */ + public function unsetBrandingThemeId(): void + { + $this->brandingThemeId = []; + } + /** * Returns Next Billing At. * (Optional) Set this attribute to a future date/time to sync imported subscriptions to your existing @@ -592,7 +641,7 @@ public function setInitialBillingAt(?\DateTime $initialBillingAt): void /** * Returns Defer Signup. * (Optional) Set this attribute to true to create the subscription in the Awaiting Signup Date state. - * Use this when you want to create a subscription that has an unknown first billing date. When the + * Use this when you want to create a subscription that has an unknown first billing date. When the * first billing date is known, update a subscription and set the `initial_billing_at` date. The * subscription moves to the Awaiting Signup state with a scheduled initial billing date. You can omit * the initial_billing_at date to activate the subscription immediately. See [Subscription @@ -607,7 +656,7 @@ public function getDeferSignup(): ?bool /** * Sets Defer Signup. * (Optional) Set this attribute to true to create the subscription in the Awaiting Signup Date state. - * Use this when you want to create a subscription that has an unknown first billing date. When the + * Use this when you want to create a subscription that has an unknown first billing date. When the * first billing date is known, update a subscription and set the `initial_billing_at` date. The * subscription moves to the Awaiting Signup state with a scheduled initial billing date. You can omit * the initial_billing_at date to activate the subscription immediately. See [Subscription @@ -668,7 +717,7 @@ public function setSalesRepId(?int $salesRepId): void * or if you want to use a new (unstored) card or bank account for the subscription, use * `payment_profile_attributes` instead to create a new payment profile along with the subscription. * (This value is available on an existing subscription via the API as `credit_card` > id or - * `bank_account` > id) + * `bank_account` > id.) */ public function getPaymentProfileId(): ?int { @@ -682,7 +731,7 @@ public function getPaymentProfileId(): ?int * or if you want to use a new (unstored) card or bank account for the subscription, use * `payment_profile_attributes` instead to create a new payment profile along with the subscription. * (This value is available on an existing subscription via the API as `credit_card` > id or - * `bank_account` > id) + * `bank_account` > id.) * * @maps payment_profile_id */ @@ -819,7 +868,7 @@ public function setComponents(?array $components): void /** * Returns Calendar Billing. - * (Optional). Cannot be used when also specifying next_billing_at + * (Optional). Cannot be used when also specifying next_billing_at. */ public function getCalendarBilling(): ?CalendarBilling { @@ -828,7 +877,7 @@ public function getCalendarBilling(): ?CalendarBilling /** * Sets Calendar Billing. - * (Optional). Cannot be used when also specifying next_billing_at + * (Optional). Cannot be used when also specifying next_billing_at. * * @maps calendar_billing */ @@ -1175,7 +1224,7 @@ public function setProductChangeDelayed(?bool $productChangeDelayed): void /** * Returns Offer Id. * Use in place of passing product and component information to set up the subscription with an - * existing offer. May be either the Chargify id of the offer or its handle prefixed with `handle:`.er + * existing offer. May be either the Chargify id of the offer or its handle prefixed with `handle:`. * * @return string|int|null */ @@ -1187,7 +1236,7 @@ public function getOfferId() /** * Sets Offer Id. * Use in place of passing product and component information to set up the subscription with an - * existing offer. May be either the Chargify id of the offer or its handle prefixed with `handle:`.er + * existing offer. May be either the Chargify id of the offer or its handle prefixed with `handle:`. * * @maps offer_id * @mapsBy anyOf(oneOf(string,int),null) @@ -1447,6 +1496,7 @@ public function __toString(): string 'receivesInvoiceEmails' => $this->receivesInvoiceEmails, 'netTerms' => $this->netTerms, 'customerId' => $this->customerId, + 'brandingThemeId' => $this->getBrandingThemeId(), 'nextBillingAt' => $this->nextBillingAt, 'initialBillingAt' => $this->initialBillingAt, 'deferSignup' => $this->deferSignup, @@ -1567,6 +1617,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->customerId)) { $json['customer_id'] = $this->customerId; } + if (!empty($this->brandingThemeId)) { + $json['branding_theme_id'] = $this->brandingThemeId['value']; + } if (isset($this->nextBillingAt)) { $json['next_billing_at'] = DateTimeHelper::toRfc3339DateTime($this->nextBillingAt); } diff --git a/src/Models/CreateSubscriptionComponent.php b/src/Models/CreateSubscriptionComponent.php index e3efbb5a..10b37867 100644 --- a/src/Models/CreateSubscriptionComponent.php +++ b/src/Models/CreateSubscriptionComponent.php @@ -26,7 +26,7 @@ class CreateSubscriptionComponent implements \JsonSerializable private $enabled; /** - * @var int|null + * @var int|string|null */ private $unitBalance; @@ -96,8 +96,10 @@ public function setEnabled(?bool $enabled): void /** * Returns Unit Balance. * Used for metered and events based components. + * + * @return int|string|null */ - public function getUnitBalance(): ?int + public function getUnitBalance() { return $this->unitBalance; } @@ -107,8 +109,11 @@ public function getUnitBalance(): ?int * Used for metered and events based components. * * @maps unit_balance + * @mapsBy anyOf(oneOf(int,string),null) + * + * @param int|string|null $unitBalance */ - public function setUnitBalance(?int $unitBalance): void + public function setUnitBalance($unitBalance): void { $this->unitBalance = $unitBalance; } @@ -274,7 +279,11 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['enabled'] = $this->enabled; } if (isset($this->unitBalance)) { - $json['unit_balance'] = $this->unitBalance; + $json['unit_balance'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->unitBalance, + 'anyOf(oneOf(int,string),null)' + ); } if (isset($this->allocatedQuantity)) { $json['allocated_quantity'] = diff --git a/src/Models/CreditCardPaymentProfile.php b/src/Models/CreditCardPaymentProfile.php index cc2132e9..9557764c 100644 --- a/src/Models/CreditCardPaymentProfile.php +++ b/src/Models/CreditCardPaymentProfile.php @@ -37,9 +37,9 @@ class CreditCardPaymentProfile implements \JsonSerializable private $maskedCardNumber; /** - * @var string|null + * @var array */ - private $cardType; + private $cardType = []; /** * @var int|null @@ -210,8 +210,8 @@ public function setLastName(?string $lastName): void /** * Returns Masked Card Number. - * A string representation of the credit card number with all but the last 4 digits masked with X’s (i. - * e. ‘XXXX-XXXX-XXXX-1234’). + * A string representation of the credit card number with all but the last 4 digits masked with X’s (e. + * g., ‘XXXX-XXXX-XXXX-1234’). */ public function getMaskedCardNumber(): ?string { @@ -220,8 +220,8 @@ public function getMaskedCardNumber(): ?string /** * Sets Masked Card Number. - * A string representation of the credit card number with all but the last 4 digits masked with X’s (i. - * e. ‘XXXX-XXXX-XXXX-1234’). + * A string representation of the credit card number with all but the last 4 digits masked with X’s (e. + * g., ‘XXXX-XXXX-XXXX-1234’). * * @maps masked_card_number */ @@ -236,7 +236,10 @@ public function setMaskedCardNumber(?string $maskedCardNumber): void */ public function getCardType(): ?string { - return $this->cardType; + if (count($this->cardType) == 0) { + return null; + } + return $this->cardType['value']; } /** @@ -248,7 +251,16 @@ public function getCardType(): ?string */ public function setCardType(?string $cardType): void { - $this->cardType = $cardType; + $this->cardType['value'] = $cardType; + } + + /** + * Unsets Card Type. + * The type of card used. + */ + public function unsetCardType(): void + { + $this->cardType = []; } /** @@ -273,7 +285,7 @@ public function setExpirationMonth(?int $expirationMonth): void /** * Returns Expiration Year. - * An integer representing the 4-digit expiration year of the card(i.e. ‘2012’). + * An integer representing the 4-digit expiration year of the card(e.g., ‘2012’). */ public function getExpirationYear(): ?int { @@ -282,7 +294,7 @@ public function getExpirationYear(): ?int /** * Sets Expiration Year. - * An integer representing the 4-digit expiration year of the card(i.e. ‘2012’). + * An integer representing the 4-digit expiration year of the card(e.g., ‘2012’). * * @maps expiration_year */ @@ -632,8 +644,8 @@ public function setDisabled(?bool $disabled): void /** * Returns Chargify Token. * Token received after sending billing information using Maxio.js (formerly Chargify.js). This token - * will only be received if passed as a sole attribute of credit_card_attributes (i.e. - * tok_9g6hw85pnpt6knmskpwp4ttt) + * will only be received if passed as a sole attribute of credit_card_attributes (e.g., + * tok_9g6hw85pnpt6knmskpwp4ttt). */ public function getChargifyToken(): ?string { @@ -643,8 +655,8 @@ public function getChargifyToken(): ?string /** * Sets Chargify Token. * Token received after sending billing information using Maxio.js (formerly Chargify.js). This token - * will only be received if passed as a sole attribute of credit_card_attributes (i.e. - * tok_9g6hw85pnpt6knmskpwp4ttt) + * will only be received if passed as a sole attribute of credit_card_attributes (e.g., + * tok_9g6hw85pnpt6knmskpwp4ttt). * * @maps chargify_token */ @@ -770,7 +782,7 @@ public function __toString(): string 'firstName' => $this->firstName, 'lastName' => $this->lastName, 'maskedCardNumber' => $this->maskedCardNumber, - 'cardType' => $this->cardType, + 'cardType' => $this->getCardType(), 'expirationMonth' => $this->expirationMonth, 'expirationYear' => $this->expirationYear, 'customerId' => $this->customerId, @@ -847,8 +859,8 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->maskedCardNumber)) { $json['masked_card_number'] = $this->maskedCardNumber; } - if (isset($this->cardType)) { - $json['card_type'] = CardType::checkValue($this->cardType); + if (!empty($this->cardType)) { + $json['card_type'] = CardType::checkValue($this->cardType['value']); } if (isset($this->expirationMonth)) { $json['expiration_month'] = $this->expirationMonth; diff --git a/src/Models/CreditNote.php b/src/Models/CreditNote.php index fdb45095..4b59ffcd 100644 --- a/src/Models/CreditNote.php +++ b/src/Models/CreditNote.php @@ -426,7 +426,7 @@ public function setSeller(?InvoiceSeller $seller): void /** * Returns Customer. - * Information about the customer who is owner or recipient the credited subscription. + * Information about the customer who is owner or recipient of the credited subscription. */ public function getCustomer(): ?InvoiceCustomer { @@ -435,7 +435,7 @@ public function getCustomer(): ?InvoiceCustomer /** * Sets Customer. - * Information about the customer who is owner or recipient the credited subscription. + * Information about the customer who is owner or recipient of the credited subscription. * * @maps customer */ @@ -509,7 +509,7 @@ public function setSubtotalAmount(?string $subtotalAmount): void /** * Returns Discount Amount. * Total discount applied to the credit note. Note that this is a positive amount representing the - * discount amount being credited back to the customer (i.e. a credit on an earlier discount). For + * discount amount being credited back to the customer (i.e., a credit on an earlier discount). For * example, if the original purchase was $1.00 and the original discount was $0.10, a credit of $0.50 * of the original purchase (half) would have a discount credit of $0.05 (also half). */ @@ -521,7 +521,7 @@ public function getDiscountAmount(): ?string /** * Sets Discount Amount. * Total discount applied to the credit note. Note that this is a positive amount representing the - * discount amount being credited back to the customer (i.e. a credit on an earlier discount). For + * discount amount being credited back to the customer (i.e., a credit on an earlier discount). For * example, if the original purchase was $1.00 and the original discount was $0.10, a credit of $0.50 * of the original purchase (half) would have a discount credit of $0.05 (also half). * @@ -534,8 +534,8 @@ public function setDiscountAmount(?string $discountAmount): void /** * Returns Tax Amount. - * Total tax of the credit note. Note that this is a positive amount representing a previously taxex - * amount being credited back to the customer (i.e. a credit of an earlier tax). For example, if the + * Total tax of the credit note. Note that this is a positive amount representing a previously taxed + * amount being credited back to the customer (i.e., a credit of an earlier tax). For example, if the * original purchase was $1.00 and the original tax was $0.10, a credit of $0.50 of the original * purchase (half) would also have a tax credit of $0.05 (also half). */ @@ -546,8 +546,8 @@ public function getTaxAmount(): ?string /** * Sets Tax Amount. - * Total tax of the credit note. Note that this is a positive amount representing a previously taxex - * amount being credited back to the customer (i.e. a credit of an earlier tax). For example, if the + * Total tax of the credit note. Note that this is a positive amount representing a previously taxed + * amount being credited back to the customer (i.e., a credit of an earlier tax). For example, if the * original purchase was $1.00 and the original tax was $0.10, a credit of $0.50 of the original * purchase (half) would also have a tax credit of $0.05 (also half). * @@ -560,7 +560,7 @@ public function setTaxAmount(?string $taxAmount): void /** * Returns Total Amount. - * The credit note total, which is `subtotal_amount - discount_amount + tax_amount`.' + * The credit note total, which is `subtotal_amount - discount_amount + tax_amount`. */ public function getTotalAmount(): ?string { @@ -569,7 +569,7 @@ public function getTotalAmount(): ?string /** * Sets Total Amount. - * The credit note total, which is `subtotal_amount - discount_amount + tax_amount`.' + * The credit note total, which is `subtotal_amount - discount_amount + tax_amount`. * * @maps total_amount */ @@ -736,7 +736,7 @@ public function setRefunds(?array $refunds): void * Returns Origin Invoices. * An array of origin invoices for the credit note. Learn more about [Origin Invoice from our * docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin- - * invoices) + * invoices). * * @return OriginInvoice[]|null */ @@ -749,7 +749,7 @@ public function getOriginInvoices(): ?array * Sets Origin Invoices. * An array of origin invoices for the credit note. Learn more about [Origin Invoice from our * docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin- - * invoices) + * invoices). * * @maps origin_invoices * diff --git a/src/Models/CreditNoteLineItem.php b/src/Models/CreditNoteLineItem.php index 4e29e2f5..7b957da3 100644 --- a/src/Models/CreditNoteLineItem.php +++ b/src/Models/CreditNoteLineItem.php @@ -212,7 +212,7 @@ public function setQuantity(?string $quantity): void * Returns Unit Price. * The price per unit for the line item. * - * When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will + * When tiered pricing was used (i.e., not every unit was actually priced at the same price) this will * be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. */ public function getUnitPrice(): ?string @@ -224,7 +224,7 @@ public function getUnitPrice(): ?string * Sets Unit Price. * The price per unit for the line item. * - * When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will + * When tiered pricing was used (i.e., not every unit was actually priced at the same price) this will * be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. * * @maps unit_price diff --git a/src/Models/CurrencyOveragePrices.php b/src/Models/CurrencyOveragePrices.php index 101cbf73..4107a108 100644 --- a/src/Models/CurrencyOveragePrices.php +++ b/src/Models/CurrencyOveragePrices.php @@ -188,7 +188,7 @@ public function setType(?string $type): void /** * Returns Default. - * Note: Refer to type attribute instead + * Note: Refer to type attribute instead. */ public function getDefault(): ?bool { @@ -197,7 +197,7 @@ public function getDefault(): ?bool /** * Sets Default. - * Note: Refer to type attribute instead + * Note: Refer to type attribute instead. * * @maps default */ @@ -448,7 +448,7 @@ public function setTaxIncluded(?bool $taxIncluded): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -462,7 +462,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * @@ -475,7 +475,7 @@ public function setInterval(?int $interval): void /** * Unsets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ diff --git a/src/Models/Customer.php b/src/Models/Customer.php index fdf531c5..a0afdce4 100644 --- a/src/Models/Customer.php +++ b/src/Models/Customer.php @@ -131,6 +131,11 @@ class Customer implements \JsonSerializable */ private $taxExempt; + /** + * @var bool|null + */ + private $surcharging; + /** * @var array */ @@ -171,6 +176,11 @@ class Customer implements \JsonSerializable */ private $maxioid = []; + /** + * @var array + */ + private $brandingThemeId = []; + /** * Returns First Name. * The first name of the customer @@ -233,8 +243,8 @@ public function setEmail(?string $email): void /** * Returns Cc Emails. - * A comma-separated list of emails that should be cc’d on all customer communications (i.e. - * “joe@example.com, sue@example.com”) + * “A comma-separated list of emails that should be cc’d on all customer communications (e.g., + * “joe@example.com, sue@example.com”)” */ public function getCcEmails(): ?string { @@ -246,8 +256,8 @@ public function getCcEmails(): ?string /** * Sets Cc Emails. - * A comma-separated list of emails that should be cc’d on all customer communications (i.e. - * “joe@example.com, sue@example.com”) + * “A comma-separated list of emails that should be cc’d on all customer communications (e.g., + * “joe@example.com, sue@example.com”)” * * @maps cc_emails */ @@ -258,8 +268,8 @@ public function setCcEmails(?string $ccEmails): void /** * Unsets Cc Emails. - * A comma-separated list of emails that should be cc’d on all customer communications (i.e. - * “joe@example.com, sue@example.com”) + * “A comma-separated list of emails that should be cc’d on all customer communications (e.g., + * “joe@example.com, sue@example.com”)” */ public function unsetCcEmails(): void { @@ -397,7 +407,7 @@ public function setUpdatedAt(?\DateTime $updatedAt): void /** * Returns Address. - * The customer’s shipping street address (i.e. “123 Main St.”) + * The customer’s shipping street address (e.g., “123 Main St.”) */ public function getAddress(): ?string { @@ -409,7 +419,7 @@ public function getAddress(): ?string /** * Sets Address. - * The customer’s shipping street address (i.e. “123 Main St.”) + * The customer’s shipping street address (e.g., “123 Main St.”) * * @maps address */ @@ -420,7 +430,7 @@ public function setAddress(?string $address): void /** * Unsets Address. - * The customer’s shipping street address (i.e. “123 Main St.”) + * The customer’s shipping street address (e.g., “123 Main St.”) */ public function unsetAddress(): void { @@ -429,7 +439,7 @@ public function unsetAddress(): void /** * Returns Address 2. - * Second line of the customer’s shipping address i.e. “Apt. 100” + * Second line of the customer’s shipping address e.g., “Apt. 100” */ public function getAddress2(): ?string { @@ -441,7 +451,7 @@ public function getAddress2(): ?string /** * Sets Address 2. - * Second line of the customer’s shipping address i.e. “Apt. 100” + * Second line of the customer’s shipping address e.g., “Apt. 100” * * @maps address_2 */ @@ -452,7 +462,7 @@ public function setAddress2(?string $address2): void /** * Unsets Address 2. - * Second line of the customer’s shipping address i.e. “Apt. 100” + * Second line of the customer’s shipping address e.g., “Apt. 100” */ public function unsetAddress2(): void { @@ -461,7 +471,7 @@ public function unsetAddress2(): void /** * Returns City. - * The customer’s shipping address city (i.e. “Boston”) + * The customer’s shipping address city (e.g., “Boston”) */ public function getCity(): ?string { @@ -473,7 +483,7 @@ public function getCity(): ?string /** * Sets City. - * The customer’s shipping address city (i.e. “Boston”) + * The customer’s shipping address city (e.g., “Boston”) * * @maps city */ @@ -484,7 +494,7 @@ public function setCity(?string $city): void /** * Unsets City. - * The customer’s shipping address city (i.e. “Boston”) + * The customer’s shipping address city (e.g., “Boston”) */ public function unsetCity(): void { @@ -493,7 +503,7 @@ public function unsetCity(): void /** * Returns State. - * The customer’s shipping address state (i.e. “MA”) + * The customer’s shipping address state (e.g., “MA”) */ public function getState(): ?string { @@ -505,7 +515,7 @@ public function getState(): ?string /** * Sets State. - * The customer’s shipping address state (i.e. “MA”) + * The customer’s shipping address state (e.g., “MA”) * * @maps state */ @@ -516,7 +526,7 @@ public function setState(?string $state): void /** * Unsets State. - * The customer’s shipping address state (i.e. “MA”) + * The customer’s shipping address state (e.g., “MA”) */ public function unsetState(): void { @@ -557,7 +567,7 @@ public function unsetStateName(): void /** * Returns Zip. - * The customer’s shipping address zip code (i.e. “12345”) + * The customer’s shipping address zip code (e.g., “12345”) */ public function getZip(): ?string { @@ -569,7 +579,7 @@ public function getZip(): ?string /** * Sets Zip. - * The customer’s shipping address zip code (i.e. “12345”) + * The customer’s shipping address zip code (e.g., “12345”) * * @maps zip */ @@ -580,7 +590,7 @@ public function setZip(?string $zip): void /** * Unsets Zip. - * The customer’s shipping address zip code (i.e. “12345”) + * The customer’s shipping address zip code (e.g., “12345”) */ public function unsetZip(): void { @@ -836,6 +846,28 @@ public function setTaxExempt(?bool $taxExempt): void $this->taxExempt = $taxExempt; } + /** + * Returns Surcharging. + * Whether surcharging is enabled for the customer. Only included on sites where surcharging control is + * enabled. + */ + public function getSurcharging(): ?bool + { + return $this->surcharging; + } + + /** + * Sets Surcharging. + * Whether surcharging is enabled for the customer. Only included on sites where surcharging control is + * enabled. + * + * @maps surcharging + */ + public function setSurcharging(?bool $surcharging): void + { + $this->surcharging = $surcharging; + } + /** * Returns Vat Number. * The VAT business identification number for the customer. This number is used to determine VAT tax @@ -1098,6 +1130,44 @@ public function unsetMaxioid(): void $this->maxioid = []; } + /** + * Returns Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + */ + public function getBrandingThemeId(): ?int + { + if (count($this->brandingThemeId) == 0) { + return null; + } + return $this->brandingThemeId['value']; + } + + /** + * Sets Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + * + * @maps branding_theme_id + */ + public function setBrandingThemeId(?int $brandingThemeId): void + { + $this->brandingThemeId['value'] = $brandingThemeId; + } + + /** + * Unsets Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + */ + public function unsetBrandingThemeId(): void + { + $this->brandingThemeId = []; + } + /** * Converts the Customer object to a human-readable string representation. * @@ -1131,6 +1201,7 @@ public function __toString(): string 'portalInviteLastSentAt' => $this->getPortalInviteLastSentAt(), 'portalInviteLastAcceptedAt' => $this->getPortalInviteLastAcceptedAt(), 'taxExempt' => $this->taxExempt, + 'surcharging' => $this->surcharging, 'vatNumber' => $this->getVatNumber(), 'parentId' => $this->getParentId(), 'locale' => $this->getLocale(), @@ -1139,6 +1210,7 @@ public function __toString(): string 'taxExemptReason' => $this->getTaxExemptReason(), 'defaultAutoRenewalProfileId' => $this->getDefaultAutoRenewalProfileId(), 'maxioid' => $this->getMaxioid(), + 'brandingThemeId' => $this->getBrandingThemeId(), 'additionalProperties' => $this->additionalProperties ] ); @@ -1262,6 +1334,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->taxExempt)) { $json['tax_exempt'] = $this->taxExempt; } + if (isset($this->surcharging)) { + $json['surcharging'] = $this->surcharging; + } if (!empty($this->vatNumber)) { $json['vat_number'] = $this->vatNumber['value']; } @@ -1286,6 +1361,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->maxioid)) { $json['maxioid'] = $this->maxioid['value']; } + if (!empty($this->brandingThemeId)) { + $json['branding_theme_id'] = $this->brandingThemeId['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/CustomerAttributes.php b/src/Models/CustomerAttributes.php index 4e5332e1..d62e9e13 100644 --- a/src/Models/CustomerAttributes.php +++ b/src/Models/CustomerAttributes.php @@ -90,6 +90,11 @@ class CustomerAttributes implements \JsonSerializable */ private $taxExempt; + /** + * @var bool|null + */ + private $surcharging; + /** * @var string|null */ @@ -177,7 +182,7 @@ public function setEmail(?string $email): void /** * Returns Cc Emails. - * A list of emails that should be cc’d on all customer communications. Optional. + * (Optional) A list of emails that should be cc’d on all customer communications. */ public function getCcEmails(): ?string { @@ -186,7 +191,7 @@ public function getCcEmails(): ?string /** * Sets Cc Emails. - * A list of emails that should be cc’d on all customer communications. Optional. + * (Optional) A list of emails that should be cc’d on all customer communications. * * @maps cc_emails */ @@ -197,7 +202,7 @@ public function setCcEmails(?string $ccEmails): void /** * Returns Organization. - * The organization/company of the customer. Optional. + * (Optional) The organization/company of the customer. */ public function getOrganization(): ?string { @@ -206,7 +211,7 @@ public function getOrganization(): ?string /** * Sets Organization. - * The organization/company of the customer. Optional. + * (Optional) The organization/company of the customer. * * @maps organization */ @@ -217,9 +222,9 @@ public function setOrganization(?string $organization): void /** * Returns Reference. - * A customer “reference”, or unique identifier from your app, stored in Chargify. Can be used so that - * you may reference your customer’s within Chargify using the same unique value you use in your - * application. Optional. + * (Optional) A customer “reference”, or unique identifier from your app, stored in Chargify. Can be + * used so that you may reference your customer’s within Chargify using the same unique value you use + * in your application. */ public function getReference(): ?string { @@ -228,9 +233,9 @@ public function getReference(): ?string /** * Sets Reference. - * A customer “reference”, or unique identifier from your app, stored in Chargify. Can be used so that - * you may reference your customer’s within Chargify using the same unique value you use in your - * application. Optional. + * (Optional) A customer “reference”, or unique identifier from your app, stored in Chargify. Can be + * used so that you may reference your customer’s within Chargify using the same unique value you use + * in your application. * * @maps reference */ @@ -241,7 +246,7 @@ public function setReference(?string $reference): void /** * Returns Address. - * (Optional) The customer’s shipping street address (i.e. “123 Main St.”). + * (Optional) The customer’s shipping street address (e.g., “123 Main St.”). */ public function getAddress(): ?string { @@ -250,7 +255,7 @@ public function getAddress(): ?string /** * Sets Address. - * (Optional) The customer’s shipping street address (i.e. “123 Main St.”). + * (Optional) The customer’s shipping street address (e.g., “123 Main St.”). * * @maps address */ @@ -261,7 +266,7 @@ public function setAddress(?string $address): void /** * Returns Address 2. - * (Optional) Second line of the customer’s shipping address i.e. “Apt. 100” + * (Optional) Second line of the customer’s shipping address e.g., “Apt. 100” */ public function getAddress2(): ?string { @@ -273,7 +278,7 @@ public function getAddress2(): ?string /** * Sets Address 2. - * (Optional) Second line of the customer’s shipping address i.e. “Apt. 100” + * (Optional) Second line of the customer’s shipping address e.g., “Apt. 100” * * @maps address_2 */ @@ -284,7 +289,7 @@ public function setAddress2(?string $address2): void /** * Unsets Address 2. - * (Optional) Second line of the customer’s shipping address i.e. “Apt. 100” + * (Optional) Second line of the customer’s shipping address e.g., “Apt. 100” */ public function unsetAddress2(): void { @@ -293,7 +298,7 @@ public function unsetAddress2(): void /** * Returns City. - * (Optional) The customer’s shipping address city (i.e. “Boston”). + * (Optional) The customer’s shipping address city (e.g., “Boston”). */ public function getCity(): ?string { @@ -302,7 +307,7 @@ public function getCity(): ?string /** * Sets City. - * (Optional) The customer’s shipping address city (i.e. “Boston”). + * (Optional) The customer’s shipping address city (e.g., “Boston”). * * @maps city */ @@ -313,9 +318,9 @@ public function setCity(?string $city): void /** * Returns State. - * (Optional) The customer’s shipping address state (i.e. “MA”). This must conform to the [ISO_3166- + * “(Optional) The customer’s shipping address state (e.g., “MA”). This must conform to the [ISO_3166- * 1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale - * purposes. + * purposes.” */ public function getState(): ?string { @@ -324,9 +329,9 @@ public function getState(): ?string /** * Sets State. - * (Optional) The customer’s shipping address state (i.e. “MA”). This must conform to the [ISO_3166- + * “(Optional) The customer’s shipping address state (e.g., “MA”). This must conform to the [ISO_3166- * 1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale - * purposes. + * purposes.” * * @maps state */ @@ -337,7 +342,7 @@ public function setState(?string $state): void /** * Returns Zip. - * (Optional) The customer’s shipping address zip code (i.e. “12345”). + * (Optional) The customer’s shipping address zip code (e.g., “12345”). */ public function getZip(): ?string { @@ -346,7 +351,7 @@ public function getZip(): ?string /** * Sets Zip. - * (Optional) The customer’s shipping address zip code (i.e. “12345”). + * (Optional) The customer’s shipping address zip code (e.g., “12345”). * * @maps zip */ @@ -357,8 +362,8 @@ public function setZip(?string $zip): void /** * Returns Country. - * (Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en. - * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). + * “(Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en. + * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”).” */ public function getCountry(): ?string { @@ -367,8 +372,8 @@ public function getCountry(): ?string /** * Sets Country. - * (Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en. - * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). + * “(Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en. + * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”).” * * @maps country */ @@ -437,9 +442,31 @@ public function setTaxExempt(?bool $taxExempt): void $this->taxExempt = $taxExempt; } + /** + * Returns Surcharging. + * (Optional) Whether surcharging is enabled for the customer. Defaults to `true` when omitted. Only + * applied on sites where surcharging control is enabled. + */ + public function getSurcharging(): ?bool + { + return $this->surcharging; + } + + /** + * Sets Surcharging. + * (Optional) Whether surcharging is enabled for the customer. Defaults to `true` when omitted. Only + * applied on sites where surcharging control is enabled. + * + * @maps surcharging + */ + public function setSurcharging(?bool $surcharging): void + { + $this->surcharging = $surcharging; + } + /** * Returns Vat Number. - * (Optional) Supplying the VAT number allows EU customer’s to opt-out of the Value Added Tax assuming + * (Optional) Supplying the VAT number allows EU customers to opt-out of the Value Added Tax assuming * the merchant address and customer billing address are not within the same EU country. It’s important * to omit the country code from the VAT number upon entry. Otherwise, taxes will be assessed upon the * purchase. @@ -451,7 +478,7 @@ public function getVatNumber(): ?string /** * Sets Vat Number. - * (Optional) Supplying the VAT number allows EU customer’s to opt-out of the Value Added Tax assuming + * (Optional) Supplying the VAT number allows EU customers to opt-out of the Value Added Tax assuming * the merchant address and customer billing address are not within the same EU country. It’s important * to omit the country code from the VAT number upon entry. Otherwise, taxes will be assessed upon the * purchase. @@ -610,6 +637,7 @@ public function __toString(): string 'phone' => $this->phone, 'verified' => $this->verified, 'taxExempt' => $this->taxExempt, + 'surcharging' => $this->surcharging, 'vatNumber' => $this->vatNumber, 'metafields' => $this->metafields, 'parentId' => $this->getParentId(), @@ -705,6 +733,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->taxExempt)) { $json['tax_exempt'] = $this->taxExempt; } + if (isset($this->surcharging)) { + $json['surcharging'] = $this->surcharging; + } if (isset($this->vatNumber)) { $json['vat_number'] = $this->vatNumber; } diff --git a/src/Models/DebitNote.php b/src/Models/DebitNote.php index c00d3741..bdf9c5f0 100644 --- a/src/Models/DebitNote.php +++ b/src/Models/DebitNote.php @@ -215,7 +215,7 @@ public function setSubscriptionId(?int $subscriptionId): void /** * Returns Number. - * A unique, identifier that appears on the debit note and in places it is referenced. + * A unique identifier that appears on the debit note and in places it is referenced. */ public function getNumber(): ?int { @@ -224,7 +224,7 @@ public function getNumber(): ?int /** * Sets Number. - * A unique, identifier that appears on the debit note and in places it is referenced. + * A unique identifier that appears on the debit note and in places it is referenced. * * @maps number */ @@ -283,7 +283,7 @@ public function setOriginCreditNoteUid(?string $originCreditNoteUid): void /** * Returns Origin Credit Note Number. - * A unique, identifying string of the connected credit note. + * A unique identifying string of the connected credit note. */ public function getOriginCreditNoteNumber(): ?string { @@ -292,7 +292,7 @@ public function getOriginCreditNoteNumber(): ?string /** * Sets Origin Credit Note Number. - * A unique, identifying string of the connected credit note. + * A unique identifying string of the connected credit note. * * @maps origin_credit_note_number */ @@ -482,7 +482,7 @@ public function setSeller(?InvoiceSeller $seller): void /** * Returns Customer. - * Information about the customer who is owner or recipient the debited subscription. + * Information about the customer who is the owner or recipient of the debited subscription. */ public function getCustomer(): ?InvoiceCustomer { @@ -491,7 +491,7 @@ public function getCustomer(): ?InvoiceCustomer /** * Sets Customer. - * Information about the customer who is owner or recipient the debited subscription. + * Information about the customer who is the owner or recipient of the debited subscription. * * @maps customer */ diff --git a/src/Models/EBBComponent.php b/src/Models/EBBComponent.php index 14222fb0..47f9c0d9 100644 --- a/src/Models/EBBComponent.php +++ b/src/Models/EBBComponent.php @@ -85,6 +85,11 @@ class EBBComponent implements \JsonSerializable */ private $intervalUnit = []; + /** + * @var array + */ + private $unspscCode = []; + /** * @param string $name * @param string $unitName @@ -102,7 +107,7 @@ public function __construct(string $name, string $unitName, string $pricingSchem /** * Returns Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, i.e., "Minutes". */ public function getName(): string { @@ -112,7 +117,7 @@ public function getName(): string /** * Sets Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, i.e., "Minutes". * * @required * @maps name @@ -124,9 +129,9 @@ public function setName(string $name): void /** * Returns Unit Name. - * The name of the unit of measurement for the component. It should be singular since it will be - * automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on - * a subscription’s component line-item + * “The name of the unit of measurement for the component. It should be singular since it will be + * automatically pluralized when necessary. i.e., “message”, which may then be shown as “5 messages” on + * a subscription’s component line-item” */ public function getUnitName(): string { @@ -135,9 +140,9 @@ public function getUnitName(): string /** * Sets Unit Name. - * The name of the unit of measurement for the component. It should be singular since it will be - * automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on - * a subscription’s component line-item + * “The name of the unit of measurement for the component. It should be singular since it will be + * automatically pluralized when necessary. i.e., “message”, which may then be shown as “5 messages” on + * a subscription’s component line-item” * * @required * @maps unit_name @@ -169,7 +174,7 @@ public function setDescription(?string $description): void /** * Returns Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. */ @@ -180,7 +185,7 @@ public function getHandle(): ?string /** * Sets Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. * @@ -288,7 +293,7 @@ public function setPricePoints(?array $pricePoints): void /** * Returns Unit Price. * The amount the customer will be charged per unit when the pricing scheme is “per_unit”. The price - * can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * can contain up to 8 decimal places. i.e., 1.00 or 0.0012 or 0.00000065 * * @return string|float|null */ @@ -300,7 +305,7 @@ public function getUnitPrice() /** * Sets Unit Price. * The amount the customer will be charged per unit when the pricing scheme is “per_unit”. The price - * can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * can contain up to 8 decimal places. i.e., 1.00 or 0.0012 or 0.00000065 * * @maps unit_price * @mapsBy anyOf(oneOf(string,float),null) @@ -379,7 +384,7 @@ public function setEventBasedBillingMetricId(int $eventBasedBillingMetricId): vo /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. i.e., an interval of ‘30’ coupled with an interval_unit of day would mean * this component's default price point would renew every 30 days. This property is only available for * sites with Multifrequency enabled. */ @@ -390,7 +395,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. i.e., an interval of ‘30’ coupled with an interval_unit of day would mean * this component's default price point would renew every 30 days. This property is only available for * sites with Multifrequency enabled. * @@ -437,6 +442,44 @@ public function unsetIntervalUnit(): void $this->intervalUnit = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the EBBComponent object to a human-readable string representation. * @@ -461,6 +504,7 @@ public function __toString(): string 'eventBasedBillingMetricId' => $this->eventBasedBillingMetricId, 'interval' => $this->interval, 'intervalUnit' => $this->getIntervalUnit(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -544,6 +588,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->intervalUnit)) { $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/Event.php b/src/Models/Event.php index de1566ce..97a085a9 100644 --- a/src/Models/Event.php +++ b/src/Models/Event.php @@ -183,7 +183,8 @@ public function setCreatedAt(\DateTime $createdAt): void * Returns Event Specific Data. * The schema varies based on the event key. The key-to-event data mapping is as follows: * - * * `subscription_product_change` - SubscriptionProductChange + * * `subscription_product_change`, `subscription_product_change_scheduled` - + * SubscriptionProductChange * * `subscription_state_change` - SubscriptionStateChange * * `signup_success`, `delayed_signup_creation_success`, `payment_success`, `payment_failure`, * `renewal_success`, `renewal_failure`, `chargeback_lost`, `chargeback_accepted`, `chargeback_closed` - @@ -245,7 +246,8 @@ public function getEventSpecificData() * Sets Event Specific Data. * The schema varies based on the event key. The key-to-event data mapping is as follows: * - * * `subscription_product_change` - SubscriptionProductChange + * * `subscription_product_change`, `subscription_product_change_scheduled` - + * SubscriptionProductChange * * `subscription_state_change` - SubscriptionStateChange * * `signup_success`, `delayed_signup_creation_success`, `payment_success`, `payment_failure`, * `renewal_success`, `renewal_failure`, `chargeback_lost`, `chargeback_accepted`, `chargeback_closed` - diff --git a/src/Models/EventKey.php b/src/Models/EventKey.php index b7512cdb..44427dde 100644 --- a/src/Models/EventKey.php +++ b/src/Models/EventKey.php @@ -40,6 +40,8 @@ class EventKey public const SUBSCRIPTION_PRODUCT_CHANGE = 'subscription_product_change'; + public const SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED = 'subscription_product_change_scheduled'; + public const PENDING_CANCELLATION_CHANGE = 'pending_cancellation_change'; public const EXPIRING_CARD = 'expiring_card'; @@ -196,6 +198,7 @@ class EventKey self::RENEWAL_FAILURE, self::SUBSCRIPTION_STATE_CHANGE, self::SUBSCRIPTION_PRODUCT_CHANGE, + self::SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED, self::PENDING_CANCELLATION_CHANGE, self::EXPIRING_CARD, self::CUSTOMER_UPDATE, diff --git a/src/Models/FailedPaymentAction.php b/src/Models/FailedPaymentAction.php index 88a26fc9..ec9a9c55 100644 --- a/src/Models/FailedPaymentAction.php +++ b/src/Models/FailedPaymentAction.php @@ -23,8 +23,8 @@ * no email sent to the customer; payment failure recorded in the invoice history. * - `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; * email sent to the customer for the issued invoice (if setting applies); payment failure recorded in - * the invoice history; subscription will most likely go into "past_due" or "canceled" state - * (depending upon net terms and dunning settings). + * the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending + * upon net terms and dunning settings). */ class FailedPaymentAction { diff --git a/src/Models/GetOneTimeTokenBankAccountPaymentProfile.php b/src/Models/GetOneTimeTokenBankAccountPaymentProfile.php new file mode 100644 index 00000000..bda81824 --- /dev/null +++ b/src/Models/GetOneTimeTokenBankAccountPaymentProfile.php @@ -0,0 +1,803 @@ +firstName = $firstName; + $this->lastName = $lastName; + $this->currentVault = $currentVault; + $this->vaultToken = $vaultToken; + $this->billingAddress = $billingAddress; + $this->billingCity = $billingCity; + $this->billingCountry = $billingCountry; + $this->billingState = $billingState; + $this->billingZip = $billingZip; + $this->bankName = $bankName; + $this->maskedBankRoutingNumber = $maskedBankRoutingNumber; + $this->maskedBankAccountNumber = $maskedBankAccountNumber; + $this->bankAccountType = $bankAccountType; + $this->bankAccountHolderType = $bankAccountHolderType; + $this->paymentType = $paymentType; + $this->disabled = $disabled; + $this->siteGatewaySettingId = $siteGatewaySettingId; + } + + /** + * Returns Id. + */ + public function getId(): ?string + { + if (count($this->id) == 0) { + return null; + } + return $this->id['value']; + } + + /** + * Sets Id. + * + * @maps id + */ + public function setId(?string $id): void + { + $this->id['value'] = $id; + } + + /** + * Unsets Id. + */ + public function unsetId(): void + { + $this->id = []; + } + + /** + * Returns First Name. + */ + public function getFirstName(): string + { + return $this->firstName; + } + + /** + * Sets First Name. + * + * @required + * @maps first_name + */ + public function setFirstName(string $firstName): void + { + $this->firstName = $firstName; + } + + /** + * Returns Last Name. + */ + public function getLastName(): string + { + return $this->lastName; + } + + /** + * Sets Last Name. + * + * @required + * @maps last_name + */ + public function setLastName(string $lastName): void + { + $this->lastName = $lastName; + } + + /** + * Returns Customer Id. + */ + public function getCustomerId(): ?string + { + if (count($this->customerId) == 0) { + return null; + } + return $this->customerId['value']; + } + + /** + * Sets Customer Id. + * + * @maps customer_id + */ + public function setCustomerId(?string $customerId): void + { + $this->customerId['value'] = $customerId; + } + + /** + * Unsets Customer Id. + */ + public function unsetCustomerId(): void + { + $this->customerId = []; + } + + /** + * Returns Current Vault. + * The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing. + */ + public function getCurrentVault(): string + { + return $this->currentVault; + } + + /** + * Sets Current Vault. + * The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing. + * + * @required + * @maps current_vault + * @factory \AdvancedBillingLib\Models\BankAccountVault::checkValue + */ + public function setCurrentVault(string $currentVault): void + { + $this->currentVault = $currentVault; + } + + /** + * Returns Vault Token. + */ + public function getVaultToken(): string + { + return $this->vaultToken; + } + + /** + * Sets Vault Token. + * + * @required + * @maps vault_token + */ + public function setVaultToken(string $vaultToken): void + { + $this->vaultToken = $vaultToken; + } + + /** + * Returns Billing Address. + */ + public function getBillingAddress(): string + { + return $this->billingAddress; + } + + /** + * Sets Billing Address. + * + * @required + * @maps billing_address + */ + public function setBillingAddress(string $billingAddress): void + { + $this->billingAddress = $billingAddress; + } + + /** + * Returns Billing Address 2. + */ + public function getBillingAddress2(): ?string + { + return $this->billingAddress2; + } + + /** + * Sets Billing Address 2. + * + * @maps billing_address_2 + */ + public function setBillingAddress2(?string $billingAddress2): void + { + $this->billingAddress2 = $billingAddress2; + } + + /** + * Returns Billing City. + */ + public function getBillingCity(): string + { + return $this->billingCity; + } + + /** + * Sets Billing City. + * + * @required + * @maps billing_city + */ + public function setBillingCity(string $billingCity): void + { + $this->billingCity = $billingCity; + } + + /** + * Returns Billing Country. + */ + public function getBillingCountry(): string + { + return $this->billingCountry; + } + + /** + * Sets Billing Country. + * + * @required + * @maps billing_country + */ + public function setBillingCountry(string $billingCountry): void + { + $this->billingCountry = $billingCountry; + } + + /** + * Returns Billing State. + */ + public function getBillingState(): string + { + return $this->billingState; + } + + /** + * Sets Billing State. + * + * @required + * @maps billing_state + */ + public function setBillingState(string $billingState): void + { + $this->billingState = $billingState; + } + + /** + * Returns Billing Zip. + */ + public function getBillingZip(): string + { + return $this->billingZip; + } + + /** + * Sets Billing Zip. + * + * @required + * @maps billing_zip + */ + public function setBillingZip(string $billingZip): void + { + $this->billingZip = $billingZip; + } + + /** + * Returns Bank Name. + */ + public function getBankName(): string + { + return $this->bankName; + } + + /** + * Sets Bank Name. + * + * @required + * @maps bank_name + */ + public function setBankName(string $bankName): void + { + $this->bankName = $bankName; + } + + /** + * Returns Masked Bank Routing Number. + */ + public function getMaskedBankRoutingNumber(): string + { + return $this->maskedBankRoutingNumber; + } + + /** + * Sets Masked Bank Routing Number. + * + * @required + * @maps masked_bank_routing_number + */ + public function setMaskedBankRoutingNumber(string $maskedBankRoutingNumber): void + { + $this->maskedBankRoutingNumber = $maskedBankRoutingNumber; + } + + /** + * Returns Masked Bank Account Number. + */ + public function getMaskedBankAccountNumber(): string + { + return $this->maskedBankAccountNumber; + } + + /** + * Sets Masked Bank Account Number. + * + * @required + * @maps masked_bank_account_number + */ + public function setMaskedBankAccountNumber(string $maskedBankAccountNumber): void + { + $this->maskedBankAccountNumber = $maskedBankAccountNumber; + } + + /** + * Returns Bank Account Type. + * Defaults to checking + */ + public function getBankAccountType(): string + { + return $this->bankAccountType; + } + + /** + * Sets Bank Account Type. + * Defaults to checking + * + * @required + * @maps bank_account_type + * @factory \AdvancedBillingLib\Models\BankAccountType::checkValue + */ + public function setBankAccountType(string $bankAccountType): void + { + $this->bankAccountType = $bankAccountType; + } + + /** + * Returns Bank Account Holder Type. + * Defaults to personal + */ + public function getBankAccountHolderType(): string + { + return $this->bankAccountHolderType; + } + + /** + * Sets Bank Account Holder Type. + * Defaults to personal + * + * @required + * @maps bank_account_holder_type + * @factory \AdvancedBillingLib\Models\BankAccountHolderType::checkValue + */ + public function setBankAccountHolderType(string $bankAccountHolderType): void + { + $this->bankAccountHolderType = $bankAccountHolderType; + } + + /** + * Returns Payment Type. + */ + public function getPaymentType(): string + { + return $this->paymentType; + } + + /** + * Sets Payment Type. + * + * @required + * @maps payment_type + */ + public function setPaymentType(string $paymentType): void + { + $this->paymentType = $paymentType; + } + + /** + * Returns Disabled. + */ + public function getDisabled(): bool + { + return $this->disabled; + } + + /** + * Sets Disabled. + * + * @required + * @maps disabled + */ + public function setDisabled(bool $disabled): void + { + $this->disabled = $disabled; + } + + /** + * Returns Site Gateway Setting Id. + */ + public function getSiteGatewaySettingId(): int + { + return $this->siteGatewaySettingId; + } + + /** + * Sets Site Gateway Setting Id. + * + * @required + * @maps site_gateway_setting_id + */ + public function setSiteGatewaySettingId(int $siteGatewaySettingId): void + { + $this->siteGatewaySettingId = $siteGatewaySettingId; + } + + /** + * Returns Customer Vault Token. + */ + public function getCustomerVaultToken(): ?string + { + if (count($this->customerVaultToken) == 0) { + return null; + } + return $this->customerVaultToken['value']; + } + + /** + * Sets Customer Vault Token. + * + * @maps customer_vault_token + */ + public function setCustomerVaultToken(?string $customerVaultToken): void + { + $this->customerVaultToken['value'] = $customerVaultToken; + } + + /** + * Unsets Customer Vault Token. + */ + public function unsetCustomerVaultToken(): void + { + $this->customerVaultToken = []; + } + + /** + * Returns Gateway Handle. + */ + public function getGatewayHandle(): ?string + { + if (count($this->gatewayHandle) == 0) { + return null; + } + return $this->gatewayHandle['value']; + } + + /** + * Sets Gateway Handle. + * + * @maps gateway_handle + */ + public function setGatewayHandle(?string $gatewayHandle): void + { + $this->gatewayHandle['value'] = $gatewayHandle; + } + + /** + * Unsets Gateway Handle. + */ + public function unsetGatewayHandle(): void + { + $this->gatewayHandle = []; + } + + /** + * Returns Verified. + */ + public function getVerified(): ?bool + { + if (count($this->verified) == 0) { + return null; + } + return $this->verified['value']; + } + + /** + * Sets Verified. + * + * @maps verified + */ + public function setVerified(?bool $verified): void + { + $this->verified['value'] = $verified; + } + + /** + * Unsets Verified. + */ + public function unsetVerified(): void + { + $this->verified = []; + } + + /** + * Converts the GetOneTimeTokenBankAccountPaymentProfile object to a human-readable string + * representation. + * + * @return string The string representation of the GetOneTimeTokenBankAccountPaymentProfile object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'GetOneTimeTokenBankAccountPaymentProfile', + [ + 'id' => $this->getId(), + 'firstName' => $this->firstName, + 'lastName' => $this->lastName, + 'customerId' => $this->getCustomerId(), + 'currentVault' => $this->currentVault, + 'vaultToken' => $this->vaultToken, + 'billingAddress' => $this->billingAddress, + 'billingAddress2' => $this->billingAddress2, + 'billingCity' => $this->billingCity, + 'billingCountry' => $this->billingCountry, + 'billingState' => $this->billingState, + 'billingZip' => $this->billingZip, + 'bankName' => $this->bankName, + 'maskedBankRoutingNumber' => $this->maskedBankRoutingNumber, + 'maskedBankAccountNumber' => $this->maskedBankAccountNumber, + 'bankAccountType' => $this->bankAccountType, + 'bankAccountHolderType' => $this->bankAccountHolderType, + 'paymentType' => $this->paymentType, + 'disabled' => $this->disabled, + 'siteGatewaySettingId' => $this->siteGatewaySettingId, + 'customerVaultToken' => $this->getCustomerVaultToken(), + 'gatewayHandle' => $this->getGatewayHandle(), + 'verified' => $this->getVerified(), + '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 (!empty($this->id)) { + $json['id'] = $this->id['value']; + } + $json['first_name'] = $this->firstName; + $json['last_name'] = $this->lastName; + if (!empty($this->customerId)) { + $json['customer_id'] = $this->customerId['value']; + } + $json['current_vault'] = BankAccountVault::checkValue($this->currentVault); + $json['vault_token'] = $this->vaultToken; + $json['billing_address'] = $this->billingAddress; + if (isset($this->billingAddress2)) { + $json['billing_address_2'] = $this->billingAddress2; + } + $json['billing_city'] = $this->billingCity; + $json['billing_country'] = $this->billingCountry; + $json['billing_state'] = $this->billingState; + $json['billing_zip'] = $this->billingZip; + $json['bank_name'] = $this->bankName; + $json['masked_bank_routing_number'] = $this->maskedBankRoutingNumber; + $json['masked_bank_account_number'] = $this->maskedBankAccountNumber; + $json['bank_account_type'] = BankAccountType::checkValue($this->bankAccountType); + $json['bank_account_holder_type'] = BankAccountHolderType::checkValue($this->bankAccountHolderType); + $json['payment_type'] = $this->paymentType; + $json['disabled'] = $this->disabled; + $json['site_gateway_setting_id'] = $this->siteGatewaySettingId; + if (!empty($this->customerVaultToken)) { + $json['customer_vault_token'] = $this->customerVaultToken['value']; + } + if (!empty($this->gatewayHandle)) { + $json['gateway_handle'] = $this->gatewayHandle['value']; + } + if (!empty($this->verified)) { + $json['verified'] = $this->verified['value']; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetOneTimeTokenRequest.php b/src/Models/GetOneTimeTokenRequest.php index 4b320897..f6763de7 100644 --- a/src/Models/GetOneTimeTokenRequest.php +++ b/src/Models/GetOneTimeTokenRequest.php @@ -16,22 +16,24 @@ class GetOneTimeTokenRequest implements \JsonSerializable { /** - * @var GetOneTimeTokenPaymentProfile + * @var GetOneTimeTokenPaymentProfile|GetOneTimeTokenBankAccountPaymentProfile */ private $paymentProfile; /** - * @param GetOneTimeTokenPaymentProfile $paymentProfile + * @param GetOneTimeTokenPaymentProfile|GetOneTimeTokenBankAccountPaymentProfile $paymentProfile */ - public function __construct(GetOneTimeTokenPaymentProfile $paymentProfile) + public function __construct($paymentProfile) { $this->paymentProfile = $paymentProfile; } /** * Returns Payment Profile. + * + * @return GetOneTimeTokenPaymentProfile|GetOneTimeTokenBankAccountPaymentProfile */ - public function getPaymentProfile(): GetOneTimeTokenPaymentProfile + public function getPaymentProfile() { return $this->paymentProfile; } @@ -41,8 +43,11 @@ public function getPaymentProfile(): GetOneTimeTokenPaymentProfile * * @required * @maps payment_profile + * @mapsBy anyOf(GetOneTimeTokenPaymentProfile,GetOneTimeTokenBankAccountPaymentProfile) + * + * @param GetOneTimeTokenPaymentProfile|GetOneTimeTokenBankAccountPaymentProfile $paymentProfile */ - public function setPaymentProfile(GetOneTimeTokenPaymentProfile $paymentProfile): void + public function setPaymentProfile($paymentProfile): void { $this->paymentProfile = $paymentProfile; } @@ -100,7 +105,11 @@ public function findAdditionalProperty(string $name) public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['payment_profile'] = $this->paymentProfile; + $json['payment_profile'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->paymentProfile, + 'anyOf(GetOneTimeTokenPaymentProfile,GetOneTimeTokenBankAccountPaymentProfile)' + ); $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/GroupBilling.php b/src/Models/GroupBilling.php index 5cd5b791..812e12c8 100644 --- a/src/Models/GroupBilling.php +++ b/src/Models/GroupBilling.php @@ -14,7 +14,8 @@ use stdClass; /** - * Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions. + * (Optional) Attributes related to billing date and accrual. Note: Only applicable for new + * subscriptions. */ class GroupBilling implements \JsonSerializable { diff --git a/src/Models/GroupSettings.php b/src/Models/GroupSettings.php index 64ec9f80..3c874211 100644 --- a/src/Models/GroupSettings.php +++ b/src/Models/GroupSettings.php @@ -58,7 +58,8 @@ public function setTarget(GroupTarget $target): void /** * Returns Billing. - * Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions. + * (Optional) Attributes related to billing date and accrual. Note: Only applicable for new + * subscriptions. */ public function getBilling(): ?GroupBilling { @@ -67,7 +68,8 @@ public function getBilling(): ?GroupBilling /** * Sets Billing. - * Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions. + * (Optional) Attributes related to billing date and accrual. Note: Only applicable for new + * subscriptions. * * @maps billing */ diff --git a/src/Models/GroupStatus.php b/src/Models/GroupStatus.php new file mode 100644 index 00000000..f71fb30f --- /dev/null +++ b/src/Models/GroupStatus.php @@ -0,0 +1,42 @@ +publicUrlExpiresOn = $publicUrlExpiresOn; } + /** + * Returns Branding Theme Id. + * The ID of the Branding Theme associated with this invoice. This value represents the Branding Theme + * used for invoice theming, such as themed invoice rendering. Available only when Branding Themes are + * enabled for the site. + */ + public function getBrandingThemeId(): ?int + { + if (count($this->brandingThemeId) == 0) { + return null; + } + return $this->brandingThemeId['value']; + } + + /** + * Sets Branding Theme Id. + * The ID of the Branding Theme associated with this invoice. This value represents the Branding Theme + * used for invoice theming, such as themed invoice rendering. Available only when Branding Themes are + * enabled for the site. + * + * @maps branding_theme_id + */ + public function setBrandingThemeId(?int $brandingThemeId): void + { + $this->brandingThemeId['value'] = $brandingThemeId; + } + + /** + * Unsets Branding Theme Id. + * The ID of the Branding Theme associated with this invoice. This value represents the Branding Theme + * used for invoice theming, such as themed invoice rendering. Available only when Branding Themes are + * enabled for the site. + */ + public function unsetBrandingThemeId(): void + { + $this->brandingThemeId = []; + } + /** * Converts the Invoice object to a human-readable string representation. * @@ -1633,6 +1676,7 @@ public function __toString(): string 'publicUrl' => $this->publicUrl, 'previousBalanceData' => $this->previousBalanceData, 'publicUrlExpiresOn' => $this->publicUrlExpiresOn, + 'brandingThemeId' => $this->getBrandingThemeId(), 'additionalProperties' => $this->additionalProperties ] ); @@ -1846,6 +1890,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->publicUrlExpiresOn)) { $json['public_url_expires_on'] = DateTimeHelper::toSimpleDate($this->publicUrlExpiresOn); } + if (!empty($this->brandingThemeId)) { + $json['branding_theme_id'] = $this->brandingThemeId['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/InvoiceConsolidationLevel.php b/src/Models/InvoiceConsolidationLevel.php index 933694ce..1d043e21 100644 --- a/src/Models/InvoiceConsolidationLevel.php +++ b/src/Models/InvoiceConsolidationLevel.php @@ -15,7 +15,7 @@ use stdClass; /** - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. diff --git a/src/Models/InvoiceCustomer.php b/src/Models/InvoiceCustomer.php index b04c409d..76fd1d4f 100644 --- a/src/Models/InvoiceCustomer.php +++ b/src/Models/InvoiceCustomer.php @@ -14,7 +14,7 @@ use stdClass; /** - * Information about the customer who is owner or recipient the invoiced subscription. + * Information about the customer who is owner or recipient of the invoiced subscription. */ class InvoiceCustomer implements \JsonSerializable { diff --git a/src/Models/InvoiceLineItem.php b/src/Models/InvoiceLineItem.php index fa020cf0..b9d7d405 100644 --- a/src/Models/InvoiceLineItem.php +++ b/src/Models/InvoiceLineItem.php @@ -143,7 +143,7 @@ class InvoiceLineItem implements \JsonSerializable /** * Returns Uid. - * Unique identifier for the line item. Useful when cross-referencing the line against individual + * Unique identifier for the line item. Useful when cross-referencing the line against individual * discounts in the `discounts` or `taxes` lists. */ public function getUid(): ?string @@ -153,7 +153,7 @@ public function getUid(): ?string /** * Sets Uid. - * Unique identifier for the line item. Useful when cross-referencing the line against individual + * Unique identifier for the line item. Useful when cross-referencing the line against individual * discounts in the `discounts` or `taxes` lists. * * @maps uid @@ -185,7 +185,7 @@ public function setTitle(?string $title): void /** * Returns Description. - * Detailed description for the charge or item represented by this line. May include proration details + * Detailed description for the charge or item represented by this line. May include proration details * in plain text. * * Note: this string may contain line breaks that are hints for the best display format on the invoice. @@ -197,7 +197,7 @@ public function getDescription(): ?string /** * Sets Description. - * Detailed description for the charge or item represented by this line. May include proration details + * Detailed description for the charge or item represented by this line. May include proration details * in plain text. * * Note: this string may contain line breaks that are hints for the best display format on the invoice. @@ -237,7 +237,7 @@ public function setQuantity(?string $quantity): void * Returns Unit Price. * The price per unit for the line item. * - * When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will + * When tiered pricing was used (i.e., not every unit was actually priced at the same price) this will * be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. */ public function getUnitPrice(): ?string @@ -249,7 +249,7 @@ public function getUnitPrice(): ?string * Sets Unit Price. * The price per unit for the line item. * - * When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will + * When tiered pricing was used (i.e., not every unit was actually priced at the same price) this will * be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`. * * @maps unit_price @@ -382,7 +382,7 @@ public function setTaxIncluded(?bool $taxIncluded): void * The non-canonical total amount for the line. * * `subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the - * sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to + * sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to * rounding or precision errors, the sum of line `total_amount`s may not equal the invoice * `total_amount`. */ @@ -396,7 +396,7 @@ public function getTotalAmount(): ?string * The non-canonical total amount for the line. * * `subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the - * sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to + * sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to * rounding or precision errors, the sum of line `total_amount`s may not equal the invoice * `total_amount`. * @@ -435,7 +435,7 @@ public function setTieredUnitPrice(?bool $tieredUnitPrice): void * * * For periodic charges paid in advance, this date will match the billing date, and the end date will * be in the future. - * * For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the + * * For periodic charges paid in arrears (e.g., metered charges), this date will be the date of the * previous billing, and the end date will be the current billing date. * * For non-periodic charges, this date and the end date will match. */ @@ -450,7 +450,7 @@ public function getPeriodRangeStart(): ?\DateTime * * * For periodic charges paid in advance, this date will match the billing date, and the end date will * be in the future. - * * For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the + * * For periodic charges paid in arrears (e.g., metered charges), this date will be the date of the * previous billing, and the end date will be the current billing date. * * For non-periodic charges, this date and the end date will match. * @@ -467,7 +467,7 @@ public function setPeriodRangeStart(?\DateTime $periodRangeStart): void * End date for the period covered by this line. The format is `"YYYY-MM-DD"`. * * * For periodic charges paid in advance, this date will match the next (future) billing date. - * * For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the + * * For periodic charges paid in arrears (e.g., metered charges), this date will be the date of the * current billing date. * * For non-periodic charges, this date and the start date will match. */ @@ -481,7 +481,7 @@ public function getPeriodRangeEnd(): ?\DateTime * End date for the period covered by this line. The format is `"YYYY-MM-DD"`. * * * For periodic charges paid in advance, this date will match the next (future) billing date. - * * For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the + * * For periodic charges paid in arrears (e.g., metered charges), this date will be the date of the * current billing date. * * For non-periodic charges, this date and the start date will match. * diff --git a/src/Models/IssueInvoiceEventData.php b/src/Models/IssueInvoiceEventData.php index f6cb3e37..b9ad91be 100644 --- a/src/Models/IssueInvoiceEventData.php +++ b/src/Models/IssueInvoiceEventData.php @@ -66,7 +66,7 @@ public function __construct( /** * Returns Consolidation Level. - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. @@ -86,7 +86,7 @@ public function getConsolidationLevel(): string /** * Sets Consolidation Level. - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. diff --git a/src/Models/IssueInvoiceRequest.php b/src/Models/IssueInvoiceRequest.php index 4c9eeb01..0179adfc 100644 --- a/src/Models/IssueInvoiceRequest.php +++ b/src/Models/IssueInvoiceRequest.php @@ -30,8 +30,8 @@ class IssueInvoiceRequest implements \JsonSerializable * no email sent to the customer; payment failure recorded in the invoice history. * - `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; * email sent to the customer for the issued invoice (if setting applies); payment failure recorded in - * the invoice history; subscription will most likely go into "past_due" or "canceled" state - * (depending upon net terms and dunning settings). + * the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending + * upon net terms and dunning settings). */ public function getOnFailedPayment(): ?string { @@ -48,8 +48,8 @@ public function getOnFailedPayment(): ?string * no email sent to the customer; payment failure recorded in the invoice history. * - `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; * email sent to the customer for the issued invoice (if setting applies); payment failure recorded in - * the invoice history; subscription will most likely go into "past_due" or "canceled" state - * (depending upon net terms and dunning settings). + * the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending + * upon net terms and dunning settings). * * @maps on_failed_payment * @factory \AdvancedBillingLib\Models\FailedPaymentAction::checkValue diff --git a/src/Models/ListSubscriptionGroupPrepayment.php b/src/Models/ListSubscriptionGroupPrepayment.php index 8c658d16..210b6cae 100644 --- a/src/Models/ListSubscriptionGroupPrepayment.php +++ b/src/Models/ListSubscriptionGroupPrepayment.php @@ -16,14 +16,14 @@ class ListSubscriptionGroupPrepayment implements \JsonSerializable { /** - * @var ListSubcriptionGroupPrepaymentItem + * @var ListSubscriptionGroupPrepaymentItem */ private $prepayment; /** - * @param ListSubcriptionGroupPrepaymentItem $prepayment + * @param ListSubscriptionGroupPrepaymentItem $prepayment */ - public function __construct(ListSubcriptionGroupPrepaymentItem $prepayment) + public function __construct(ListSubscriptionGroupPrepaymentItem $prepayment) { $this->prepayment = $prepayment; } @@ -31,7 +31,7 @@ public function __construct(ListSubcriptionGroupPrepaymentItem $prepayment) /** * Returns Prepayment. */ - public function getPrepayment(): ListSubcriptionGroupPrepaymentItem + public function getPrepayment(): ListSubscriptionGroupPrepaymentItem { return $this->prepayment; } @@ -42,7 +42,7 @@ public function getPrepayment(): ListSubcriptionGroupPrepaymentItem * @required * @maps prepayment */ - public function setPrepayment(ListSubcriptionGroupPrepaymentItem $prepayment): void + public function setPrepayment(ListSubscriptionGroupPrepaymentItem $prepayment): void { $this->prepayment = $prepayment; } diff --git a/src/Models/ListSubcriptionGroupPrepaymentItem.php b/src/Models/ListSubscriptionGroupPrepaymentItem.php similarity index 95% rename from src/Models/ListSubcriptionGroupPrepaymentItem.php rename to src/Models/ListSubscriptionGroupPrepaymentItem.php index 63bbffb5..4b52e368 100644 --- a/src/Models/ListSubcriptionGroupPrepaymentItem.php +++ b/src/Models/ListSubscriptionGroupPrepaymentItem.php @@ -14,7 +14,7 @@ use AdvancedBillingLib\Utils\DateTimeHelper; use stdClass; -class ListSubcriptionGroupPrepaymentItem implements \JsonSerializable +class ListSubscriptionGroupPrepaymentItem implements \JsonSerializable { /** * @var int|null @@ -226,14 +226,14 @@ public function setCreatedAt(?\DateTime $createdAt): void } /** - * Converts the ListSubcriptionGroupPrepaymentItem object to a human-readable string representation. + * Converts the ListSubscriptionGroupPrepaymentItem object to a human-readable string representation. * - * @return string The string representation of the ListSubcriptionGroupPrepaymentItem object. + * @return string The string representation of the ListSubscriptionGroupPrepaymentItem object. */ public function __toString(): string { return ApiHelper::stringify( - 'ListSubcriptionGroupPrepaymentItem', + 'ListSubscriptionGroupPrepaymentItem', [ 'id' => $this->id, 'subscriptionGroupUid' => $this->subscriptionGroupUid, diff --git a/src/Models/Metafield.php b/src/Models/Metafield.php index 1ba50393..1bbfd9fa 100644 --- a/src/Models/Metafield.php +++ b/src/Models/Metafield.php @@ -126,7 +126,7 @@ public function setDataCount(?int $dataCount): void /** * Returns Input Type. * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. */ public function getInputType(): ?string { @@ -136,7 +136,7 @@ public function getInputType(): ?string /** * Sets Input Type. * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. * * @maps input_type * @factory \AdvancedBillingLib\Models\MetafieldInput::checkValue diff --git a/src/Models/MetafieldInput.php b/src/Models/MetafieldInput.php index 7943d13e..4f96f057 100644 --- a/src/Models/MetafieldInput.php +++ b/src/Models/MetafieldInput.php @@ -16,7 +16,7 @@ /** * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. */ class MetafieldInput { diff --git a/src/Models/MeteredComponent.php b/src/Models/MeteredComponent.php index ae861884..ea29756b 100644 --- a/src/Models/MeteredComponent.php +++ b/src/Models/MeteredComponent.php @@ -95,6 +95,11 @@ class MeteredComponent implements \JsonSerializable */ private $intervalUnit = []; + /** + * @var array + */ + private $unspscCode = []; + /** * @param string $name * @param string $unitName @@ -110,7 +115,7 @@ public function __construct(string $name, string $unitName, string $pricingSchem /** * Returns Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, e.g., "Minutes". */ public function getName(): string { @@ -120,7 +125,7 @@ public function getName(): string /** * Sets Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, e.g., "Minutes". * * @required * @maps name @@ -133,7 +138,7 @@ public function setName(string $name): void /** * Returns Unit Name. * The name of the unit of measurement for the component. It should be singular since it will be - * automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on + * automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on * a subscription’s component line-item */ public function getUnitName(): string @@ -144,7 +149,7 @@ public function getUnitName(): string /** * Sets Unit Name. * The name of the unit of measurement for the component. It should be singular since it will be - * automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on + * automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on * a subscription’s component line-item * * @required @@ -177,7 +182,7 @@ public function setDescription(?string $description): void /** * Returns Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. */ @@ -188,7 +193,7 @@ public function getHandle(): ?string /** * Sets Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. * @@ -297,7 +302,7 @@ public function setPricePoints(?array $pricePoints): void * Returns Unit Price. * The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off * Components, this is the amount that the customer will be charged when they turn the component on for - * the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * the subscription. The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @return string|float|null */ @@ -310,7 +315,7 @@ public function getUnitPrice() * Sets Unit Price. * The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off * Components, this is the amount that the customer will be charged when they turn the component on for - * the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * the subscription. The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @maps unit_price * @mapsBy anyOf(oneOf(string,float),null) @@ -426,7 +431,7 @@ public function setPublicSignupPageIds(?array $publicSignupPageIds): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean * this component's default price point would renew every 30 days. This property is only available for * sites with Multifrequency enabled. */ @@ -437,7 +442,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean * this component's default price point would renew every 30 days. This property is only available for * sites with Multifrequency enabled. * @@ -484,6 +489,44 @@ public function unsetIntervalUnit(): void $this->intervalUnit = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the MeteredComponent object to a human-readable string representation. * @@ -510,6 +553,7 @@ public function __toString(): string 'publicSignupPageIds' => $this->publicSignupPageIds, 'interval' => $this->interval, 'intervalUnit' => $this->getIntervalUnit(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -601,6 +645,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->intervalUnit)) { $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/MeteredUsage.php b/src/Models/MeteredUsage.php index cc510bde..bea12a8b 100644 --- a/src/Models/MeteredUsage.php +++ b/src/Models/MeteredUsage.php @@ -21,7 +21,7 @@ class MeteredUsage implements \JsonSerializable private $previousUnitBalance; /** - * @var int + * @var int|string */ private $newUnitBalance; @@ -47,7 +47,7 @@ class MeteredUsage implements \JsonSerializable /** * @param string $previousUnitBalance - * @param int $newUnitBalance + * @param int|string $newUnitBalance * @param int $usageQuantity * @param int $componentId * @param string $componentHandle @@ -55,7 +55,7 @@ class MeteredUsage implements \JsonSerializable */ public function __construct( string $previousUnitBalance, - int $newUnitBalance, + $newUnitBalance, int $usageQuantity, int $componentId, string $componentHandle, @@ -90,8 +90,10 @@ public function setPreviousUnitBalance(string $previousUnitBalance): void /** * Returns New Unit Balance. + * + * @return int|string */ - public function getNewUnitBalance(): int + public function getNewUnitBalance() { return $this->newUnitBalance; } @@ -101,8 +103,11 @@ public function getNewUnitBalance(): int * * @required * @maps new_unit_balance + * @mapsBy oneOf(int,string) + * + * @param int|string $newUnitBalance */ - public function setNewUnitBalance(int $newUnitBalance): void + public function setNewUnitBalance($newUnitBalance): void { $this->newUnitBalance = $newUnitBalance; } @@ -245,7 +250,11 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; $json['previous_unit_balance'] = $this->previousUnitBalance; - $json['new_unit_balance'] = $this->newUnitBalance; + $json['new_unit_balance'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->newUnitBalance, + 'oneOf(int,string)' + ); $json['usage_quantity'] = $this->usageQuantity; $json['component_id'] = $this->componentId; $json['component_handle'] = $this->componentHandle; diff --git a/src/Models/OfferItem.php b/src/Models/OfferItem.php index 7b15213e..828e342d 100644 --- a/src/Models/OfferItem.php +++ b/src/Models/OfferItem.php @@ -215,7 +215,7 @@ public function setCurrencyPrices(?array $currencyPrices): void /** * Returns Interval. - * The numerical interval. i.e. an interval of '30' coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -226,7 +226,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of '30' coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * diff --git a/src/Models/OnOffComponent.php b/src/Models/OnOffComponent.php index c2b55de9..cbfc6463 100644 --- a/src/Models/OnOffComponent.php +++ b/src/Models/OnOffComponent.php @@ -90,6 +90,11 @@ class OnOffComponent implements \JsonSerializable */ private $intervalUnit = []; + /** + * @var array + */ + private $unspscCode = []; + /** * @param string $name * @param string|float $unitPrice @@ -103,7 +108,7 @@ public function __construct(string $name, $unitPrice) /** * Returns Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, e.g., "Minutes". */ public function getName(): string { @@ -113,7 +118,7 @@ public function getName(): string /** * Sets Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, e.g., "Minutes". * * @required * @maps name @@ -145,7 +150,7 @@ public function setDescription(?string $description): void /** * Returns Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. */ @@ -156,7 +161,7 @@ public function getHandle(): ?string /** * Sets Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. * @@ -284,7 +289,7 @@ public function setPricePoints(?array $pricePoints): void /** * Returns Unit Price. * This is the amount that the customer will be charged when they turn the component on for the - * subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * subscription. The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @return string|float */ @@ -296,7 +301,7 @@ public function getUnitPrice() /** * Sets Unit Price. * This is the amount that the customer will be charged when they turn the component on for the - * subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * subscription. The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @required * @maps unit_price @@ -413,7 +418,7 @@ public function setPublicSignupPageIds(?array $publicSignupPageIds): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean * this component's default price point would renew every 30 days. This property is only available for * sites with Multifrequency enabled. */ @@ -424,7 +429,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean * this component's default price point would renew every 30 days. This property is only available for * sites with Multifrequency enabled. * @@ -471,6 +476,44 @@ public function unsetIntervalUnit(): void $this->intervalUnit = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the OnOffComponent object to a human-readable string representation. * @@ -496,6 +539,7 @@ public function __toString(): string 'publicSignupPageIds' => $this->publicSignupPageIds, 'interval' => $this->interval, 'intervalUnit' => $this->getIntervalUnit(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -586,6 +630,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->intervalUnit)) { $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/PauseRequest.php b/src/Models/PauseRequest.php index e50290d1..3e6aa2ef 100644 --- a/src/Models/PauseRequest.php +++ b/src/Models/PauseRequest.php @@ -14,7 +14,7 @@ use stdClass; /** - * Allows to pause a Subscription + * Allows you to pause a Subscription. */ class PauseRequest implements \JsonSerializable { diff --git a/src/Models/PaymentProfileAttributes.php b/src/Models/PaymentProfileAttributes.php index fc6c8870..d27934aa 100644 --- a/src/Models/PaymentProfileAttributes.php +++ b/src/Models/PaymentProfileAttributes.php @@ -146,8 +146,8 @@ class PaymentProfileAttributes implements \JsonSerializable /** * Returns Chargify Token. * (Optional) Token received after sending billing information using Maxio.js (formerly Chargify.js). - * This token must be passed as a sole attribute of `payment_profile_attributes` (i.e. - * tok_9g6hw85pnpt6knmskpwp4ttt) + * This token must be passed as a sole attribute of `payment_profile_attributes` (e.g., + * tok_9g6hw85pnpt6knmskpwp4ttt). */ public function getChargifyToken(): ?string { @@ -157,8 +157,8 @@ public function getChargifyToken(): ?string /** * Sets Chargify Token. * (Optional) Token received after sending billing information using Maxio.js (formerly Chargify.js). - * This token must be passed as a sole attribute of `payment_profile_attributes` (i.e. - * tok_9g6hw85pnpt6knmskpwp4ttt) + * This token must be passed as a sole attribute of `payment_profile_attributes` (e.g., + * tok_9g6hw85pnpt6knmskpwp4ttt). * * @maps chargify_token */ @@ -268,7 +268,7 @@ public function setMaskedCardNumber(?string $maskedCardNumber): void /** * Returns Full Number. - * The full credit card number (string representation, i.e. 5424000000000015) + * The full credit card number (string representation, e.g., 5424000000000015) */ public function getFullNumber(): ?string { @@ -277,7 +277,7 @@ public function getFullNumber(): ?string /** * Sets Full Number. - * The full credit card number (string representation, i.e. 5424000000000015) + * The full credit card number (string representation, e.g., 5424000000000015) * * @maps full_number */ @@ -288,8 +288,8 @@ public function setFullNumber(?string $fullNumber): void /** * Returns Card Type. - * (Optional, used only for Subscription Import) If you know the card type (i.e. Visa, MC, etc) you may - * supply it here so that we may display the card type in the UI. + * (Optional, used only for Subscription Import) If you know the card type (e.g., Visa, MC, etc.) you + * may supply it here so that we may display the card type in the UI. */ public function getCardType(): ?string { @@ -298,8 +298,8 @@ public function getCardType(): ?string /** * Sets Card Type. - * (Optional, used only for Subscription Import) If you know the card type (i.e. Visa, MC, etc) you may - * supply it here so that we may display the card type in the UI. + * (Optional, used only for Subscription Import) If you know the card type (e.g., Visa, MC, etc.) you + * may supply it here so that we may display the card type in the UI. * * @maps card_type * @factory \AdvancedBillingLib\Models\CardType::checkValue @@ -312,7 +312,7 @@ public function setCardType(?string $cardType): void /** * Returns Expiration Month. * (Optional when performing a Subscription Import via vault_token, required otherwise) The 1- or 2- - * digit credit card expiration month, as an integer or string, i.e. 5 + * digit credit card expiration month, as an integer or string, e.g., 5 * * @return int|string|null */ @@ -324,7 +324,7 @@ public function getExpirationMonth() /** * Sets Expiration Month. * (Optional when performing a Subscription Import via vault_token, required otherwise) The 1- or 2- - * digit credit card expiration month, as an integer or string, i.e. 5 + * digit credit card expiration month, as an integer or string, e.g., 5 * * @maps expiration_month * @mapsBy anyOf(oneOf(int,string),null) @@ -339,7 +339,7 @@ public function setExpirationMonth($expirationMonth): void /** * Returns Expiration Year. * (Optional when performing a Subscription Import via vault_token, required otherwise) The 4-digit - * credit card expiration year, as an integer or string, i.e. 2012 + * credit card expiration year, as an integer or string, e.g., 2012 * * @return int|string|null */ @@ -351,7 +351,7 @@ public function getExpirationYear() /** * Sets Expiration Year. * (Optional when performing a Subscription Import via vault_token, required otherwise) The 4-digit - * credit card expiration year, as an integer or string, i.e. 2012 + * credit card expiration year, as an integer or string, e.g., 2012 * * @maps expiration_year * @mapsBy anyOf(oneOf(int,string),null) @@ -366,7 +366,7 @@ public function setExpirationYear($expirationYear): void /** * Returns Billing Address. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the + * bank account billing street address (e.g., 123 Main St.). This value is merely passed through to the * payment gateway. */ public function getBillingAddress(): ?string @@ -377,7 +377,7 @@ public function getBillingAddress(): ?string /** * Sets Billing Address. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the + * bank account billing street address (e.g., 123 Main St.). This value is merely passed through to the * payment gateway. * * @maps billing_address @@ -389,7 +389,7 @@ public function setBillingAddress(?string $billingAddress): void /** * Returns Billing Address 2. - * (Optional) Second line of the customer’s billing address i.e. Apt. 100 + * (Optional) Second line of the customer’s billing address, e.g., Apt. 100 */ public function getBillingAddress2(): ?string { @@ -401,7 +401,7 @@ public function getBillingAddress2(): ?string /** * Sets Billing Address 2. - * (Optional) Second line of the customer’s billing address i.e. Apt. 100 + * (Optional) Second line of the customer’s billing address, e.g., Apt. 100 * * @maps billing_address_2 */ @@ -412,7 +412,7 @@ public function setBillingAddress2(?string $billingAddress2): void /** * Unsets Billing Address 2. - * (Optional) Second line of the customer’s billing address i.e. Apt. 100 + * (Optional) Second line of the customer’s billing address, e.g., Apt. 100 */ public function unsetBillingAddress2(): void { @@ -422,7 +422,7 @@ public function unsetBillingAddress2(): void /** * Returns Billing City. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing address city (i.e. “Boston”). This value is merely passed through to the + * bank account billing address city (e.g., “Boston”). This value is merely passed through to the * payment gateway. */ public function getBillingCity(): ?string @@ -433,7 +433,7 @@ public function getBillingCity(): ?string /** * Sets Billing City. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing address city (i.e. “Boston”). This value is merely passed through to the + * bank account billing address city (e.g., “Boston”). This value is merely passed through to the * payment gateway. * * @maps billing_city @@ -446,7 +446,7 @@ public function setBillingCity(?string $billingCity): void /** * Returns Billing State. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing address state (i.e. MA). This value is merely passed through to the payment + * bank account billing address state (e.g., MA). This value is merely passed through to the payment * gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166- * 1#Current_codes) in order to be valid for tax locale purposes. */ @@ -458,7 +458,7 @@ public function getBillingState(): ?string /** * Sets Billing State. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing address state (i.e. MA). This value is merely passed through to the payment + * bank account billing address state (e.g., MA). This value is merely passed through to the payment * gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166- * 1#Current_codes) in order to be valid for tax locale purposes. * @@ -473,7 +473,7 @@ public function setBillingState(?string $billingState): void * Returns Billing Country. * (Optional, may be required by your product configuration or gateway settings) The credit card or * bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia. - * org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment + * org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to the payment * gateway. Some gateways require country codes in a specific format. Check your gateway’s * documentation. If creating an ACH subscription, only US is supported at this time. */ @@ -486,7 +486,7 @@ public function getBillingCountry(): ?string * Sets Billing Country. * (Optional, may be required by your product configuration or gateway settings) The credit card or * bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia. - * org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment + * org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to the payment * gateway. Some gateways require country codes in a specific format. Check your gateway’s * documentation. If creating an ACH subscription, only US is supported at this time. * @@ -500,7 +500,7 @@ public function setBillingCountry(?string $billingCountry): void /** * Returns Billing Zip. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing address zip code (i.e. 12345). This value is merely passed through to the + * bank account billing address zip code (e.g., 12345). This value is merely passed through to the * payment gateway. */ public function getBillingZip(): ?string @@ -511,7 +511,7 @@ public function getBillingZip(): ?string /** * Sets Billing Zip. * (Optional, may be required by your product configuration or gateway settings) The credit card or - * bank account billing address zip code (i.e. 12345). This value is merely passed through to the + * bank account billing address zip code (e.g., 12345). This value is merely passed through to the * payment gateway. * * @maps billing_zip @@ -701,7 +701,7 @@ public function setCvv(?string $cvv): void /** * Returns Last Four. * (Optional, used only for Subscription Import) If you have the last 4 digits of the credit card - * number, you may supply them here so that we may create a masked card number (i.e. XXXX-XXXX-XXXX- + * number, you may supply them here so that we may create a masked card number (e.g., XXXX-XXXX-XXXX- * 1234) for display in the UI. Last 4 digits are required for refunds in Auth.Net. */ public function getLastFour(): ?string @@ -712,7 +712,7 @@ public function getLastFour(): ?string /** * Sets Last Four. * (Optional, used only for Subscription Import) If you have the last 4 digits of the credit card - * number, you may supply them here so that we may create a masked card number (i.e. XXXX-XXXX-XXXX- + * number, you may supply them here so that we may create a masked card number (e.g., XXXX-XXXX-XXXX- * 1234) for display in the UI. Last 4 digits are required for refunds in Auth.Net. * * @maps last_four diff --git a/src/Models/PrepaidUsage.php b/src/Models/PrepaidUsage.php index 702c647d..bbd957e1 100644 --- a/src/Models/PrepaidUsage.php +++ b/src/Models/PrepaidUsage.php @@ -26,12 +26,12 @@ class PrepaidUsage implements \JsonSerializable private $previousOverageUnitBalance; /** - * @var int + * @var int|string */ private $newUnitBalance; /** - * @var int + * @var int|string */ private $newOverageUnitBalance; @@ -68,8 +68,8 @@ class PrepaidUsage implements \JsonSerializable /** * @param string $previousUnitBalance * @param string $previousOverageUnitBalance - * @param int $newUnitBalance - * @param int $newOverageUnitBalance + * @param int|string $newUnitBalance + * @param int|string $newOverageUnitBalance * @param int $usageQuantity * @param int $overageUsageQuantity * @param int $componentId @@ -80,8 +80,8 @@ class PrepaidUsage implements \JsonSerializable public function __construct( string $previousUnitBalance, string $previousOverageUnitBalance, - int $newUnitBalance, - int $newOverageUnitBalance, + $newUnitBalance, + $newOverageUnitBalance, int $usageQuantity, int $overageUsageQuantity, int $componentId, @@ -141,8 +141,10 @@ public function setPreviousOverageUnitBalance(string $previousOverageUnitBalance /** * Returns New Unit Balance. + * + * @return int|string */ - public function getNewUnitBalance(): int + public function getNewUnitBalance() { return $this->newUnitBalance; } @@ -152,16 +154,21 @@ public function getNewUnitBalance(): int * * @required * @maps new_unit_balance + * @mapsBy oneOf(int,string) + * + * @param int|string $newUnitBalance */ - public function setNewUnitBalance(int $newUnitBalance): void + public function setNewUnitBalance($newUnitBalance): void { $this->newUnitBalance = $newUnitBalance; } /** * Returns New Overage Unit Balance. + * + * @return int|string */ - public function getNewOverageUnitBalance(): int + public function getNewOverageUnitBalance() { return $this->newOverageUnitBalance; } @@ -171,8 +178,11 @@ public function getNewOverageUnitBalance(): int * * @required * @maps new_overage_unit_balance + * @mapsBy oneOf(int,string) + * + * @param int|string $newOverageUnitBalance */ - public function setNewOverageUnitBalance(int $newOverageUnitBalance): void + public function setNewOverageUnitBalance($newOverageUnitBalance): void { $this->newOverageUnitBalance = $newOverageUnitBalance; } @@ -362,8 +372,16 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json = []; $json['previous_unit_balance'] = $this->previousUnitBalance; $json['previous_overage_unit_balance'] = $this->previousOverageUnitBalance; - $json['new_unit_balance'] = $this->newUnitBalance; - $json['new_overage_unit_balance'] = $this->newOverageUnitBalance; + $json['new_unit_balance'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->newUnitBalance, + 'oneOf(int,string)' + ); + $json['new_overage_unit_balance'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->newOverageUnitBalance, + 'oneOf(int,string)' + ); $json['usage_quantity'] = $this->usageQuantity; $json['overage_usage_quantity'] = $this->overageUsageQuantity; $json['component_id'] = $this->componentId; diff --git a/src/Models/PrepaidUsageComponent.php b/src/Models/PrepaidUsageComponent.php index fb642f4c..de0dad4e 100644 --- a/src/Models/PrepaidUsageComponent.php +++ b/src/Models/PrepaidUsageComponent.php @@ -120,6 +120,11 @@ class PrepaidUsageComponent implements \JsonSerializable */ private $publicSignupPageIds; + /** + * @var array + */ + private $unspscCode = []; + /** * @param string $name * @param string $unitName @@ -137,7 +142,7 @@ public function __construct(string $name, string $unitName, string $pricingSchem /** * Returns Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, e.g., "Minutes". */ public function getName(): string { @@ -147,7 +152,7 @@ public function getName(): string /** * Sets Name. * A name for this component that is suitable for showing customers and displaying on billing - * statements, ie. "Minutes". + * statements, e.g., "Minutes". * * @required * @maps name @@ -160,7 +165,7 @@ public function setName(string $name): void /** * Returns Unit Name. * The name of the unit of measurement for the component. It should be singular since it will be - * automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on + * automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on * a subscription’s component line-item */ public function getUnitName(): string @@ -171,7 +176,7 @@ public function getUnitName(): string /** * Sets Unit Name. * The name of the unit of measurement for the component. It should be singular since it will be - * automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on + * automatically pluralized when necessary. e.g., “message”, which may then be shown as “5 messages” on * a subscription’s component line-item * * @required @@ -204,7 +209,7 @@ public function setDescription(?string $description): void /** * Returns Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. */ @@ -215,7 +220,7 @@ public function getHandle(): ?string /** * Sets Handle. - * A unique identifier for your use that can be used to retrieve this component is subsequent requests. + * A unique identifier for your use that can be used to retrieve this component in subsequent requests. * Must start with a letter or number and may only contain lowercase letters, numbers, or the * characters '.', ':', '-', or '_'. * @@ -396,7 +401,7 @@ public function setPricePoints(?array $pricePoints): void * Returns Unit Price. * The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off * Components, this is the amount that the customer will be charged when they turn the component on for - * the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * the subscription. The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @return string|float|null */ @@ -409,7 +414,7 @@ public function getUnitPrice() * Sets Unit Price. * The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off * Components, this is the amount that the customer will be charged when they turn the component on for - * the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * the subscription. The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @maps unit_price * @mapsBy anyOf(oneOf(string,float),null) @@ -486,7 +491,7 @@ public function setOveragePricing(OveragePricing $overagePricing): void /** * Returns Rollover Prepaid Remainder. - * Boolean which controls whether or not remaining units should be rolled over to the next period + * Boolean which controls whether or not remaining units should be rolled over to the next period. */ public function getRolloverPrepaidRemainder(): ?bool { @@ -495,7 +500,7 @@ public function getRolloverPrepaidRemainder(): ?bool /** * Sets Rollover Prepaid Remainder. - * Boolean which controls whether or not remaining units should be rolled over to the next period + * Boolean which controls whether or not remaining units should be rolled over to the next period. * * @maps rollover_prepaid_remainder */ @@ -507,7 +512,7 @@ public function setRolloverPrepaidRemainder(?bool $rolloverPrepaidRemainder): vo /** * Returns Renew Prepaid Allocation. * Boolean which controls whether or not the allocated quantity should be renewed at the beginning of - * each period + * each period. */ public function getRenewPrepaidAllocation(): ?bool { @@ -517,7 +522,7 @@ public function getRenewPrepaidAllocation(): ?bool /** * Sets Renew Prepaid Allocation. * Boolean which controls whether or not the allocated quantity should be renewed at the beginning of - * each period + * each period. * * @maps renew_prepaid_allocation */ @@ -636,6 +641,44 @@ public function setPublicSignupPageIds(?array $publicSignupPageIds): void $this->publicSignupPageIds = $publicSignupPageIds; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the PrepaidUsageComponent object to a human-readable string representation. * @@ -667,6 +710,7 @@ public function __toString(): string 'displayOnHostedPage' => $this->displayOnHostedPage, 'allowFractionalQuantities' => $this->allowFractionalQuantities, 'publicSignupPageIds' => $this->publicSignupPageIds, + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -774,6 +818,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->publicSignupPageIds)) { $json['public_signup_page_ids'] = $this->publicSignupPageIds; } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/Price.php b/src/Models/Price.php index a4ea9ecf..283f54cf 100644 --- a/src/Models/Price.php +++ b/src/Models/Price.php @@ -100,7 +100,7 @@ public function unsetEndingQuantity(): void /** * Returns Unit Price. - * The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @return float|string */ @@ -111,7 +111,7 @@ public function getUnitPrice() /** * Sets Unit Price. - * The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @required * @maps unit_price diff --git a/src/Models/Product.php b/src/Models/Product.php index 29bc43df..8c7baa3d 100644 --- a/src/Models/Product.php +++ b/src/Models/Product.php @@ -201,6 +201,11 @@ class Product implements \JsonSerializable */ private $productPricePointHandle = []; + /** + * @var array + */ + private $unspscCode = []; + /** * Returns Id. */ @@ -305,7 +310,7 @@ public function unsetDescription(): void /** * Returns Accounting Code. - * E.g. Internal ID or SKU Number + * E.g., Internal ID or SKU Number */ public function getAccountingCode(): ?string { @@ -317,7 +322,7 @@ public function getAccountingCode(): ?string /** * Sets Accounting Code. - * E.g. Internal ID or SKU Number + * E.g., Internal ID or SKU Number * * @maps accounting_code */ @@ -328,7 +333,7 @@ public function setAccountingCode(?string $accountingCode): void /** * Unsets Accounting Code. - * E.g. Internal ID or SKU Number + * E.g., Internal ID or SKU Number */ public function unsetAccountingCode(): void { @@ -361,7 +366,7 @@ public function setRequestCreditCard(?bool $requestCreditCard): void * Returns Expiration Interval. * A numerical interval for the length a subscription to this product will run before it expires. See * the description of interval for a description of how this value is coupled with an interval unit to - * calculate the full interval + * calculate the full interval. */ public function getExpirationInterval(): ?int { @@ -375,7 +380,7 @@ public function getExpirationInterval(): ?int * Sets Expiration Interval. * A numerical interval for the length a subscription to this product will run before it expires. See * the description of interval for a description of how this value is coupled with an interval unit to - * calculate the full interval + * calculate the full interval. * * @maps expiration_interval */ @@ -388,7 +393,7 @@ public function setExpirationInterval(?int $expirationInterval): void * Unsets Expiration Interval. * A numerical interval for the length a subscription to this product will run before it expires. See * the description of interval for a description of how this value is coupled with an interval unit to - * calculate the full interval + * calculate the full interval. */ public function unsetExpirationInterval(): void { @@ -492,8 +497,8 @@ public function setPriceInCents(?int $priceInCents): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product would renew every 30 days. */ public function getInterval(): ?int { @@ -502,8 +507,8 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product would renew every 30 days. * * @maps interval */ @@ -601,7 +606,7 @@ public function unsetTrialPriceInCents(): void * Returns Trial Interval. * A numerical interval for the length of the trial period of a subscription to this product. See the * description of interval for a description of how this value is coupled with an interval unit to - * calculate the full interval + * calculate the full interval. */ public function getTrialInterval(): ?int { @@ -615,7 +620,7 @@ public function getTrialInterval(): ?int * Sets Trial Interval. * A numerical interval for the length of the trial period of a subscription to this product. See the * description of interval for a description of how this value is coupled with an interval unit to - * calculate the full interval + * calculate the full interval. * * @maps trial_interval */ @@ -628,7 +633,7 @@ public function setTrialInterval(?int $trialInterval): void * Unsets Trial Interval. * A numerical interval for the length of the trial period of a subscription to this product. See the * description of interval for a description of how this value is coupled with an interval unit to - * calculate the full interval + * calculate the full interval. */ public function unsetTrialInterval(): void { @@ -855,7 +860,7 @@ public function setVersionNumber(?int $versionNumber): void * Returns Update Return Params. * The parameters will append to the url after a successful account update. See [help * documentation](https://help.chargify.com/products/product-editing.html#return-parameters-after- - * account-update) + * account-update). */ public function getUpdateReturnParams(): ?string { @@ -869,7 +874,7 @@ public function getUpdateReturnParams(): ?string * Sets Update Return Params. * The parameters will append to the url after a successful account update. See [help * documentation](https://help.chargify.com/products/product-editing.html#return-parameters-after- - * account-update) + * account-update). * * @maps update_return_params */ @@ -882,7 +887,7 @@ public function setUpdateReturnParams(?string $updateReturnParams): void * Unsets Update Return Params. * The parameters will append to the url after a successful account update. See [help * documentation](https://help.chargify.com/products/product-editing.html#return-parameters-after- - * account-update) + * account-update). */ public function unsetUpdateReturnParams(): void { @@ -1172,6 +1177,44 @@ public function unsetProductPricePointHandle(): void $this->productPricePointHandle = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this product instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this product instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this product instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the Product object to a human-readable string representation. * @@ -1219,6 +1262,7 @@ public function __toString(): string 'itemCategory' => $this->getItemCategory(), 'productPricePointId' => $this->productPricePointId, 'productPricePointHandle' => $this->getProductPricePointHandle(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -1378,6 +1422,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->productPricePointHandle)) { $json['product_price_point_handle'] = $this->productPricePointHandle['value']; } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/ProductFamily.php b/src/Models/ProductFamily.php index 28292353..3739c2fc 100644 --- a/src/Models/ProductFamily.php +++ b/src/Models/ProductFamily.php @@ -41,6 +41,11 @@ class ProductFamily implements \JsonSerializable */ private $description = []; + /** + * @var bool|null + */ + private $surcharging; + /** * @var \DateTime|null */ @@ -168,6 +173,28 @@ public function unsetDescription(): void $this->description = []; } + /** + * Returns Surcharging. + * Whether surcharging applies to this product family. Only included on sites where surcharging is + * enabled. + */ + public function getSurcharging(): ?bool + { + return $this->surcharging; + } + + /** + * Sets Surcharging. + * Whether surcharging applies to this product family. Only included on sites where surcharging is + * enabled. + * + * @maps surcharging + */ + public function setSurcharging(?bool $surcharging): void + { + $this->surcharging = $surcharging; + } + /** * Returns Created At. */ @@ -257,6 +284,7 @@ public function __toString(): string 'handle' => $this->handle, 'accountingCode' => $this->getAccountingCode(), 'description' => $this->getDescription(), + 'surcharging' => $this->surcharging, 'createdAt' => $this->createdAt, 'updatedAt' => $this->updatedAt, 'archivedAt' => $this->getArchivedAt(), @@ -320,6 +348,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->description)) { $json['description'] = $this->description['value']; } + if (isset($this->surcharging)) { + $json['surcharging'] = $this->surcharging; + } if (isset($this->createdAt)) { $json['created_at'] = DateTimeHelper::toRfc3339DateTime($this->createdAt); } diff --git a/src/Models/ProductPricePoint.php b/src/Models/ProductPricePoint.php index 84a097df..29472da5 100644 --- a/src/Models/ProductPricePoint.php +++ b/src/Models/ProductPricePoint.php @@ -228,8 +228,8 @@ public function setPriceInCents(?int $priceInCents): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product price point would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product price point would renew every 30 days. */ public function getInterval(): ?int { @@ -238,8 +238,8 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean - * this product price point would renew every 30 days + * The numerical interval. e.g., an interval of ‘30’ coupled with an interval_unit of day would mean + * this product price point would renew every 30 days. * * @maps interval */ @@ -303,8 +303,8 @@ public function unsetTrialPriceInCents(): void /** * Returns Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day - * would mean this product price point trial would last 30 days + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day + * would mean this product price point trial would last 30 days. */ public function getTrialInterval(): ?int { @@ -316,8 +316,8 @@ public function getTrialInterval(): ?int /** * Sets Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day - * would mean this product price point trial would last 30 days + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day + * would mean this product price point trial would last 30 days. * * @maps trial_interval */ @@ -328,8 +328,8 @@ public function setTrialInterval(?int $trialInterval): void /** * Unsets Trial Interval. - * The numerical trial interval. i.e. an interval of ‘30’ coupled with a trial_interval_unit of day - * would mean this product price point trial would last 30 days + * The numerical trial interval. e.g., an interval of ‘30’ coupled with a trial_interval_unit of day + * would mean this product price point trial would last 30 days. */ public function unsetTrialInterval(): void { @@ -371,7 +371,7 @@ public function unsetTrialIntervalUnit(): void /** * Returns Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -386,7 +386,7 @@ public function getTrialType(): ?string /** * Sets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -401,7 +401,7 @@ public function setTrialType(?string $trialType): void /** * Unsets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -506,8 +506,8 @@ public function unsetInitialChargeAfterTrial(): void /** * 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 + * The numerical expiration interval. e.g., 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 { @@ -519,8 +519,8 @@ public function getExpirationInterval(): ?int /** * 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 + * The numerical expiration interval. e.g., 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 */ @@ -531,8 +531,8 @@ public function setExpirationInterval(?int $expirationInterval): void /** * Unsets 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 + * The numerical expiration interval. e.g., 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 unsetExpirationInterval(): void { diff --git a/src/Models/ProformaInvoice.php b/src/Models/ProformaInvoice.php index 908cf0da..40e8713e 100644 --- a/src/Models/ProformaInvoice.php +++ b/src/Models/ProformaInvoice.php @@ -473,7 +473,7 @@ public function setCurrency(?string $currency): void /** * Returns Consolidation Level. - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. @@ -493,7 +493,7 @@ public function getConsolidationLevel(): ?string /** * Sets Consolidation Level. - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. @@ -552,7 +552,7 @@ public function setProductFamilyName(?string $productFamilyName): void /** * Returns Role. - * 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic + * 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic. */ public function getRole(): ?string { @@ -561,7 +561,7 @@ public function getRole(): ?string /** * Sets Role. - * 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic + * 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic. * * @maps role * @factory \AdvancedBillingLib\Models\ProformaInvoiceRole::checkValue @@ -593,7 +593,7 @@ public function setSeller(?InvoiceSeller $seller): void /** * Returns Customer. - * Information about the customer who is owner or recipient the invoiced subscription. + * Information about the customer who is owner or recipient of the invoiced subscription. */ public function getCustomer(): ?InvoiceCustomer { @@ -602,7 +602,7 @@ public function getCustomer(): ?InvoiceCustomer /** * Sets Customer. - * Information about the customer who is owner or recipient the invoiced subscription. + * Information about the customer who is owner or recipient of the invoiced subscription. * * @maps customer */ diff --git a/src/Models/ProformaInvoiceRole.php b/src/Models/ProformaInvoiceRole.php index 55c2f224..a7548a63 100644 --- a/src/Models/ProformaInvoiceRole.php +++ b/src/Models/ProformaInvoiceRole.php @@ -15,7 +15,7 @@ use stdClass; /** - * 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic + * 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic. */ class ProformaInvoiceRole { diff --git a/src/Models/PublicSignupPage.php b/src/Models/PublicSignupPage.php index fe5a31df..e1b1a353 100644 --- a/src/Models/PublicSignupPage.php +++ b/src/Models/PublicSignupPage.php @@ -57,7 +57,7 @@ public function setId(?int $id): void /** * Returns Return Url. - * The url to which a customer will be returned after a successful signup (public_signup_pages only) + * The url to which a customer will be returned after a successful signup (public_signup_pages only). */ public function getReturnUrl(): ?string { @@ -69,7 +69,7 @@ public function getReturnUrl(): ?string /** * Sets Return Url. - * The url to which a customer will be returned after a successful signup (public_signup_pages only) + * The url to which a customer will be returned after a successful signup (public_signup_pages only). * * @maps return_url */ @@ -80,7 +80,7 @@ public function setReturnUrl(?string $returnUrl): void /** * Unsets Return Url. - * The url to which a customer will be returned after a successful signup (public_signup_pages only) + * The url to which a customer will be returned after a successful signup (public_signup_pages only). */ public function unsetReturnUrl(): void { @@ -121,7 +121,7 @@ public function unsetReturnParams(): void /** * Returns Url. - * The url where the signup page can be viewed (public_signup_pages only) + * The url where the signup page can be viewed (public_signup_pages only). */ public function getUrl(): ?string { @@ -130,7 +130,7 @@ public function getUrl(): ?string /** * Sets Url. - * The url where the signup page can be viewed (public_signup_pages only) + * The url where the signup page can be viewed (public_signup_pages only). * * @maps url */ diff --git a/src/Models/QScope.php b/src/Models/QScope.php new file mode 100644 index 00000000..eec2be39 --- /dev/null +++ b/src/Models/QScope.php @@ -0,0 +1,57 @@ +intervalUnit = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the QuantityBasedComponent object to a human-readable string representation. * @@ -618,6 +661,7 @@ public function __toString(): string 'publicSignupPageIds' => $this->publicSignupPageIds, 'interval' => $this->interval, 'intervalUnit' => $this->getIntervalUnit(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -718,6 +762,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->intervalUnit)) { $json['interval_unit'] = IntervalUnit::checkValue($this->intervalUnit['value']); } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/ReactivateSubscriptionRequest.php b/src/Models/ReactivateSubscriptionRequest.php index d4daab88..4778d806 100644 --- a/src/Models/ReactivateSubscriptionRequest.php +++ b/src/Models/ReactivateSubscriptionRequest.php @@ -47,7 +47,7 @@ class ReactivateSubscriptionRequest implements \JsonSerializable /** * Returns Calendar Billing. - * These values are only applicable to subscriptions using calendar billing + * These values are only applicable to subscriptions using calendar billing. */ public function getCalendarBilling(): ?ReactivationBilling { @@ -56,7 +56,7 @@ public function getCalendarBilling(): ?ReactivationBilling /** * Sets Calendar Billing. - * These values are only applicable to subscriptions using calendar billing + * These values are only applicable to subscriptions using calendar billing. * * @maps calendar_billing */ diff --git a/src/Models/ReactivationBilling.php b/src/Models/ReactivationBilling.php index a85cf01a..f7d3cc44 100644 --- a/src/Models/ReactivationBilling.php +++ b/src/Models/ReactivationBilling.php @@ -14,7 +14,7 @@ use stdClass; /** - * These values are only applicable to subscriptions using calendar billing + * These values are only applicable to subscriptions using calendar billing. */ class ReactivationBilling implements \JsonSerializable { @@ -26,9 +26,9 @@ class ReactivationBilling implements \JsonSerializable /** * Returns Reactivation Charge. * You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated - * charge for the product price will be attempted for to complete the period 2) `immediate` A full- - * price charge for the product price will be attempted immediately 3) `delayed` A full-price charge - * for the product price will be attempted at the next renewal + * charge for the product price will be attempted to complete the period 2) `immediate` A full-price + * charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the + * product price will be attempted at the next renewal. */ public function getReactivationCharge(): ?string { @@ -38,9 +38,9 @@ public function getReactivationCharge(): ?string /** * Sets Reactivation Charge. * You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated - * charge for the product price will be attempted for to complete the period 2) `immediate` A full- - * price charge for the product price will be attempted immediately 3) `delayed` A full-price charge - * for the product price will be attempted at the next renewal + * charge for the product price will be attempted to complete the period 2) `immediate` A full-price + * charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the + * product price will be attempted at the next renewal. * * @maps reactivation_charge * @factory \AdvancedBillingLib\Models\ReactivationCharge::checkValue diff --git a/src/Models/ReactivationCharge.php b/src/Models/ReactivationCharge.php index 523cbfe0..aa35b609 100644 --- a/src/Models/ReactivationCharge.php +++ b/src/Models/ReactivationCharge.php @@ -16,9 +16,9 @@ /** * You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated - * charge for the product price will be attempted for to complete the period 2) `immediate` A full- - * price charge for the product price will be attempted immediately 3) `delayed` A full-price charge - * for the product price will be attempted at the next renewal + * charge for the product price will be attempted to complete the period 2) `immediate` A full-price + * charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the + * product price will be attempted at the next renewal. */ class ReactivationCharge { diff --git a/src/Models/RefundConsolidatedInvoice.php b/src/Models/RefundConsolidatedInvoice.php index 7ad80628..3eaf3a21 100644 --- a/src/Models/RefundConsolidatedInvoice.php +++ b/src/Models/RefundConsolidatedInvoice.php @@ -14,7 +14,7 @@ use stdClass; /** - * Refund consolidated invoice + * Refund consolidated invoice. */ class RefundConsolidatedInvoice implements \JsonSerializable { diff --git a/src/Models/RefundInvoice.php b/src/Models/RefundInvoice.php index 42fbd419..e9126960 100644 --- a/src/Models/RefundInvoice.php +++ b/src/Models/RefundInvoice.php @@ -167,8 +167,8 @@ public function setApplyCredit(?bool $applyCredit): void /** * Returns Void Invoice. - * If `apply_credit` set to false and refunding full amount, if `void_invoice` set to true, invoice - * will be voided after refund. Defaults to `false`. + * If `apply_credit` is set to false and refunding full amount, if `void_invoice` is set to true, + * invoice will be voided after refund. Defaults to `false`. */ public function getVoidInvoice(): ?bool { @@ -177,8 +177,8 @@ public function getVoidInvoice(): ?bool /** * Sets Void Invoice. - * If `apply_credit` set to false and refunding full amount, if `void_invoice` set to true, invoice - * will be voided after refund. Defaults to `false`. + * If `apply_credit` is set to false and refunding full amount, if `void_invoice` is set to true, + * invoice will be voided after refund. Defaults to `false`. * * @maps void_invoice */ diff --git a/src/Models/RefundInvoiceEventData.php b/src/Models/RefundInvoiceEventData.php index 6200e9de..378dcadc 100644 --- a/src/Models/RefundInvoiceEventData.php +++ b/src/Models/RefundInvoiceEventData.php @@ -111,7 +111,7 @@ public function setApplyCredit(bool $applyCredit): void /** * Returns Consolidation Level. - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. @@ -131,7 +131,7 @@ public function getConsolidationLevel(): ?string /** * Sets Consolidation Level. - * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one + * Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one * of the following values: * * * "none": A normal invoice with no consolidation. diff --git a/src/Models/Register.php b/src/Models/Register.php index f1f97f25..5a6f34a2 100644 --- a/src/Models/Register.php +++ b/src/Models/Register.php @@ -91,7 +91,7 @@ public function setName(?string $name): void /** * Returns Currency Code. - * The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. + * The ISO 4217 currency code (3 character string) representing the currency of an invoice transaction. */ public function getCurrencyCode(): ?string { @@ -100,7 +100,7 @@ public function getCurrencyCode(): ?string /** * Sets Currency Code. - * The ISO 4217 currency code (3 character string) representing the currency of invoice transaction. + * The ISO 4217 currency code (3 character string) representing the currency of an invoice transaction. * * @maps currency_code */ diff --git a/src/Models/RenewalPreviewRequest.php b/src/Models/RenewalPreviewRequest.php index 89d81983..ed0ebf46 100644 --- a/src/Models/RenewalPreviewRequest.php +++ b/src/Models/RenewalPreviewRequest.php @@ -22,7 +22,7 @@ class RenewalPreviewRequest implements \JsonSerializable /** * Returns Components. - * An optional array of component definitions to preview. Providing any component definitions here will + * (Optional) Array of component definitions to preview. Providing any component definitions here will * override the actual components on the subscription (and their quantities), and the billing preview * will contain only these components (in addition to any product base fees). * @@ -35,7 +35,7 @@ public function getComponents(): ?array /** * Sets Components. - * An optional array of component definitions to preview. Providing any component definitions here will + * (Optional) Array of component definitions to preview. Providing any component definitions here will * override the actual components on the subscription (and their quantities), and the billing preview * will contain only these components (in addition to any product base fees). * diff --git a/src/Models/ScheduledRenewalComponentCustomPrice.php b/src/Models/ScheduledRenewalComponentCustomPrice.php index 163d4908..23b06725 100644 --- a/src/Models/ScheduledRenewalComponentCustomPrice.php +++ b/src/Models/ScheduledRenewalComponentCustomPrice.php @@ -65,7 +65,7 @@ public function setTaxIncluded(?bool $taxIncluded): void /** * Returns Pricing Scheme. - * Omit for On/Off components + * Omit for On/Off components. */ public function getPricingScheme(): string { @@ -74,7 +74,7 @@ public function getPricingScheme(): string /** * Sets Pricing Scheme. - * Omit for On/Off components + * Omit for On/Off components. * * @required * @maps pricing_scheme diff --git a/src/Models/ScheduledRenewalItemRequestBodyComponent.php b/src/Models/ScheduledRenewalItemRequestBodyComponent.php index 9128eefb..d9151c61 100644 --- a/src/Models/ScheduledRenewalItemRequestBodyComponent.php +++ b/src/Models/ScheduledRenewalItemRequestBodyComponent.php @@ -111,7 +111,7 @@ public function setPricePointId(?int $pricePointId): void /** * Returns Quantity. - * Optional quantity for the item. + * (Optional) Quantity for the item. */ public function getQuantity(): ?int { @@ -120,7 +120,7 @@ public function getQuantity(): ?int /** * Sets Quantity. - * Optional quantity for the item. + * (Optional) Quantity for the item. * * @maps quantity */ diff --git a/src/Models/ScheduledRenewalItemRequestBodyProduct.php b/src/Models/ScheduledRenewalItemRequestBodyProduct.php index 2abee1a9..9e313f7a 100644 --- a/src/Models/ScheduledRenewalItemRequestBodyProduct.php +++ b/src/Models/ScheduledRenewalItemRequestBodyProduct.php @@ -111,7 +111,7 @@ public function setPricePointId(?int $pricePointId): void /** * Returns Quantity. - * Optional quantity for the item. + * (Optional) Quantity for the item. */ public function getQuantity(): ?int { @@ -120,7 +120,7 @@ public function getQuantity(): ?int /** * Sets Quantity. - * Optional quantity for the item. + * (Optional) Quantity for the item. * * @maps quantity */ diff --git a/src/Models/ScheduledRenewalProductPricePoint.php b/src/Models/ScheduledRenewalProductPricePoint.php index 810e728a..2f6c47a5 100644 --- a/src/Models/ScheduledRenewalProductPricePoint.php +++ b/src/Models/ScheduledRenewalProductPricePoint.php @@ -228,7 +228,7 @@ public function setInitialChargeInCents(?int $initialChargeInCents): void /** * Returns Expiration Interval. - * The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an + * The numerical expiration interval. e.g., 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 @@ -238,7 +238,7 @@ public function getExpirationInterval(): ?int /** * Sets Expiration Interval. - * The numerical expiration interval. i.e. an expiration_interval of ‘30’ coupled with an + * The numerical expiration interval. e.g., 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 diff --git a/src/Models/ServiceCredit1.php b/src/Models/ServiceCredit1.php index 8f2dee53..10f5dc44 100644 --- a/src/Models/ServiceCredit1.php +++ b/src/Models/ServiceCredit1.php @@ -157,7 +157,7 @@ public function setMemo(?string $memo): void /** * Returns Invoice Uid. - * The invoice uid associated with the entry. Only present for debit entries + * The invoice uid associated with the entry. Only present for debit entries. */ public function getInvoiceUid(): ?string { @@ -169,7 +169,7 @@ public function getInvoiceUid(): ?string /** * Sets Invoice Uid. - * The invoice uid associated with the entry. Only present for debit entries + * The invoice uid associated with the entry. Only present for debit entries. * * @maps invoice_uid */ @@ -180,7 +180,7 @@ public function setInvoiceUid(?string $invoiceUid): void /** * Unsets Invoice Uid. - * The invoice uid associated with the entry. Only present for debit entries + * The invoice uid associated with the entry. Only present for debit entries. */ public function unsetInvoiceUid(): void { diff --git a/src/Models/Subscription.php b/src/Models/Subscription.php index 129e87c1..a06bffe5 100644 --- a/src/Models/Subscription.php +++ b/src/Models/Subscription.php @@ -513,9 +513,9 @@ public function setTotalRevenueInCents(?int $totalRevenueInCents): void /** * Returns Product Price in Cents. - * (Added Nov 5 2013) The recurring amount of the product (and version),currently subscribed. NOTE: - * this may differ from the current price of,the product, if you’ve changed the price of the product - * but haven’t,moved this subscription to a newer version. + * (Added Nov 5 2013) The recurring amount of the product (and version), currently subscribed. NOTE: + * this may differ from the current price of the product, if you’ve changed the price of the product + * but haven’t moved this subscription to a newer version. */ public function getProductPriceInCents(): ?int { @@ -524,9 +524,9 @@ public function getProductPriceInCents(): ?int /** * Sets Product Price in Cents. - * (Added Nov 5 2013) The recurring amount of the product (and version),currently subscribed. NOTE: - * this may differ from the current price of,the product, if you’ve changed the price of the product - * but haven’t,moved this subscription to a newer version. + * (Added Nov 5 2013) The recurring amount of the product (and version), currently subscribed. NOTE: + * this may differ from the current price of the product, if you’ve changed the price of the product + * but haven’t moved this subscription to a newer version. * * @maps product_price_in_cents */ @@ -559,7 +559,7 @@ public function setProductVersionNumber(?int $productVersionNumber): void /** * Returns Current Period Ends At. - * Timestamp relating to the end of the current (recurring) period (i.e.,when the next regularly + * Timestamp relating to the end of the current (recurring) period (i.e., when the next regularly * scheduled attempted charge will occur) */ public function getCurrentPeriodEndsAt(): ?\DateTime @@ -572,7 +572,7 @@ public function getCurrentPeriodEndsAt(): ?\DateTime /** * Sets Current Period Ends At. - * Timestamp relating to the end of the current (recurring) period (i.e.,when the next regularly + * Timestamp relating to the end of the current (recurring) period (i.e., when the next regularly * scheduled attempted charge will occur) * * @maps current_period_ends_at @@ -585,7 +585,7 @@ public function setCurrentPeriodEndsAt(?\DateTime $currentPeriodEndsAt): void /** * Unsets Current Period Ends At. - * Timestamp relating to the end of the current (recurring) period (i.e.,when the next regularly + * Timestamp relating to the end of the current (recurring) period (i.e., when the next regularly * scheduled attempted charge will occur) */ public function unsetCurrentPeriodEndsAt(): void @@ -595,11 +595,11 @@ public function unsetCurrentPeriodEndsAt(): void /** * Returns Next Assessment At. - * Timestamp that indicates when capture of payment will be tried or,retried. This value will usually - * track the current_period_ends_at, but,will diverge if a renewal payment fails and must be retried. - * In that,case, the current_period_ends_at will advance to the end of the next,period (time doesn’t - * stop because a payment was missed) but the,next_assessment_at will be scheduled for the auto-retry - * time (i.e. 24,hours in the future, in some cases) + * Timestamp that indicates when capture of payment will be tried or retried. This value will usually + * track the current_period_ends_at, but will diverge if a renewal payment fails and must be retried. + * In that case, the current_period_ends_at will advance to the end of the next period (time doesn’t + * stop because a payment was missed) but the next_assessment_at will be scheduled for the auto-retry + * time (e.g., 24 hours in the future, in some cases). */ public function getNextAssessmentAt(): ?\DateTime { @@ -611,11 +611,11 @@ public function getNextAssessmentAt(): ?\DateTime /** * Sets Next Assessment At. - * Timestamp that indicates when capture of payment will be tried or,retried. This value will usually - * track the current_period_ends_at, but,will diverge if a renewal payment fails and must be retried. - * In that,case, the current_period_ends_at will advance to the end of the next,period (time doesn’t - * stop because a payment was missed) but the,next_assessment_at will be scheduled for the auto-retry - * time (i.e. 24,hours in the future, in some cases) + * Timestamp that indicates when capture of payment will be tried or retried. This value will usually + * track the current_period_ends_at, but will diverge if a renewal payment fails and must be retried. + * In that case, the current_period_ends_at will advance to the end of the next period (time doesn’t + * stop because a payment was missed) but the next_assessment_at will be scheduled for the auto-retry + * time (e.g., 24 hours in the future, in some cases). * * @maps next_assessment_at * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime @@ -627,11 +627,11 @@ public function setNextAssessmentAt(?\DateTime $nextAssessmentAt): void /** * Unsets Next Assessment At. - * Timestamp that indicates when capture of payment will be tried or,retried. This value will usually - * track the current_period_ends_at, but,will diverge if a renewal payment fails and must be retried. - * In that,case, the current_period_ends_at will advance to the end of the next,period (time doesn’t - * stop because a payment was missed) but the,next_assessment_at will be scheduled for the auto-retry - * time (i.e. 24,hours in the future, in some cases) + * Timestamp that indicates when capture of payment will be tried or retried. This value will usually + * track the current_period_ends_at, but will diverge if a renewal payment fails and must be retried. + * In that case, the current_period_ends_at will advance to the end of the next period (time doesn’t + * stop because a payment was missed) but the next_assessment_at will be scheduled for the auto-retry + * time (e.g., 24 hours in the future, in some cases). */ public function unsetNextAssessmentAt(): void { @@ -706,7 +706,7 @@ public function unsetTrialEndedAt(): void /** * Returns Activated At. - * Timestamp for when the subscription began (i.e. when it came out of trial, or when it began in the + * Timestamp for when the subscription began (i.e., when it came out of trial, or when it began in the * case of no trial) */ public function getActivatedAt(): ?\DateTime @@ -719,7 +719,7 @@ public function getActivatedAt(): ?\DateTime /** * Sets Activated At. - * Timestamp for when the subscription began (i.e. when it came out of trial, or when it began in the + * Timestamp for when the subscription began (i.e., when it came out of trial, or when it began in the * case of no trial) * * @maps activated_at @@ -732,7 +732,7 @@ public function setActivatedAt(?\DateTime $activatedAt): void /** * Unsets Activated At. - * Timestamp for when the subscription began (i.e. when it came out of trial, or when it began in the + * Timestamp for when the subscription began (i.e., when it came out of trial, or when it began in the * case of no trial) */ public function unsetActivatedAt(): void @@ -984,7 +984,7 @@ public function unsetCurrentPeriodStartedAt(): void /** * Returns Previous State. * Only valid for webhook payloads The previous state for webhooks that have indicated a change in - * state. For normal API calls, this will always be the same as the state (current state) + * state. For normal API calls, this will always be the same as the state (current state). */ public function getPreviousState(): ?string { @@ -994,7 +994,7 @@ public function getPreviousState(): ?string /** * Sets Previous State. * Only valid for webhook payloads The previous state for webhooks that have indicated a change in - * state. For normal API calls, this will always be the same as the state (current state) + * state. For normal API calls, this will always be the same as the state (current state). * * @maps previous_state * @factory \AdvancedBillingLib\Models\SubscriptionState::checkValue @@ -1026,8 +1026,8 @@ public function setSignupPaymentId(?int $signupPaymentId): void /** * Returns Signup Revenue. - * The revenue, formatted as a string of decimal separated dollars and,cents, from the subscription - * signup ($50.00 would be formatted as,50.00) + * The revenue, formatted as a string of decimal separated dollars and cents, from the subscription + * signup ($50.00 would be formatted as 50.00) */ public function getSignupRevenue(): ?string { @@ -1036,8 +1036,8 @@ public function getSignupRevenue(): ?string /** * Sets Signup Revenue. - * The revenue, formatted as a string of decimal separated dollars and,cents, from the subscription - * signup ($50.00 would be formatted as,50.00) + * The revenue, formatted as a string of decimal separated dollars and cents, from the subscription + * signup ($50.00 would be formatted as 50.00) * * @maps signup_revenue */ @@ -1478,7 +1478,7 @@ public function unsetCouponUsesAllowed(): void /** * Returns Reason Code. - * The churn reason code associated to a cancelled subscription. + * The churn reason code associated to a canceled subscription. */ public function getReasonCode(): ?string { @@ -1490,7 +1490,7 @@ public function getReasonCode(): ?string /** * Sets Reason Code. - * The churn reason code associated to a cancelled subscription. + * The churn reason code associated to a canceled subscription. * * @maps reason_code */ @@ -1501,7 +1501,7 @@ public function setReasonCode(?string $reasonCode): void /** * Unsets Reason Code. - * The churn reason code associated to a cancelled subscription. + * The churn reason code associated to a canceled subscription. */ public function unsetReasonCode(): void { @@ -1807,7 +1807,7 @@ public function unsetStoredCredentialTransactionId(): void /** * Returns Reference. - * The reference value (provided by your app) for the subscription istelf. + * The reference value (provided by your app) for the subscription itself. */ public function getReference(): ?string { @@ -1819,7 +1819,7 @@ public function getReference(): ?string /** * Sets Reference. - * The reference value (provided by your app) for the subscription istelf. + * The reference value (provided by your app) for the subscription itself. * * @maps reference */ @@ -1830,7 +1830,7 @@ public function setReference(?string $reference): void /** * Unsets Reference. - * The reference value (provided by your app) for the subscription istelf. + * The reference value (provided by your app) for the subscription itself. */ public function unsetReference(): void { @@ -1873,7 +1873,7 @@ public function unsetOnHoldAt(): void /** * Returns Prepaid Dunning. * Boolean representing whether the subscription is prepaid and currently in dunning. Only returned for - * Relationship Invoicing sites with the feature enabled + * Relationship Invoicing sites with the feature enabled. */ public function getPrepaidDunning(): ?bool { @@ -1883,7 +1883,7 @@ public function getPrepaidDunning(): ?bool /** * Sets Prepaid Dunning. * Boolean representing whether the subscription is prepaid and currently in dunning. Only returned for - * Relationship Invoicing sites with the feature enabled + * Relationship Invoicing sites with the feature enabled. * * @maps prepaid_dunning */ @@ -1894,8 +1894,8 @@ public function setPrepaidDunning(?bool $prepaidDunning): void /** * Returns Coupons. - * Additional coupon data. To use this data you also have to include the following param in the - * request`include[]=coupons`. + * 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. * * @return SubscriptionIncludedCoupon[]|null @@ -1907,8 +1907,8 @@ public function getCoupons(): ?array /** * Sets Coupons. - * Additional coupon data. To use this data you also have to include the following param in the - * request`include[]=coupons`. + * 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. * * @maps coupons diff --git a/src/Models/SubscriptionComponent.php b/src/Models/SubscriptionComponent.php index f8331ed2..4eb8c4ec 100644 --- a/src/Models/SubscriptionComponent.php +++ b/src/Models/SubscriptionComponent.php @@ -42,7 +42,7 @@ class SubscriptionComponent implements \JsonSerializable private $enabled; /** - * @var int|null + * @var int|string|null */ private $unitBalance; @@ -253,7 +253,7 @@ public function setUnitName(?string $unitName): void /** * Returns Enabled. - * (for on/off components) indicates if the component is enabled for the subscription + * (for on/off components) indicates if the component is enabled for the subscription. */ public function getEnabled(): ?bool { @@ -262,7 +262,7 @@ public function getEnabled(): ?bool /** * Sets Enabled. - * (for on/off components) indicates if the component is enabled for the subscription + * (for on/off components) indicates if the component is enabled for the subscription. * * @maps enabled */ @@ -273,8 +273,10 @@ public function setEnabled(?bool $enabled): void /** * Returns Unit Balance. + * + * @return int|string|null */ - public function getUnitBalance(): ?int + public function getUnitBalance() { return $this->unitBalance; } @@ -283,8 +285,11 @@ public function getUnitBalance(): ?int * Sets Unit Balance. * * @maps unit_balance + * @mapsBy anyOf(oneOf(int,string),null) + * + * @param int|string|null $unitBalance */ - public function setUnitBalance(?int $unitBalance): void + public function setUnitBalance($unitBalance): void { $this->unitBalance = $unitBalance; } @@ -818,7 +823,7 @@ public function setAllowFractionalQuantities(?bool $allowFractionalQuantities): /** * Returns Subscription. - * An optional object, will be returned if provided `include=subscription` query param. + * (Optional) Object that will be returned if the `include=subscription` query param is provided. */ public function getSubscription(): ?SubscriptionComponentSubscription { @@ -827,7 +832,7 @@ public function getSubscription(): ?SubscriptionComponentSubscription /** * Sets Subscription. - * An optional object, will be returned if provided `include=subscription` query param. + * (Optional) Object that will be returned if the `include=subscription` query param is provided. * * @maps subscription */ @@ -878,7 +883,7 @@ public function setDisplayOnHostedPage(?bool $displayOnHostedPage): void /** * Returns Interval. - * The numerical interval. i.e. an interval of '30' coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -889,7 +894,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of '30' coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * @@ -1039,7 +1044,11 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['enabled'] = $this->enabled; } if (isset($this->unitBalance)) { - $json['unit_balance'] = $this->unitBalance; + $json['unit_balance'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->unitBalance, + 'anyOf(oneOf(int,string),null)' + ); } if (isset($this->currency)) { $json['currency'] = $this->currency; diff --git a/src/Models/SubscriptionComponentSubscription.php b/src/Models/SubscriptionComponentSubscription.php index c88401f3..58542923 100644 --- a/src/Models/SubscriptionComponentSubscription.php +++ b/src/Models/SubscriptionComponentSubscription.php @@ -15,7 +15,7 @@ use stdClass; /** - * An optional object, will be returned if provided `include=subscription` query param. + * (Optional) Object that will be returned if the `include=subscription` query param is provided. */ class SubscriptionComponentSubscription implements \JsonSerializable { diff --git a/src/Models/SubscriptionCustomPrice.php b/src/Models/SubscriptionCustomPrice.php index b9fb5462..5fe6ba48 100644 --- a/src/Models/SubscriptionCustomPrice.php +++ b/src/Models/SubscriptionCustomPrice.php @@ -286,7 +286,7 @@ public function setTrialIntervalUnit(?string $trialIntervalUnit): void /** * Returns Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -301,7 +301,7 @@ public function getTrialType(): ?string /** * Sets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. @@ -316,7 +316,7 @@ public function setTrialType(?string $trialType): void /** * Unsets Trial Type. - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. diff --git a/src/Models/SubscriptionGroupBankAccount.php b/src/Models/SubscriptionGroupBankAccount.php index 280fd0f6..f7c7f73e 100644 --- a/src/Models/SubscriptionGroupBankAccount.php +++ b/src/Models/SubscriptionGroupBankAccount.php @@ -142,7 +142,7 @@ public function setBankAccountNumber(?string $bankAccountNumber): void /** * Returns Bank Routing Number. * (Required when creating a subscription with ACH. Optional when creating a subscription with - * GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API + * GoCardless.) The routing number of the bank. It becomes bank_code while passing via GoCardless API. */ public function getBankRoutingNumber(): ?string { @@ -152,7 +152,7 @@ public function getBankRoutingNumber(): ?string /** * Sets Bank Routing Number. * (Required when creating a subscription with ACH. Optional when creating a subscription with - * GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API + * GoCardless.) The routing number of the bank. It becomes bank_code while passing via GoCardless API. * * @maps bank_routing_number */ @@ -164,7 +164,7 @@ public function setBankRoutingNumber(?string $bankRoutingNumber): void /** * Returns Bank Iban. * (Optional when creating a subscription with GoCardless). International Bank Account Number. - * Alternatively, local bank details can be provided + * Alternatively, local bank details can be provided. */ public function getBankIban(): ?string { @@ -174,7 +174,7 @@ public function getBankIban(): ?string /** * Sets Bank Iban. * (Optional when creating a subscription with GoCardless). International Bank Account Number. - * Alternatively, local bank details can be provided + * Alternatively, local bank details can be provided. * * @maps bank_iban */ @@ -186,7 +186,7 @@ public function setBankIban(?string $bankIban): void /** * Returns Bank Branch Code. * (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be - * provided + * provided. */ public function getBankBranchCode(): ?string { @@ -196,7 +196,7 @@ public function getBankBranchCode(): ?string /** * Sets Bank Branch Code. * (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be - * provided + * provided. * * @maps bank_branch_code */ diff --git a/src/Models/SubscriptionGroupSignupItem.php b/src/Models/SubscriptionGroupSignupItem.php index 738a9a1c..25f9c078 100644 --- a/src/Models/SubscriptionGroupSignupItem.php +++ b/src/Models/SubscriptionGroupSignupItem.php @@ -167,7 +167,7 @@ public function setProductPricePointHandle(?string $productPricePointHandle): vo /** * Returns Offer Id. * Use in place of passing product and component information to set up the subscription with an - * existing offer. May be either the Chargify ID of the offer or its handle prefixed with `handle:` + * existing offer. May be either the Chargify ID of the offer or its handle prefixed with `handle:`. */ public function getOfferId(): ?int { @@ -177,7 +177,7 @@ public function getOfferId(): ?int /** * Sets Offer Id. * Use in place of passing product and component information to set up the subscription with an - * existing offer. May be either the Chargify ID of the offer or its handle prefixed with `handle:` + * existing offer. May be either the Chargify ID of the offer or its handle prefixed with `handle:`. * * @maps offer_id */ @@ -188,7 +188,7 @@ public function setOfferId(?int $offerId): void /** * Returns Reference. - * The reference value (provided by your app) for the subscription itelf. + * The reference value (provided by your app) for the subscription itself. */ public function getReference(): ?string { @@ -197,7 +197,7 @@ public function getReference(): ?string /** * Sets Reference. - * The reference value (provided by your app) for the subscription itelf. + * The reference value (provided by your app) for the subscription itself. * * @maps reference */ @@ -322,7 +322,7 @@ public function setCustomPrice(?SubscriptionCustomPrice $customPrice): void /** * Returns Calendar Billing. - * (Optional). Cannot be used when also specifying next_billing_at + * (Optional). Cannot be used when also specifying next_billing_at. */ public function getCalendarBilling(): ?CalendarBilling { @@ -331,7 +331,7 @@ public function getCalendarBilling(): ?CalendarBilling /** * Sets Calendar Billing. - * (Optional). Cannot be used when also specifying next_billing_at + * (Optional). Cannot be used when also specifying next_billing_at. * * @maps calendar_billing */ diff --git a/src/Models/SubscriptionListInclude.php b/src/Models/SubscriptionListInclude.php index c74d1d98..1a07f132 100644 --- a/src/Models/SubscriptionListInclude.php +++ b/src/Models/SubscriptionListInclude.php @@ -18,7 +18,18 @@ class SubscriptionListInclude { public const SELF_SERVICE_PAGE_TOKEN = 'self_service_page_token'; - private const _ALL_VALUES = [self::SELF_SERVICE_PAGE_TOKEN]; + public const CURRENT_ACCOUNT_BALANCE_IN_CENTS = 'current_account_balance_in_cents'; + + public const CURRENT_BILLING_AMOUNT = 'current_billing_amount'; + + public const COUPONS = 'coupons'; + + private const _ALL_VALUES = [ + self::SELF_SERVICE_PAGE_TOKEN, + self::CURRENT_ACCOUNT_BALANCE_IN_CENTS, + self::CURRENT_BILLING_AMOUNT, + self::COUPONS + ]; /** * Ensures that all the given values are present in this Enum. diff --git a/src/Models/SubscriptionProductChange.php b/src/Models/SubscriptionProductChange.php index 8028aa77..a5986541 100644 --- a/src/Models/SubscriptionProductChange.php +++ b/src/Models/SubscriptionProductChange.php @@ -11,8 +11,13 @@ namespace AdvancedBillingLib\Models; use AdvancedBillingLib\ApiHelper; +use AdvancedBillingLib\Utils\DateTimeHelper; use stdClass; +/** + * Event data for both `subscription_product_change` and `subscription_product_change_scheduled`. The + * price point and `effective_at` fields are only populated for scheduled changes. + */ class SubscriptionProductChange implements \JsonSerializable { /** @@ -25,6 +30,21 @@ class SubscriptionProductChange implements \JsonSerializable */ private $newProductId; + /** + * @var array + */ + private $previousProductPricePointId = []; + + /** + * @var array + */ + private $newProductPricePointId = []; + + /** + * @var array + */ + private $effectiveAt = []; + /** * @param int $previousProductId * @param int $newProductId @@ -73,6 +93,100 @@ public function setNewProductId(int $newProductId): void $this->newProductId = $newProductId; } + /** + * Returns Previous Product Price Point Id. + */ + public function getPreviousProductPricePointId(): ?int + { + if (count($this->previousProductPricePointId) == 0) { + return null; + } + return $this->previousProductPricePointId['value']; + } + + /** + * Sets Previous Product Price Point Id. + * + * @maps previous_product_price_point_id + */ + public function setPreviousProductPricePointId(?int $previousProductPricePointId): void + { + $this->previousProductPricePointId['value'] = $previousProductPricePointId; + } + + /** + * Unsets Previous Product Price Point Id. + */ + public function unsetPreviousProductPricePointId(): void + { + $this->previousProductPricePointId = []; + } + + /** + * Returns New Product Price Point Id. + */ + public function getNewProductPricePointId(): ?int + { + if (count($this->newProductPricePointId) == 0) { + return null; + } + return $this->newProductPricePointId['value']; + } + + /** + * Sets New Product Price Point Id. + * + * @maps new_product_price_point_id + */ + public function setNewProductPricePointId(?int $newProductPricePointId): void + { + $this->newProductPricePointId['value'] = $newProductPricePointId; + } + + /** + * Unsets New Product Price Point Id. + */ + public function unsetNewProductPricePointId(): void + { + $this->newProductPricePointId = []; + } + + /** + * Returns Effective At. + * When the scheduled product change takes effect (the subscription's next renewal). Only sent for + * `subscription_product_change_scheduled`. + */ + public function getEffectiveAt(): ?\DateTime + { + if (count($this->effectiveAt) == 0) { + return null; + } + return $this->effectiveAt['value']; + } + + /** + * Sets Effective At. + * When the scheduled product change takes effect (the subscription's next renewal). Only sent for + * `subscription_product_change_scheduled`. + * + * @maps effective_at + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromRfc3339DateTime + */ + public function setEffectiveAt(?\DateTime $effectiveAt): void + { + $this->effectiveAt['value'] = $effectiveAt; + } + + /** + * Unsets Effective At. + * When the scheduled product change takes effect (the subscription's next renewal). Only sent for + * `subscription_product_change_scheduled`. + */ + public function unsetEffectiveAt(): void + { + $this->effectiveAt = []; + } + /** * Converts the SubscriptionProductChange object to a human-readable string representation. * @@ -85,6 +199,9 @@ public function __toString(): string [ 'previousProductId' => $this->previousProductId, 'newProductId' => $this->newProductId, + 'previousProductPricePointId' => $this->getPreviousProductPricePointId(), + 'newProductPricePointId' => $this->getNewProductPricePointId(), + 'effectiveAt' => $this->getEffectiveAt(), 'additionalProperties' => $this->additionalProperties ] ); @@ -130,8 +247,17 @@ public function findAdditionalProperty(string $name) public function jsonSerialize(bool $asArrayWhenEmpty = false) { $json = []; - $json['previous_product_id'] = $this->previousProductId; - $json['new_product_id'] = $this->newProductId; + $json['previous_product_id'] = $this->previousProductId; + $json['new_product_id'] = $this->newProductId; + if (!empty($this->previousProductPricePointId)) { + $json['previous_product_price_point_id'] = $this->previousProductPricePointId['value']; + } + if (!empty($this->newProductPricePointId)) { + $json['new_product_price_point_id'] = $this->newProductPricePointId['value']; + } + if (!empty($this->effectiveAt)) { + $json['effective_at'] = DateTimeHelper::toRfc3339DateTime($this->effectiveAt['value']); + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/SubscriptionStateFilter.php b/src/Models/SubscriptionStateFilter.php index 210c161d..3cab4d23 100644 --- a/src/Models/SubscriptionStateFilter.php +++ b/src/Models/SubscriptionStateFilter.php @@ -27,14 +27,24 @@ class SubscriptionStateFilter public const EXPIRED_CARDS = 'expired_cards'; + public const ENUM_EXPIRED_CARDS_LIVE_SUBSCRIPTIONS = 'expired_cards_(live_subscriptions)'; + + public const ENUM_EXPIRED_CARDS_ALL_SUBSCRIPTIONS = 'expired_cards_(all_subscriptions)'; + public const ON_HOLD = 'on_hold'; + public const AWAITING_SIGNUP = 'awaiting_signup'; + + public const AWAITING_SIGNUP_DATE = 'awaiting_signup_date'; + public const PAST_DUE = 'past_due'; public const PENDING_CANCELLATION = 'pending_cancellation'; public const PENDING_RENEWAL = 'pending_renewal'; + public const PREPAID_DUNNING = 'prepaid_dunning'; + public const SUSPENDED = 'suspended'; public const TRIAL_ENDED = 'trial_ended'; @@ -48,10 +58,15 @@ class SubscriptionStateFilter self::CANCELED, self::EXPIRED, self::EXPIRED_CARDS, + self::ENUM_EXPIRED_CARDS_LIVE_SUBSCRIPTIONS, + self::ENUM_EXPIRED_CARDS_ALL_SUBSCRIPTIONS, self::ON_HOLD, + self::AWAITING_SIGNUP, + self::AWAITING_SIGNUP_DATE, self::PAST_DUE, self::PENDING_CANCELLATION, self::PENDING_RENEWAL, + self::PREPAID_DUNNING, self::SUSPENDED, self::TRIAL_ENDED, self::TRIALING, diff --git a/src/Models/TrialType.php b/src/Models/TrialType.php index 174245f3..753dc7da 100644 --- a/src/Models/TrialType.php +++ b/src/Models/TrialType.php @@ -15,7 +15,7 @@ use stdClass; /** - * Indicates how a trial is handled when the trail period ends and there is no credit card on file. For + * Indicates how a trial is handled when the trial period ends and there is no credit card on file. For * `no_obligation`, the subscription transitions to a Trial Ended state. Maxio will not send any emails * or statements. For `payment_expected`, the subscription transitions to a Past Due state. Maxio will * send normal dunning emails and statements according to your other settings. diff --git a/src/Models/UpdateComponent.php b/src/Models/UpdateComponent.php index 931cdee5..1163f399 100644 --- a/src/Models/UpdateComponent.php +++ b/src/Models/UpdateComponent.php @@ -60,6 +60,11 @@ class UpdateComponent implements \JsonSerializable */ private $upgradeCharge = []; + /** + * @var array + */ + private $unspscCode = []; + /** * Returns Handle. */ @@ -80,7 +85,7 @@ public function setHandle(?string $handle): void /** * Returns Name. - * The name of the Component, suitable for display on statements. i.e. Text Messages. + * The name of the Component, suitable for display on statements. e.g., Text Messages. */ public function getName(): ?string { @@ -89,7 +94,7 @@ public function getName(): ?string /** * Sets Name. - * The name of the Component, suitable for display on statements. i.e. Text Messages. + * The name of the Component, suitable for display on statements. e.g., Text Messages. * * @maps name */ @@ -301,6 +306,44 @@ public function unsetUpgradeCharge(): void $this->upgradeCharge = []; } + /** + * Returns Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function getUnspscCode(): ?string + { + if (count($this->unspscCode) == 0) { + return null; + } + return $this->unspscCode['value']; + } + + /** + * Sets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + * + * @maps unspsc_code + */ + public function setUnspscCode(?string $unspscCode): void + { + $this->unspscCode['value'] = $unspscCode; + } + + /** + * Unsets Unspsc Code. + * (Optional) Custom UNSPSC commodity code for Level 3/CEDP payment data. When set, this value is sent + * as the commodity code on invoice line items for this component instead of the default derived from + * item_category. + */ + public function unsetUnspscCode(): void + { + $this->unspscCode = []; + } + /** * Converts the UpdateComponent object to a human-readable string representation. * @@ -320,6 +363,7 @@ public function __toString(): string 'itemCategory' => $this->getItemCategory(), 'displayOnHostedPage' => $this->displayOnHostedPage, 'upgradeCharge' => $this->getUpgradeCharge(), + 'unspscCode' => $this->getUnspscCode(), 'additionalProperties' => $this->additionalProperties ] ); @@ -392,6 +436,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->upgradeCharge)) { $json['upgrade_charge'] = CreditType::checkValue($this->upgradeCharge['value']); } + if (!empty($this->unspscCode)) { + $json['unspsc_code'] = $this->unspscCode['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/UpdateComponentPricePoint.php b/src/Models/UpdateComponentPricePoint.php index 6250ff4e..66b4235f 100644 --- a/src/Models/UpdateComponentPricePoint.php +++ b/src/Models/UpdateComponentPricePoint.php @@ -158,7 +158,7 @@ public function setTaxIncluded(?bool $taxIncluded): void /** * Returns Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. */ @@ -169,7 +169,7 @@ public function getInterval(): ?int /** * Sets Interval. - * The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean + * The numerical interval. e.g., 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. * diff --git a/src/Models/UpdateCustomer.php b/src/Models/UpdateCustomer.php index 6bf93475..2ec28abc 100644 --- a/src/Models/UpdateCustomer.php +++ b/src/Models/UpdateCustomer.php @@ -95,6 +95,11 @@ class UpdateCustomer implements \JsonSerializable */ private $taxExempt; + /** + * @var bool|null + */ + private $surcharging; + /** * @var string|null */ @@ -115,6 +120,11 @@ class UpdateCustomer implements \JsonSerializable */ private $salesforceId = []; + /** + * @var array + */ + private $brandingThemeId = []; + /** * Returns First Name. */ @@ -405,6 +415,28 @@ public function setTaxExempt(?bool $taxExempt): void $this->taxExempt = $taxExempt; } + /** + * Returns Surcharging. + * Whether surcharging is enabled for the customer. Only applied on sites where surcharging control is + * enabled. + */ + public function getSurcharging(): ?bool + { + return $this->surcharging; + } + + /** + * Sets Surcharging. + * Whether surcharging is enabled for the customer. Only applied on sites where surcharging control is + * enabled. + * + * @maps surcharging + */ + public function setSurcharging(?bool $surcharging): void + { + $this->surcharging = $surcharging; + } + /** * Returns Tax Exempt Reason. */ @@ -454,7 +486,7 @@ public function unsetParentId(): void /** * Returns Verified. - * Is the customer verified to use ACH as a payment method. Available only on Authorize.Net gateway + * Is the customer verified to use ACH as a payment method. Available only on the Authorize.Net gateway. */ public function getVerified(): ?bool { @@ -466,7 +498,7 @@ public function getVerified(): ?bool /** * Sets Verified. - * Is the customer verified to use ACH as a payment method. Available only on Authorize.Net gateway + * Is the customer verified to use ACH as a payment method. Available only on the Authorize.Net gateway. * * @maps verified */ @@ -477,7 +509,7 @@ public function setVerified(?bool $verified): void /** * Unsets Verified. - * Is the customer verified to use ACH as a payment method. Available only on Authorize.Net gateway + * Is the customer verified to use ACH as a payment method. Available only on the Authorize.Net gateway. */ public function unsetVerified(): void { @@ -516,6 +548,44 @@ public function unsetSalesforceId(): void $this->salesforceId = []; } + /** + * Returns Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + */ + public function getBrandingThemeId(): ?int + { + if (count($this->brandingThemeId) == 0) { + return null; + } + return $this->brandingThemeId['value']; + } + + /** + * Sets Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + * + * @maps branding_theme_id + */ + public function setBrandingThemeId(?int $brandingThemeId): void + { + $this->brandingThemeId['value'] = $brandingThemeId; + } + + /** + * Unsets Branding Theme Id. + * The ID of the Branding Theme assigned to this customer as the customer's default Branding Theme. + * This customer-level Branding Theme is used when a subscription does not have its own subscription- + * level Branding Theme. Available only when Branding Themes are enabled for the site. + */ + public function unsetBrandingThemeId(): void + { + $this->brandingThemeId = []; + } + /** * Converts the UpdateCustomer object to a human-readable string representation. * @@ -542,10 +612,12 @@ public function __toString(): string 'locale' => $this->locale, 'vatNumber' => $this->vatNumber, 'taxExempt' => $this->taxExempt, + 'surcharging' => $this->surcharging, 'taxExemptReason' => $this->taxExemptReason, 'parentId' => $this->getParentId(), 'verified' => $this->getVerified(), 'salesforceId' => $this->getSalesforceId(), + 'brandingThemeId' => $this->getBrandingThemeId(), 'additionalProperties' => $this->additionalProperties ] ); @@ -639,6 +711,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->taxExempt)) { $json['tax_exempt'] = $this->taxExempt; } + if (isset($this->surcharging)) { + $json['surcharging'] = $this->surcharging; + } if (isset($this->taxExemptReason)) { $json['tax_exempt_reason'] = $this->taxExemptReason; } @@ -651,6 +726,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (!empty($this->salesforceId)) { $json['salesforce_id'] = $this->salesforceId['value']; } + if (!empty($this->brandingThemeId)) { + $json['branding_theme_id'] = $this->brandingThemeId['value']; + } $json = array_merge($json, $this->additionalProperties); return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; diff --git a/src/Models/UpdateInvoice.php b/src/Models/UpdateInvoice.php new file mode 100644 index 00000000..a0b61d51 --- /dev/null +++ b/src/Models/UpdateInvoice.php @@ -0,0 +1,363 @@ +lineItems; + } + + /** + * Sets Line Items. + * Line item changes to apply. Line items without a `uid` are added, line items with a `uid` are + * updated, and line items with a `uid` and `_destroy` set to `true` are removed. Existing line items + * not referenced in the array remain unchanged. + * + * @maps line_items + * + * @param UpdateInvoiceItem[]|null $lineItems + */ + public function setLineItems(?array $lineItems): void + { + $this->lineItems = $lineItems; + } + + /** + * Returns Issue Date. + * New issue date for the invoice (format YYYY-MM-DD). This date is interpreted and validated in your + * site's time zone. It must be today or a date in the past — future dates are not accepted. The due + * date is recalculated from the issue date and net terms. + */ + public function getIssueDate(): ?\DateTime + { + return $this->issueDate; + } + + /** + * Sets Issue Date. + * New issue date for the invoice (format YYYY-MM-DD). This date is interpreted and validated in your + * site's time zone. It must be today or a date in the past — future dates are not accepted. The due + * date is recalculated from the issue date and net terms. + * + * @maps issue_date + * @factory \AdvancedBillingLib\Utils\DateTimeHelper::fromSimpleDate + */ + public function setIssueDate(?\DateTime $issueDate): void + { + $this->issueDate = $issueDate; + } + + /** + * Returns Net Terms. + * Number of days after the issue date on which the invoice is due. The due date is recalculated when + * net terms or the issue date change. + */ + public function getNetTerms(): ?int + { + return $this->netTerms; + } + + /** + * Sets Net Terms. + * Number of days after the issue date on which the invoice is due. The due date is recalculated when + * net terms or the issue date change. + * + * @maps net_terms + */ + public function setNetTerms(?int $netTerms): void + { + $this->netTerms = $netTerms; + } + + /** + * Returns Payment Instructions. + * Custom payment instructions displayed on the invoice. + */ + public function getPaymentInstructions(): ?string + { + return $this->paymentInstructions; + } + + /** + * Sets Payment Instructions. + * Custom payment instructions displayed on the invoice. + * + * @maps payment_instructions + */ + public function setPaymentInstructions(?string $paymentInstructions): void + { + $this->paymentInstructions = $paymentInstructions; + } + + /** + * Returns Memo. + * A custom memo displayed on the invoice. + */ + public function getMemo(): ?string + { + return $this->memo; + } + + /** + * Sets Memo. + * A custom memo displayed on the invoice. + * + * @maps memo + */ + public function setMemo(?string $memo): void + { + $this->memo = $memo; + } + + /** + * Returns Seller Address. + * Replaces the seller address on the invoice + */ + public function getSellerAddress(): ?CreateInvoiceAddress + { + return $this->sellerAddress; + } + + /** + * Sets Seller Address. + * Replaces the seller address on the invoice + * + * @maps seller_address + */ + public function setSellerAddress(?CreateInvoiceAddress $sellerAddress): void + { + $this->sellerAddress = $sellerAddress; + } + + /** + * Returns Billing Address. + * Replaces the billing address on the invoice + */ + public function getBillingAddress(): ?CreateInvoiceAddress + { + return $this->billingAddress; + } + + /** + * Sets Billing Address. + * Replaces the billing address on the invoice + * + * @maps billing_address + */ + public function setBillingAddress(?CreateInvoiceAddress $billingAddress): void + { + $this->billingAddress = $billingAddress; + } + + /** + * Returns Shipping Address. + * Replaces the shipping address on the invoice + */ + public function getShippingAddress(): ?CreateInvoiceAddress + { + return $this->shippingAddress; + } + + /** + * Sets Shipping Address. + * Replaces the shipping address on the invoice + * + * @maps shipping_address + */ + public function setShippingAddress(?CreateInvoiceAddress $shippingAddress): void + { + $this->shippingAddress = $shippingAddress; + } + + /** + * Returns Coupons. + * When present, replaces all discounts currently applied to the invoice. Send an empty array to remove + * all discounts. + * + * @return CreateInvoiceCoupon[]|null + */ + public function getCoupons(): ?array + { + return $this->coupons; + } + + /** + * Sets Coupons. + * When present, replaces all discounts currently applied to the invoice. Send an empty array to remove + * all discounts. + * + * @maps coupons + * + * @param CreateInvoiceCoupon[]|null $coupons + */ + public function setCoupons(?array $coupons): void + { + $this->coupons = $coupons; + } + + /** + * Converts the UpdateInvoice object to a human-readable string representation. + * + * @return string The string representation of the UpdateInvoice object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'UpdateInvoice', + [ + 'lineItems' => $this->lineItems, + 'issueDate' => $this->issueDate, + 'netTerms' => $this->netTerms, + 'paymentInstructions' => $this->paymentInstructions, + 'memo' => $this->memo, + 'sellerAddress' => $this->sellerAddress, + 'billingAddress' => $this->billingAddress, + 'shippingAddress' => $this->shippingAddress, + 'coupons' => $this->coupons, + '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->lineItems)) { + $json['line_items'] = $this->lineItems; + } + if (isset($this->issueDate)) { + $json['issue_date'] = DateTimeHelper::toSimpleDate($this->issueDate); + } + if (isset($this->netTerms)) { + $json['net_terms'] = $this->netTerms; + } + if (isset($this->paymentInstructions)) { + $json['payment_instructions'] = $this->paymentInstructions; + } + if (isset($this->memo)) { + $json['memo'] = $this->memo; + } + if (isset($this->sellerAddress)) { + $json['seller_address'] = $this->sellerAddress; + } + if (isset($this->billingAddress)) { + $json['billing_address'] = $this->billingAddress; + } + if (isset($this->shippingAddress)) { + $json['shipping_address'] = $this->shippingAddress; + } + if (isset($this->coupons)) { + $json['coupons'] = $this->coupons; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpdateInvoiceItem.php b/src/Models/UpdateInvoiceItem.php new file mode 100644 index 00000000..57281476 --- /dev/null +++ b/src/Models/UpdateInvoiceItem.php @@ -0,0 +1,547 @@ +title; + } + + /** + * Sets Title. + * + * @maps title + */ + public function setTitle(?string $title): void + { + $this->title = $title; + } + + /** + * Returns Quantity. + * The quantity can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit a + * value with more than 8 decimal places, we will round it down to the 8th decimal place. + * + * @return float|string|null + */ + public function getQuantity() + { + return $this->quantity; + } + + /** + * Sets Quantity. + * The quantity can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit a + * value with more than 8 decimal places, we will round it down to the 8th decimal place. + * + * @maps quantity + * @mapsBy anyOf(oneOf(float,string),null) + * + * @param float|string|null $quantity + */ + public function setQuantity($quantity): void + { + $this->quantity = $quantity; + } + + /** + * Returns Unit Price. + * The unit_price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit + * a value with more than 8 decimal places, we will round it down to the 8th decimal place. + * + * @return float|string|null + */ + public function getUnitPrice() + { + return $this->unitPrice; + } + + /** + * Sets Unit Price. + * The unit_price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065. If you submit + * a value with more than 8 decimal places, we will round it down to the 8th decimal place. + * + * @maps unit_price + * @mapsBy anyOf(oneOf(float,string),null) + * + * @param float|string|null $unitPrice + */ + public function setUnitPrice($unitPrice): void + { + $this->unitPrice = $unitPrice; + } + + /** + * Returns Taxable. + * Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. If + * using AvaTax, a tax_code parameter must also be sent. + */ + public function getTaxable(): ?bool + { + return $this->taxable; + } + + /** + * Sets Taxable. + * Set to true to automatically calculate taxes. Site must be configured to use and calculate taxes. If + * using AvaTax, a tax_code parameter must also be sent. + * + * @maps taxable + */ + public function setTaxable(?bool $taxable): void + { + $this->taxable = $taxable; + } + + /** + * Returns Tax Code. + * A string representing the tax code related to the product type. This is especially important when + * using AvaTax to tax based on locale. This attribute has a max length of 25 characters. + */ + public function getTaxCode(): ?string + { + return $this->taxCode; + } + + /** + * Sets Tax Code. + * A string representing the tax code related to the product type. This is especially important when + * using AvaTax to tax based on locale. This attribute has a max length of 25 characters. + * + * @maps tax_code + */ + public function setTaxCode(?string $taxCode): void + { + $this->taxCode = $taxCode; + } + + /** + * Returns Period Range Start. + * YYYY-MM-DD + */ + public function getPeriodRangeStart(): ?string + { + return $this->periodRangeStart; + } + + /** + * Sets Period Range Start. + * YYYY-MM-DD + * + * @maps period_range_start + */ + public function setPeriodRangeStart(?string $periodRangeStart): void + { + $this->periodRangeStart = $periodRangeStart; + } + + /** + * Returns Period Range End. + * YYYY-MM-DD + */ + public function getPeriodRangeEnd(): ?string + { + return $this->periodRangeEnd; + } + + /** + * Sets Period Range End. + * YYYY-MM-DD + * + * @maps period_range_end + */ + public function setPeriodRangeEnd(?string $periodRangeEnd): void + { + $this->periodRangeEnd = $periodRangeEnd; + } + + /** + * Returns Product Id. + * Product handle or product id. + * + * @return string|int|null + */ + public function getProductId() + { + return $this->productId; + } + + /** + * Sets Product Id. + * Product handle or product id. + * + * @maps product_id + * @mapsBy anyOf(oneOf(string,int),null) + * + * @param string|int|null $productId + */ + public function setProductId($productId): void + { + $this->productId = $productId; + } + + /** + * Returns Component Id. + * Component handle or component id. + * + * @return string|int|null + */ + public function getComponentId() + { + return $this->componentId; + } + + /** + * Sets Component Id. + * Component handle or component id. + * + * @maps component_id + * @mapsBy anyOf(oneOf(string,int),null) + * + * @param string|int|null $componentId + */ + public function setComponentId($componentId): void + { + $this->componentId = $componentId; + } + + /** + * Returns Price Point Id. + * Price point handle or id. For component. + * + * @return string|int|null + */ + public function getPricePointId() + { + return $this->pricePointId; + } + + /** + * Sets Price Point Id. + * Price point handle or id. For component. + * + * @maps price_point_id + * @mapsBy anyOf(oneOf(string,int),null) + * + * @param string|int|null $pricePointId + */ + public function setPricePointId($pricePointId): void + { + $this->pricePointId = $pricePointId; + } + + /** + * Returns Product Price Point Id. + * + * @return string|int|null + */ + public function getProductPricePointId() + { + return $this->productPricePointId; + } + + /** + * Sets Product Price Point Id. + * + * @maps product_price_point_id + * @mapsBy anyOf(oneOf(string,int),null) + * + * @param string|int|null $productPricePointId + */ + public function setProductPricePointId($productPricePointId): void + { + $this->productPricePointId = $productPricePointId; + } + + /** + * Returns Description. + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * Sets Description. + * + * @maps description + */ + public function setDescription(?string $description): void + { + $this->description = $description; + } + + /** + * Returns Uid. + * Unique identifier of an existing line item on the invoice. When provided, the matching line item is + * updated with the submitted attributes. When omitted, a new line item is added to the invoice. + */ + public function getUid(): ?string + { + return $this->uid; + } + + /** + * Sets Uid. + * Unique identifier of an existing line item on the invoice. When provided, the matching line item is + * updated with the submitted attributes. When omitted, a new line item is added to the invoice. + * + * @maps uid + */ + public function setUid(?string $uid): void + { + $this->uid = $uid; + } + + /** + * Returns Destroy. + * Set to `true` together with `uid` to remove the matching line item from the invoice. Line items not + * referenced in the request remain unchanged. + */ + public function getDestroy(): ?bool + { + return $this->destroy; + } + + /** + * Sets Destroy. + * Set to `true` together with `uid` to remove the matching line item from the invoice. Line items not + * referenced in the request remain unchanged. + * + * @maps _destroy + */ + public function setDestroy(?bool $destroy): void + { + $this->destroy = $destroy; + } + + /** + * Converts the UpdateInvoiceItem object to a human-readable string representation. + * + * @return string The string representation of the UpdateInvoiceItem object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'UpdateInvoiceItem', + [ + 'title' => $this->title, + 'quantity' => $this->quantity, + 'unitPrice' => $this->unitPrice, + 'taxable' => $this->taxable, + 'taxCode' => $this->taxCode, + 'periodRangeStart' => $this->periodRangeStart, + 'periodRangeEnd' => $this->periodRangeEnd, + 'productId' => $this->productId, + 'componentId' => $this->componentId, + 'pricePointId' => $this->pricePointId, + 'productPricePointId' => $this->productPricePointId, + 'description' => $this->description, + 'uid' => $this->uid, + 'destroy' => $this->destroy, + '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->title)) { + $json['title'] = $this->title; + } + if (isset($this->quantity)) { + $json['quantity'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->quantity, + 'anyOf(oneOf(float,string),null)' + ); + } + if (isset($this->unitPrice)) { + $json['unit_price'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->unitPrice, + 'anyOf(oneOf(float,string),null)' + ); + } + if (isset($this->taxable)) { + $json['taxable'] = $this->taxable; + } + if (isset($this->taxCode)) { + $json['tax_code'] = $this->taxCode; + } + if (isset($this->periodRangeStart)) { + $json['period_range_start'] = $this->periodRangeStart; + } + if (isset($this->periodRangeEnd)) { + $json['period_range_end'] = $this->periodRangeEnd; + } + if (isset($this->productId)) { + $json['product_id'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->productId, + 'anyOf(oneOf(string,int),null)' + ); + } + if (isset($this->componentId)) { + $json['component_id'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->componentId, + 'anyOf(oneOf(string,int),null)' + ); + } + if (isset($this->pricePointId)) { + $json['price_point_id'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->pricePointId, + 'anyOf(oneOf(string,int),null)' + ); + } + if (isset($this->productPricePointId)) { + $json['product_price_point_id'] = + ApiHelper::getJsonHelper()->verifyTypes( + $this->productPricePointId, + 'anyOf(oneOf(string,int),null)' + ); + } + if (isset($this->description)) { + $json['description'] = $this->description; + } + if (isset($this->uid)) { + $json['uid'] = $this->uid; + } + if (isset($this->destroy)) { + $json['_destroy'] = $this->destroy; + } + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpdateInvoiceRequest.php b/src/Models/UpdateInvoiceRequest.php new file mode 100644 index 00000000..d153dbeb --- /dev/null +++ b/src/Models/UpdateInvoiceRequest.php @@ -0,0 +1,113 @@ +invoice = $invoice; + } + + /** + * Returns Invoice. + * Attributes of a draft ad hoc invoice which can be updated. Only the submitted attributes are changed. + */ + public function getInvoice(): UpdateInvoice + { + return $this->invoice; + } + + /** + * Sets Invoice. + * Attributes of a draft ad hoc invoice which can be updated. Only the submitted attributes are changed. + * + * @required + * @maps invoice + */ + public function setInvoice(UpdateInvoice $invoice): void + { + $this->invoice = $invoice; + } + + /** + * Converts the UpdateInvoiceRequest object to a human-readable string representation. + * + * @return string The string representation of the UpdateInvoiceRequest object. + */ + public function __toString(): string + { + return ApiHelper::stringify( + 'UpdateInvoiceRequest', + ['invoice' => $this->invoice, '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['invoice'] = $this->invoice; + $json = array_merge($json, $this->additionalProperties); + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/UpdateMetafield.php b/src/Models/UpdateMetafield.php index 189c1c97..698035d7 100644 --- a/src/Models/UpdateMetafield.php +++ b/src/Models/UpdateMetafield.php @@ -101,7 +101,7 @@ public function setScope(?MetafieldScope $scope): void /** * Returns Input Type. * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. */ public function getInputType(): ?string { @@ -111,7 +111,7 @@ public function getInputType(): ?string /** * Sets Input Type. * Indicates the type of metafield. A text metafield allows any string value. Dropdown and radio - * metafields have a set of values that can be selected. Defaults to 'text'. + * metafields have a set of values that can be selected. Defaults to 'text'. * * @maps input_type * @factory \AdvancedBillingLib\Models\MetafieldInput::checkValue diff --git a/src/Models/UpdatePaymentProfile.php b/src/Models/UpdatePaymentProfile.php index bb431602..194cac9a 100644 --- a/src/Models/UpdatePaymentProfile.php +++ b/src/Models/UpdatePaymentProfile.php @@ -164,7 +164,7 @@ public function setCardType(?string $cardType): void /** * Returns Expiration Month. * (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit - * card expiration month, as an integer or string, i.e. 5 + * card expiration month, as an integer or string, e.g., 5 */ public function getExpirationMonth(): ?string { @@ -174,7 +174,7 @@ public function getExpirationMonth(): ?string /** * Sets Expiration Month. * (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit - * card expiration month, as an integer or string, i.e. 5 + * card expiration month, as an integer or string, e.g., 5 * * @maps expiration_month */ @@ -185,8 +185,8 @@ public function setExpirationMonth(?string $expirationMonth): void /** * Returns Expiration Year. - * (Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card - * expiration year, as an integer or string, i.e. 2012 + * (Optional when performing an Import via vault_token, required otherwise) The 4-digit credit card + * expiration year, as an integer or string, e.g., 2012 */ public function getExpirationYear(): ?string { @@ -195,8 +195,8 @@ public function getExpirationYear(): ?string /** * Sets Expiration Year. - * (Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card - * expiration year, as an integer or string, i.e. 2012 + * (Optional when performing an Import via vault_token, required otherwise) The 4-digit credit card + * expiration year, as an integer or string, e.g., 2012 * * @maps expiration_year */ @@ -228,7 +228,7 @@ public function setCurrentVault(?string $currentVault): void /** * Returns Billing Address. - * The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely + * The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely * passed through to the payment gateway. */ public function getBillingAddress(): ?string @@ -238,7 +238,7 @@ public function getBillingAddress(): ?string /** * Sets Billing Address. - * The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely + * The credit card or bank account billing street address (e.g., 123 Main St.). This value is merely * passed through to the payment gateway. * * @maps billing_address @@ -250,7 +250,7 @@ public function setBillingAddress(?string $billingAddress): void /** * Returns Billing City. - * The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed + * The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed * through to the payment gateway. */ public function getBillingCity(): ?string @@ -260,7 +260,7 @@ public function getBillingCity(): ?string /** * Sets Billing City. - * The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed + * The credit card or bank account billing address city (e.g., “Boston”). This value is merely passed * through to the payment gateway. * * @maps billing_city @@ -272,9 +272,9 @@ public function setBillingCity(?string $billingCity): void /** * Returns Billing State. - * The credit card or bank account billing address state (i.e. MA). This value is merely passed through - * to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166- - * 1#Current_codes) in order to be valid for tax locale purposes. + * The credit card or bank account billing address state (e.g., MA). This value is merely passed + * through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia. + * org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. */ public function getBillingState(): ?string { @@ -283,9 +283,9 @@ public function getBillingState(): ?string /** * Sets Billing State. - * The credit card or bank account billing address state (i.e. MA). This value is merely passed through - * to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166- - * 1#Current_codes) in order to be valid for tax locale purposes. + * The credit card or bank account billing address state (e.g., MA). This value is merely passed + * through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia. + * org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes. * * @maps billing_state */ @@ -296,7 +296,7 @@ public function setBillingState(?string $billingState): void /** * Returns Billing Zip. - * The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed + * The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed * through to the payment gateway. */ public function getBillingZip(): ?string @@ -306,7 +306,7 @@ public function getBillingZip(): ?string /** * Sets Billing Zip. - * The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed + * The credit card or bank account billing address zip code (e.g., 12345). This value is merely passed * through to the payment gateway. * * @maps billing_zip @@ -319,7 +319,7 @@ public function setBillingZip(?string $billingZip): void /** * Returns Billing Country. * The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en. - * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to + * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to * the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s * documentation. If creating an ACH subscription, only US is supported at this time. */ @@ -331,7 +331,7 @@ public function getBillingCountry(): ?string /** * Sets Billing Country. * The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en. - * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to + * wikipedia.org/wiki/ISO_3166-1_alpha-2) format (e.g., “US”). This value is merely passed through to * the payment gateway. Some gateways require country codes in a specific format. Check your gateway’s * documentation. If creating an ACH subscription, only US is supported at this time. * @@ -344,7 +344,7 @@ public function setBillingCountry(?string $billingCountry): void /** * Returns Billing Address 2. - * Second line of the customer’s billing address i.e. Apt. 100 + * Second line of the customer’s billing address, e.g., Apt. 100 */ public function getBillingAddress2(): ?string { @@ -356,7 +356,7 @@ public function getBillingAddress2(): ?string /** * Sets Billing Address 2. - * Second line of the customer’s billing address i.e. Apt. 100 + * Second line of the customer’s billing address, e.g., Apt. 100 * * @maps billing_address_2 */ @@ -367,7 +367,7 @@ public function setBillingAddress2(?string $billingAddress2): void /** * Unsets Billing Address 2. - * Second line of the customer’s billing address i.e. Apt. 100 + * Second line of the customer’s billing address, e.g., Apt. 100 */ public function unsetBillingAddress2(): void { diff --git a/src/Models/UpdatePrice.php b/src/Models/UpdatePrice.php index 981f5439..1a5636b9 100644 --- a/src/Models/UpdatePrice.php +++ b/src/Models/UpdatePrice.php @@ -83,7 +83,7 @@ public function setEndingQuantity($endingQuantity): void /** * Returns Unit Price. - * The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @return float|string|null */ @@ -94,7 +94,7 @@ public function getUnitPrice() /** * Sets Unit Price. - * The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 + * The price can contain up to 8 decimal places. e.g., 1.00 or 0.0012 or 0.00000065 * * @maps unit_price * @mapsBy anyOf(oneOf(float,string),null) diff --git a/src/Models/UpdateSubscription.php b/src/Models/UpdateSubscription.php index a7cabbe7..8a82772a 100644 --- a/src/Models/UpdateSubscription.php +++ b/src/Models/UpdateSubscription.php @@ -66,6 +66,11 @@ class UpdateSubscription implements \JsonSerializable */ private $nextBillingAt; + /** + * @var array + */ + private $brandingThemeId = []; + /** * @var \DateTime|null */ @@ -146,7 +151,7 @@ public function setCreditCardAttributes(?CreditCardAttributes $creditCardAttribu /** * Returns Product Handle. - * Set to the handle of a different product to change the subscription's product + * Set to the handle of a different product to change the subscription's product. */ public function getProductHandle(): ?string { @@ -155,7 +160,7 @@ public function getProductHandle(): ?string /** * Sets Product Handle. - * Set to the handle of a different product to change the subscription's product + * Set to the handle of a different product to change the subscription's product. * * @maps product_handle */ @@ -166,7 +171,7 @@ public function setProductHandle(?string $productHandle): void /** * Returns Product Id. - * Set to the id of a different product to change the subscription's product + * Set to the id of a different product to change the subscription's product. */ public function getProductId(): ?int { @@ -175,7 +180,7 @@ public function getProductId(): ?int /** * Sets Product Id. - * Set to the id of a different product to change the subscription's product + * Set to the id of a different product to change the subscription's product. * * @maps product_id */ @@ -269,7 +274,7 @@ public function setSnapDay($snapDay): void * Returns Initial Billing At. * (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup * Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. - * It can be canceled, allocated to, or have its billing date changed. etc. When the + * It can be canceled, allocated to, or have its billing date changed, etc. When the * `initial_billing_at` date hits, the subscription will transition to the expected state. If the * product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees * will be respected either before or after the trial, as configured on the price point. If the payment @@ -287,7 +292,7 @@ public function getInitialBillingAt(): ?\DateTime * Sets Initial Billing At. * (Optional) Set this attribute to a future date/time to update a subscription in the Awaiting Signup * Date state, to Awaiting Signup. In the Awaiting Signup state, a subscription behaves like any other. - * It can be canceled, allocated to, or have its billing date changed. etc. When the + * It can be canceled, allocated to, or have its billing date changed, etc. When the * `initial_billing_at` date hits, the subscription will transition to the expected state. If the * product has a trial, the subscription will enter a trial, otherwise it will go active. Setup fees * will be respected either before or after the trial, as configured on the price point. If the payment @@ -355,6 +360,50 @@ public function setNextBillingAt(?\DateTime $nextBillingAt): void $this->nextBillingAt = $nextBillingAt; } + /** + * Returns Branding Theme Id. + * The ID of the Branding Theme to assign to this subscription. When set, this subscription-level + * Branding Theme is used instead of the customer's default Branding Theme for subscription-related + * documents and communications that use subscription theming. Pass null or an empty value to clear the + * subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not + * returned in the response. + */ + public function getBrandingThemeId(): ?int + { + if (count($this->brandingThemeId) == 0) { + return null; + } + return $this->brandingThemeId['value']; + } + + /** + * Sets Branding Theme Id. + * The ID of the Branding Theme to assign to this subscription. When set, this subscription-level + * Branding Theme is used instead of the customer's default Branding Theme for subscription-related + * documents and communications that use subscription theming. Pass null or an empty value to clear the + * subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not + * returned in the response. + * + * @maps branding_theme_id + */ + public function setBrandingThemeId(?int $brandingThemeId): void + { + $this->brandingThemeId['value'] = $brandingThemeId; + } + + /** + * Unsets Branding Theme Id. + * The ID of the Branding Theme to assign to this subscription. When set, this subscription-level + * Branding Theme is used instead of the customer's default Branding Theme for subscription-related + * documents and communications that use subscription theming. Pass null or an empty value to clear the + * subscription-level Branding Theme. Available only when Branding Themes are enabled for the site. Not + * returned in the response. + */ + public function unsetBrandingThemeId(): void + { + $this->brandingThemeId = []; + } + /** * Returns Expires At. * Timestamp giving the expiration date of this subscription (if any). You may manually change the @@ -637,6 +686,7 @@ public function __toString(): string 'initialBillingAt' => $this->initialBillingAt, 'deferSignup' => $this->deferSignup, 'nextBillingAt' => $this->nextBillingAt, + 'brandingThemeId' => $this->getBrandingThemeId(), 'expiresAt' => $this->expiresAt, 'paymentCollectionMethod' => $this->paymentCollectionMethod, 'receivesInvoiceEmails' => $this->receivesInvoiceEmails, @@ -728,6 +778,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->nextBillingAt)) { $json['next_billing_at'] = DateTimeHelper::toRfc3339DateTime($this->nextBillingAt); } + if (!empty($this->brandingThemeId)) { + $json['branding_theme_id'] = $this->brandingThemeId['value']; + } if (isset($this->expiresAt)) { $json['expires_at'] = DateTimeHelper::toRfc3339DateTime($this->expiresAt); } diff --git a/src/Models/Webhook.php b/src/Models/Webhook.php index b985452c..60391606 100644 --- a/src/Models/Webhook.php +++ b/src/Models/Webhook.php @@ -98,7 +98,7 @@ public function setEvent(?string $event): void /** * Returns Id. - * The unique identifier for the webhooks (unique across all of Chargify). This is not changed on a + * The unique identifier for the webhook (unique across all of Chargify). This is not changed on a * retry/replay of the same webhook, so it may be used to avoid duplicate action for the same event. */ public function getId(): ?int @@ -108,7 +108,7 @@ public function getId(): ?int /** * Sets Id. - * The unique identifier for the webhooks (unique across all of Chargify). This is not changed on a + * The unique identifier for the webhook (unique across all of Chargify). This is not changed on a * retry/replay of the same webhook, so it may be used to avoid duplicate action for the same event. * * @maps id @@ -263,9 +263,9 @@ public function setLastSentUrl(?string $lastSentUrl): void /** * Returns Successful. - * A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most + * “A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most * recent attempt. (Acceptance is defined by receiving a “200 OK” HTTP response within a reasonable - * timeframe, i.e. 15 seconds) + * timeframe, e.g., 15 seconds.)” */ public function getSuccessful(): ?bool { @@ -274,9 +274,9 @@ public function getSuccessful(): ?bool /** * Sets Successful. - * A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most + * “A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most * recent attempt. (Acceptance is defined by receiving a “200 OK” HTTP response within a reasonable - * timeframe, i.e. 15 seconds) + * timeframe, e.g., 15 seconds.)” * * @maps successful */ diff --git a/src/Models/WebhookSubscription.php b/src/Models/WebhookSubscription.php index a43faa3d..f90091ff 100644 --- a/src/Models/WebhookSubscription.php +++ b/src/Models/WebhookSubscription.php @@ -76,6 +76,8 @@ class WebhookSubscription public const SUBSCRIPTION_PRODUCT_CHANGE = 'subscription_product_change'; + public const SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED = 'subscription_product_change_scheduled'; + public const SUBSCRIPTION_STATE_CHANGE = 'subscription_state_change'; public const TRIAL_END_NOTICE = 'trial_end_notice'; @@ -124,6 +126,7 @@ class WebhookSubscription self::SUBSCRIPTION_CARD_UPDATE, self::SUBSCRIPTION_GROUP_CARD_UPDATE, self::SUBSCRIPTION_PRODUCT_CHANGE, + self::SUBSCRIPTION_PRODUCT_CHANGE_SCHEDULED, self::SUBSCRIPTION_STATE_CHANGE, self::TRIAL_END_NOTICE, self::UPCOMING_RENEWAL_NOTICE, diff --git a/tests/TestData/ComponentTestData.php b/tests/TestData/ComponentTestData.php index 09ffc7b6..ce77fc65 100644 --- a/tests/TestData/ComponentTestData.php +++ b/tests/TestData/ComponentTestData.php @@ -26,6 +26,7 @@ final class ComponentTestData public const ACCOUNTING_CODE = null; public const USE_SITE_EXCHANGE_RATE = true; public const ITEM_CATEGORY = null; + public const UNSPSC_CODE = null; public const ALLOW_FRACTIONAL_QUANTITIES = false; public const HIDE_DATE_RANGE_ON_INVOICE = false; public const ARCHIVED_AT = null; diff --git a/tests/TestData/ProductTestData.php b/tests/TestData/ProductTestData.php index 0b771be7..e5ccadb6 100644 --- a/tests/TestData/ProductTestData.php +++ b/tests/TestData/ProductTestData.php @@ -32,6 +32,7 @@ final class ProductTestData public const PUBLIC_SIGNUP_PAGES = []; public const TAX_CODE = null; public const ITEM_CATEGORY = null; + public const UNSPSC_CODE = null; public const PRICE_IN_CENTS = 100; public const VERSION_NUMBER = 1; } diff --git a/tests/TestFactory/TestComponentFactory.php b/tests/TestFactory/TestComponentFactory.php index 5ecd2429..52b8eb25 100644 --- a/tests/TestFactory/TestComponentFactory.php +++ b/tests/TestFactory/TestComponentFactory.php @@ -54,6 +54,7 @@ public function createQuantityBasedComponent( ->itemCategory(ComponentTestData::ITEM_CATEGORY) ->useSiteExchangeRate(ComponentTestData::USE_SITE_EXCHANGE_RATE) ->accountingCode(ComponentTestData::ACCOUNTING_CODE) + ->unspscCode(ComponentTestData::UNSPSC_CODE) ->createdAt($createdAt) ->build(); } @@ -115,6 +116,7 @@ public function createOnOffComponent( ->itemCategory(ComponentTestData::ITEM_CATEGORY) ->useSiteExchangeRate(ComponentTestData::USE_SITE_EXCHANGE_RATE) ->accountingCode(ComponentTestData::ACCOUNTING_CODE) + ->unspscCode(ComponentTestData::UNSPSC_CODE) ->createdAt($createdAt) ->build(); } diff --git a/tests/TestFactory/TestProductFactory.php b/tests/TestFactory/TestProductFactory.php index 79926045..791d8ff2 100644 --- a/tests/TestFactory/TestProductFactory.php +++ b/tests/TestFactory/TestProductFactory.php @@ -78,6 +78,7 @@ public function create( ->publicSignupPages(ProductTestData::PUBLIC_SIGNUP_PAGES) ->taxCode(ProductTestData::TAX_CODE) ->itemCategory(ProductTestData::ITEM_CATEGORY) + ->unspscCode(ProductTestData::UNSPSC_CODE) ->additionalProperty('trial_type', 'payment_expected') ->build(); }