diff --git a/AdvancedBilling.Standard/Controllers/APIExportsController.cs b/AdvancedBilling.Standard/Controllers/APIExportsController.cs
index d4c0420..5e3faca 100644
--- a/AdvancedBilling.Standard/Controllers/APIExportsController.cs
+++ b/AdvancedBilling.Standard/Controllers/APIExportsController.cs
@@ -67,28 +67,28 @@ internal APIExportsController(GlobalConfiguration globalConfiguration) : base(gl
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This API returns an array of exported invoices for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
- /// Example: `GET https://{subdomain}.chargify.com/api_exports/invoices/123/rows?per_page=10000&page=1`.
+ /// This API returns an array of exported subscriptions for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
+ /// Example: `GET https://{subdomain}.chargify.com/api_exports/subscriptions/123/rows?per_page=200&page=1`.
///
/// Object containing request parameters.
- /// Returns the List of Models.Invoice response from the API call.
- public List ListExportedInvoices(
- Models.ListExportedInvoicesInput input)
- => CoreHelper.RunTask(ListExportedInvoicesAsync(input));
+ /// Returns the List of Models.Subscription response from the API call.
+ public List ListExportedSubscriptions(
+ Models.ListExportedSubscriptionsInput input)
+ => CoreHelper.RunTask(ListExportedSubscriptionsAsync(input));
///
- /// This API returns an array of exported invoices for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
- /// Example: `GET https://{subdomain}.chargify.com/api_exports/invoices/123/rows?per_page=10000&page=1`.
+ /// This API returns an array of exported subscriptions for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
+ /// Example: `GET https://{subdomain}.chargify.com/api_exports/subscriptions/123/rows?per_page=200&page=1`.
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the List of Models.Invoice response from the API call.
- public async Task> ListExportedInvoicesAsync(
- Models.ListExportedInvoicesInput input,
+ /// Returns the List of Models.Subscription response from the API call.
+ public async Task> ListExportedSubscriptionsAsync(
+ Models.ListExportedSubscriptionsInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/api_exports/invoices/{batch_id}/rows.json")
+ .Setup(HttpMethod.Get, "/api_exports/subscriptions/{batch_id}/rows.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("batch_id", input.BatchId).Required())
@@ -99,28 +99,28 @@ internal APIExportsController(GlobalConfiguration globalConfiguration) : base(gl
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This API returns an array of exported subscriptions for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
- /// Example: `GET https://{subdomain}.chargify.com/api_exports/subscriptions/123/rows?per_page=200&page=1`.
+ /// This API returns an array of exported invoices for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
+ /// Example: `GET https://{subdomain}.chargify.com/api_exports/invoices/123/rows?per_page=10000&page=1`.
///
/// Object containing request parameters.
- /// Returns the List of Models.Subscription response from the API call.
- public List ListExportedSubscriptions(
- Models.ListExportedSubscriptionsInput input)
- => CoreHelper.RunTask(ListExportedSubscriptionsAsync(input));
+ /// Returns the List of Models.Invoice response from the API call.
+ public List ListExportedInvoices(
+ Models.ListExportedInvoicesInput input)
+ => CoreHelper.RunTask(ListExportedInvoicesAsync(input));
///
- /// This API returns an array of exported subscriptions for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
- /// Example: `GET https://{subdomain}.chargify.com/api_exports/subscriptions/123/rows?per_page=200&page=1`.
+ /// This API returns an array of exported invoices for a provided `batch_id`. Pay close attention to pagination in order to control responses from the server.
+ /// Example: `GET https://{subdomain}.chargify.com/api_exports/invoices/123/rows?per_page=10000&page=1`.
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the List of Models.Subscription response from the API call.
- public async Task> ListExportedSubscriptionsAsync(
- Models.ListExportedSubscriptionsInput input,
+ /// Returns the List of Models.Invoice response from the API call.
+ public async Task> ListExportedInvoicesAsync(
+ Models.ListExportedInvoicesInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/api_exports/subscriptions/{batch_id}/rows.json")
+ .Setup(HttpMethod.Get, "/api_exports/invoices/{batch_id}/rows.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("batch_id", input.BatchId).Required())
@@ -155,46 +155,31 @@ public Models.BatchJobResponse ExportProformaInvoices()
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This API creates an invoices export and returns a batchjob object.
- ///
- /// Returns the Models.BatchJobResponse response from the API call.
- public Models.BatchJobResponse ExportInvoices()
- => CoreHelper.RunTask(ExportInvoicesAsync());
-
- ///
- /// This API creates an invoices export and returns a batchjob object.
- ///
- /// cancellationToken.
- /// Returns the Models.BatchJobResponse response from the API call.
- public async Task ExportInvoicesAsync(CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/api_exports/invoices.json")
- .WithAuth("global"))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("409", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This API creates a subscriptions export and returns a batchjob object.
+ /// This API returns a batchjob object for subscriptions export.
///
+ /// Required parameter: Id of a Batch Job..
/// Returns the Models.BatchJobResponse response from the API call.
- public Models.BatchJobResponse ExportSubscriptions()
- => CoreHelper.RunTask(ExportSubscriptionsAsync());
+ public Models.BatchJobResponse ReadSubscriptionsExport(
+ string batchId)
+ => CoreHelper.RunTask(ReadSubscriptionsExportAsync(batchId));
///
- /// This API creates a subscriptions export and returns a batchjob object.
+ /// This API returns a batchjob object for subscriptions export.
///
+ /// Required parameter: Id of a Batch Job..
/// cancellationToken.
/// Returns the Models.BatchJobResponse response from the API call.
- public async Task ExportSubscriptionsAsync(CancellationToken cancellationToken = default)
+ public async Task ReadSubscriptionsExportAsync(
+ string batchId,
+ CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/api_exports/subscriptions.json")
- .WithAuth("global"))
+ .Setup(HttpMethod.Get, "/api_exports/subscriptions/{batch_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("batch_id", batchId).Required())))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("409", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -226,54 +211,69 @@ public Models.BatchJobResponse ReadProformaInvoicesExport(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This API returns a batchjob object for invoices export.
+ /// This API creates an invoices export and returns a batchjob object.
///
- /// Required parameter: Id of a Batch Job..
/// Returns the Models.BatchJobResponse response from the API call.
- public Models.BatchJobResponse ReadInvoicesExport(
- string batchId)
- => CoreHelper.RunTask(ReadInvoicesExportAsync(batchId));
+ public Models.BatchJobResponse ExportInvoices()
+ => CoreHelper.RunTask(ExportInvoicesAsync());
///
- /// This API returns a batchjob object for invoices export.
+ /// This API creates an invoices export and returns a batchjob object.
///
- /// Required parameter: Id of a Batch Job..
/// cancellationToken.
/// Returns the Models.BatchJobResponse response from the API call.
- public async Task ReadInvoicesExportAsync(
- string batchId,
- CancellationToken cancellationToken = default)
+ public async Task ExportInvoicesAsync(CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/api_exports/invoices/{batch_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("batch_id", batchId).Required())))
+ .Setup(HttpMethod.Post, "/api_exports/invoices.json")
+ .WithAuth("global"))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("409", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This API returns a batchjob object for subscriptions export.
+ /// This API creates a subscriptions export and returns a batchjob object.
+ ///
+ /// Returns the Models.BatchJobResponse response from the API call.
+ public Models.BatchJobResponse ExportSubscriptions()
+ => CoreHelper.RunTask(ExportSubscriptionsAsync());
+
+ ///
+ /// This API creates a subscriptions export and returns a batchjob object.
+ ///
+ /// cancellationToken.
+ /// Returns the Models.BatchJobResponse response from the API call.
+ public async Task ExportSubscriptionsAsync(CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/api_exports/subscriptions.json")
+ .WithAuth("global"))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("409", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This API returns a batchjob object for invoices export.
///
/// Required parameter: Id of a Batch Job..
/// Returns the Models.BatchJobResponse response from the API call.
- public Models.BatchJobResponse ReadSubscriptionsExport(
+ public Models.BatchJobResponse ReadInvoicesExport(
string batchId)
- => CoreHelper.RunTask(ReadSubscriptionsExportAsync(batchId));
+ => CoreHelper.RunTask(ReadInvoicesExportAsync(batchId));
///
- /// This API returns a batchjob object for subscriptions export.
+ /// This API returns a batchjob object for invoices export.
///
/// Required parameter: Id of a Batch Job..
/// cancellationToken.
/// Returns the Models.BatchJobResponse response from the API call.
- public async Task ReadSubscriptionsExportAsync(
+ public async Task ReadInvoicesExportAsync(
string batchId,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/api_exports/subscriptions/{batch_id}.json")
+ .Setup(HttpMethod.Get, "/api_exports/invoices/{batch_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("batch_id", batchId).Required())))
diff --git a/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs b/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs
index b5bb991..0e97b98 100644
--- a/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs
+++ b/AdvancedBilling.Standard/Controllers/AdvanceInvoiceController.cs
@@ -76,65 +76,65 @@ public Models.Invoice IssueAdvanceInvoice(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Once an advance invoice has been generated for a subscription's upcoming renewal, it can be viewed through this endpoint. There can only be one advance invoice per subscription per billing cycle.
+ /// Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired.
+ /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs](reference/Chargify-API.v1.yaml/components/schemas/Invoice).
///
/// Required parameter: The Chargify id of the subscription.
+ /// Optional parameter: Example: .
/// Returns the Models.Invoice response from the API call.
- public Models.Invoice ReadAdvanceInvoice(
- int subscriptionId)
- => CoreHelper.RunTask(ReadAdvanceInvoiceAsync(subscriptionId));
+ public Models.Invoice VoidAdvanceInvoice(
+ int subscriptionId,
+ Models.VoidInvoiceRequest body = null)
+ => CoreHelper.RunTask(VoidAdvanceInvoiceAsync(subscriptionId, body));
///
- /// Once an advance invoice has been generated for a subscription's upcoming renewal, it can be viewed through this endpoint. There can only be one advance invoice per subscription per billing cycle.
+ /// Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired.
+ /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs](reference/Chargify-API.v1.yaml/components/schemas/Invoice).
///
/// Required parameter: The Chargify id of the subscription.
+ /// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.Invoice response from the API call.
- public async Task ReadAdvanceInvoiceAsync(
+ public async Task VoidAdvanceInvoiceAsync(
int subscriptionId,
+ Models.VoidInvoiceRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/subscriptions/{subscription_id}/advance_invoice.json")
+ .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/advance_invoice/void.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("subscription_id", subscriptionId))))
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("subscription_id", subscriptionId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired.
- /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs](reference/Chargify-API.v1.yaml/components/schemas/Invoice).
+ /// Once an advance invoice has been generated for a subscription's upcoming renewal, it can be viewed through this endpoint. There can only be one advance invoice per subscription per billing cycle.
///
/// Required parameter: The Chargify id of the subscription.
- /// Optional parameter: Example: .
/// Returns the Models.Invoice response from the API call.
- public Models.Invoice VoidAdvanceInvoice(
- int subscriptionId,
- Models.VoidInvoiceRequest body = null)
- => CoreHelper.RunTask(VoidAdvanceInvoiceAsync(subscriptionId, body));
+ public Models.Invoice ReadAdvanceInvoice(
+ int subscriptionId)
+ => CoreHelper.RunTask(ReadAdvanceInvoiceAsync(subscriptionId));
///
- /// Void a subscription's existing advance invoice. Once voided, it can later be regenerated if desired.
- /// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, please [see our help docs](reference/Chargify-API.v1.yaml/components/schemas/Invoice).
+ /// Once an advance invoice has been generated for a subscription's upcoming renewal, it can be viewed through this endpoint. There can only be one advance invoice per subscription per billing cycle.
///
/// Required parameter: The Chargify id of the subscription.
- /// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.Invoice response from the API call.
- public async Task VoidAdvanceInvoiceAsync(
+ public async Task ReadAdvanceInvoiceAsync(
int subscriptionId,
- Models.VoidInvoiceRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/advance_invoice/void.json")
+ .Setup(HttpMethod.Get, "/subscriptions/{subscription_id}/advance_invoice.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("subscription_id", subscriptionId))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .Template(_template => _template.Setup("subscription_id", subscriptionId))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
diff --git a/AdvancedBilling.Standard/Controllers/BaseController.cs b/AdvancedBilling.Standard/Controllers/BaseController.cs
index 7600288..8657e77 100644
--- a/AdvancedBilling.Standard/Controllers/BaseController.cs
+++ b/AdvancedBilling.Standard/Controllers/BaseController.cs
@@ -29,12 +29,12 @@ public class BaseController
protected static ErrorCase CreateErrorCase(string reason, Func error, bool isErrorTemplate = false)
=> new ErrorCase(reason, error, isErrorTemplate);
- protected ApiCall CreateApiCall()
+ protected ApiCall CreateApiCall(ArraySerialization arraySerialization = ArraySerialization.CSV)
=> new ApiCall(
globalConfiguration,
compatibilityFactory,
- globalErrors: globalErrors,
- serialization: ArraySerialization.CSV
+ serialization: arraySerialization,
+ globalErrors: globalErrors
);
private static readonly CompatibilityFactory compatibilityFactory = new CompatibilityFactory();
diff --git a/AdvancedBilling.Standard/Controllers/BillingPortalController.cs b/AdvancedBilling.Standard/Controllers/BillingPortalController.cs
index ef18180..57236b4 100644
--- a/AdvancedBilling.Standard/Controllers/BillingPortalController.cs
+++ b/AdvancedBilling.Standard/Controllers/BillingPortalController.cs
@@ -34,6 +34,38 @@ public class BillingPortalController : BaseController
///
internal BillingPortalController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
+ ///
+ /// You can revoke a customer's Billing Portal invitation.
+ /// If you attempt to revoke an invitation when the Billing Portal is already disabled for a Customer, you will receive a 422 error response.
+ /// ## Limitations.
+ /// This endpoint will only return a JSON response.
+ ///
+ /// Required parameter: The Chargify id of the customer.
+ /// Returns the Models.RevokedInvitation response from the API call.
+ public Models.RevokedInvitation RevokeBillingPortalAccess(
+ int customerId)
+ => CoreHelper.RunTask(RevokeBillingPortalAccessAsync(customerId));
+
+ ///
+ /// You can revoke a customer's Billing Portal invitation.
+ /// If you attempt to revoke an invitation when the Billing Portal is already disabled for a Customer, you will receive a 422 error response.
+ /// ## Limitations.
+ /// This endpoint will only return a JSON response.
+ ///
+ /// Required parameter: The Chargify id of the customer.
+ /// cancellationToken.
+ /// Returns the Models.RevokedInvitation response from the API call.
+ public async Task RevokeBillingPortalAccessAsync(
+ int customerId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Delete, "/portal/customers/{customer_id}/invitations/revoke.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("customer_id", customerId))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// ## Billing Portal Documentation.
/// Full documentation on how the Billing Portal operates within the Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407648972443).
@@ -162,37 +194,5 @@ public Models.ResentInvitation ResendBillingPortalInvitation(
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// You can revoke a customer's Billing Portal invitation.
- /// If you attempt to revoke an invitation when the Billing Portal is already disabled for a Customer, you will receive a 422 error response.
- /// ## Limitations.
- /// This endpoint will only return a JSON response.
- ///
- /// Required parameter: The Chargify id of the customer.
- /// Returns the Models.RevokedInvitation response from the API call.
- public Models.RevokedInvitation RevokeBillingPortalAccess(
- int customerId)
- => CoreHelper.RunTask(RevokeBillingPortalAccessAsync(customerId));
-
- ///
- /// You can revoke a customer's Billing Portal invitation.
- /// If you attempt to revoke an invitation when the Billing Portal is already disabled for a Customer, you will receive a 422 error response.
- /// ## Limitations.
- /// This endpoint will only return a JSON response.
- ///
- /// Required parameter: The Chargify id of the customer.
- /// cancellationToken.
- /// Returns the Models.RevokedInvitation response from the API call.
- public async Task RevokeBillingPortalAccessAsync(
- int customerId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/portal/customers/{customer_id}/invitations/revoke.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("customer_id", customerId))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/ComponentsController.cs b/AdvancedBilling.Standard/Controllers/ComponentsController.cs
index cec6308..11e46fe 100644
--- a/AdvancedBilling.Standard/Controllers/ComponentsController.cs
+++ b/AdvancedBilling.Standard/Controllers/ComponentsController.cs
@@ -16,7 +16,6 @@ namespace AdvancedBilling.Standard.Controllers
using AdvancedBilling.Standard.Authentication;
using AdvancedBilling.Standard.Exceptions;
using AdvancedBilling.Standard.Http.Client;
- using AdvancedBilling.Standard.Models.Containers;
using AdvancedBilling.Standard.Utilities;
using APIMatic.Core;
using APIMatic.Core.Types;
@@ -36,56 +35,320 @@ public class ComponentsController : BaseController
internal ComponentsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// This request will create a component definition under the specified product family. These component definitions determine what components are named, how they are measured, and how much they cost.
- /// Components can then be added and “allocated” for each subscription to a product in the product family. These component line-items affect how much a subscription will be charged, depending on the current allocations (i.e. 4 IP Addresses, or SSL “enabled”).
- /// This documentation covers both component definitions and component line-items. Please understand the difference.
- /// Please note that you may not edit components via API. To do so, please log into the application.
- /// ### Component Documentation.
+ /// This request will create a component definition of kind **on_off_component** under the specified product family. On/Off component can then be added and “allocated” for a subscription.
+ /// On/off components are used for any flat fee, recurring add on (think $99/month for tech support or a flat add on shipping fee).
/// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
- /// For information on how to record component usage against a subscription, please see the following resources:.
- /// + [Proration and Component Allocations](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677#applying-proration-and-recording-components).
- /// + [Recording component usage against a subscription](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404606587917#recording-component-usage).
///
/// Required parameter: The Chargify id of the product family to which the component belongs.
- /// Required parameter: The component kind.
/// Optional parameter: Example: .
/// Returns the Models.ComponentResponse response from the API call.
- public Models.ComponentResponse CreateComponent(
+ public Models.ComponentResponse CreateOnOffComponent(
int productFamilyId,
- Models.ComponentKindPath componentKind,
- CreateComponentBody body = null)
- => CoreHelper.RunTask(CreateComponentAsync(productFamilyId, componentKind, body));
+ Models.CreateOnOffComponent body = null)
+ => CoreHelper.RunTask(CreateOnOffComponentAsync(productFamilyId, body));
///
- /// This request will create a component definition under the specified product family. These component definitions determine what components are named, how they are measured, and how much they cost.
- /// Components can then be added and “allocated” for each subscription to a product in the product family. These component line-items affect how much a subscription will be charged, depending on the current allocations (i.e. 4 IP Addresses, or SSL “enabled”).
- /// This documentation covers both component definitions and component line-items. Please understand the difference.
- /// Please note that you may not edit components via API. To do so, please log into the application.
- /// ### Component Documentation.
+ /// This request will create a component definition of kind **on_off_component** under the specified product family. On/Off component can then be added and “allocated” for a subscription.
+ /// On/off components are used for any flat fee, recurring add on (think $99/month for tech support or a flat add on shipping fee).
/// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
- /// For information on how to record component usage against a subscription, please see the following resources:.
- /// + [Proration and Component Allocations](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677#applying-proration-and-recording-components).
- /// + [Recording component usage against a subscription](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404606587917#recording-component-usage).
///
/// Required parameter: The Chargify id of the product family to which the component belongs.
- /// Required parameter: The component kind.
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ComponentResponse response from the API call.
- public async Task CreateComponentAsync(
+ public async Task CreateOnOffComponentAsync(
int productFamilyId,
- Models.ComponentKindPath componentKind,
- CreateComponentBody body = null,
+ Models.CreateOnOffComponent body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/product_families/{product_family_id}/{component_kind}.json")
+ .Setup(HttpMethod.Post, "/product_families/{product_family_id}/on_off_components.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("product_family_id", productFamilyId))
- .Template(_template => _template.Setup("component_kind", ApiHelper.JsonSerialize(componentKind).Trim('\"')))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This request will create a component definition of kind **prepaid_usage_component** under the specified product family. Prepaid component can then be added and “allocated” for a subscription.
+ /// Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased.
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ComponentResponse response from the API call.
+ public Models.ComponentResponse CreatePrepaidUsageComponent(
+ int productFamilyId,
+ Models.CreatePrepaidComponent body = null)
+ => CoreHelper.RunTask(CreatePrepaidUsageComponentAsync(productFamilyId, body));
+
+ ///
+ /// This request will create a component definition of kind **prepaid_usage_component** under the specified product family. Prepaid component can then be added and “allocated” for a subscription.
+ /// Prepaid components allow customers to pre-purchase units that can be used up over time on their subscription. In a sense, they are the mirror image of metered components; while metered components charge at the end of the period for the amount of units used, prepaid components are charged for at the time of purchase, and we subsequently keep track of the usage against the amount purchased.
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.ComponentResponse response from the API call.
+ public async Task CreatePrepaidUsageComponentAsync(
+ int productFamilyId,
+ Models.CreatePrepaidComponent body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/product_families/{product_family_id}/prepaid_usage_components.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This request will create a component definition of kind **event_based_component** under the specified product family. Event-based component can then be added and “allocated” for a subscription.
+ /// Event-based components are similar to other component types, in that you define the component parameters (such as name and taxability) and the pricing. A key difference for the event-based component is that it must be attached to a metric. This is because the metric provides the component with the actual quantity used in computing what and how much will be billed each period for each subscription.
+ /// So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. .
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ComponentResponse response from the API call.
+ public Models.ComponentResponse CreateEventBasedComponent(
+ int productFamilyId,
+ Models.CreateEBBComponent body = null)
+ => CoreHelper.RunTask(CreateEventBasedComponentAsync(productFamilyId, body));
+
+ ///
+ /// This request will create a component definition of kind **event_based_component** under the specified product family. Event-based component can then be added and “allocated” for a subscription.
+ /// Event-based components are similar to other component types, in that you define the component parameters (such as name and taxability) and the pricing. A key difference for the event-based component is that it must be attached to a metric. This is because the metric provides the component with the actual quantity used in computing what and how much will be billed each period for each subscription.
+ /// So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events. .
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.ComponentResponse response from the API call.
+ public async Task CreateEventBasedComponentAsync(
+ int productFamilyId,
+ Models.CreateEBBComponent body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/product_families/{product_family_id}/event_based_components.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This request will create a component definition of kind **quantity_based_component** under the specified product family. Quantity Based component can then be added and “allocated” for a subscription.
+ /// When defining Quantity Based component, You can choose one of 2 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 associated with billing for user licenses, number of users, number of employees, etc.
+ /// #### One-time.
+ /// One-time quantity-based components are used to create ad hoc usage charges that do not recur. For example, at the time of signup, you might want to charge your customer a one-time fee for onboarding or other services.
+ /// The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made.
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ComponentResponse response from the API call.
+ public Models.ComponentResponse CreateQuantityBasedComponent(
+ int productFamilyId,
+ Models.CreateQuantityBasedComponent body = null)
+ => CoreHelper.RunTask(CreateQuantityBasedComponentAsync(productFamilyId, body));
+
+ ///
+ /// This request will create a component definition of kind **quantity_based_component** under the specified product family. Quantity Based component can then be added and “allocated” for a subscription.
+ /// When defining Quantity Based component, You can choose one of 2 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 associated with billing for user licenses, number of users, number of employees, etc.
+ /// #### One-time.
+ /// One-time quantity-based components are used to create ad hoc usage charges that do not recur. For example, at the time of signup, you might want to charge your customer a one-time fee for onboarding or other services.
+ /// The allocated quantity for one-time quantity-based components immediately gets reset back to zero after the allocation is made.
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.ComponentResponse response from the API call.
+ public async Task CreateQuantityBasedComponentAsync(
+ int productFamilyId,
+ Models.CreateQuantityBasedComponent body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/product_families/{product_family_id}/quantity_based_components.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This request will create a component definition of kind **metered_component** under the specified product family. Metered component can then be added and “allocated” for a subscription.
+ /// Metered components are used to bill for any type of unit that resets to 0 at the end of the billing period (think daily Google Adwords clicks or monthly cell phone minutes). This is most commonly associated with usage-based billing and many other pricing schemes.
+ /// Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead.
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ComponentResponse response from the API call.
+ public Models.ComponentResponse CreateMeteredComponent(
+ int productFamilyId,
+ Models.CreateMeteredComponent body = null)
+ => CoreHelper.RunTask(CreateMeteredComponentAsync(productFamilyId, body));
+
+ ///
+ /// This request will create a component definition of kind **metered_component** under the specified product family. Metered component can then be added and “allocated” for a subscription.
+ /// Metered components are used to bill for any type of unit that resets to 0 at the end of the billing period (think daily Google Adwords clicks or monthly cell phone minutes). This is most commonly associated with usage-based billing and many other pricing schemes.
+ /// Note that this is different from recurring quantity-based components, which DO NOT reset to zero at the start of every billing period. If you want to bill for a quantity of something that does not change unless you change it, then you want quantity components, instead.
+ /// For more information on components, please see our documentation [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405020625677).
+ ///
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.ComponentResponse response from the API call.
+ public async Task CreateMeteredComponentAsync(
+ int productFamilyId,
+ Models.CreateMeteredComponent body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/product_families/{product_family_id}/metered_components.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This request will return a list of components for a site.
+ ///
+ /// Object containing request parameters.
+ /// Returns the List of Models.ComponentResponse response from the API call.
+ public List ListComponents(
+ Models.ListComponentsInput input)
+ => CoreHelper.RunTask(ListComponentsAsync(input));
+
+ ///
+ /// This request will return a list of components for a site.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the List of Models.ComponentResponse response from the API call.
+ public async Task> ListComponentsAsync(
+ Models.ListComponentsInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall>()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/components.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("start_date", input.StartDate))
+ .Query(_query => _query.Setup("end_date", input.EndDate))
+ .Query(_query => _query.Setup("start_datetime", input.StartDatetime))
+ .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
+ .Query(_query => _query.Setup("include_archived", input.IncludeArchived))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
+ .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// Use this endpoint to read current price points that are 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.
+ ///
+ /// Object containing request parameters.
+ /// Returns the Models.ComponentPricePointsResponse response from the API call.
+ public Models.ComponentPricePointsResponse ListComponentPricePoints(
+ Models.ListComponentPricePointsInput input)
+ => CoreHelper.RunTask(ListComponentPricePointsAsync(input));
+
+ ///
+ /// Use this endpoint to read current price points that are 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.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the Models.ComponentPricePointsResponse response from the API call.
+ public async Task ListComponentPricePointsAsync(
+ Models.ListComponentPricePointsInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/components/{component_id}/price_points.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("component_id", input.ComponentId))
+ .Query(_query => _query.Setup("currency_prices", input.CurrencyPrices))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This method allows to retrieve a list of Components Price Points belonging to a Site.
+ ///
+ /// Object containing request parameters.
+ /// Returns the Models.ListComponentsPricePointsResponse response from the API call.
+ public Models.ListComponentsPricePointsResponse ListAllComponentPricePoints(
+ Models.ListAllComponentPricePointsInput input)
+ => CoreHelper.RunTask(ListAllComponentPricePointsAsync(input));
+
+ ///
+ /// This method allows to retrieve a list of Components Price Points belonging to a Site.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the Models.ListComponentsPricePointsResponse response from the API call.
+ public async Task ListAllComponentPricePointsAsync(
+ Models.ListAllComponentPricePointsInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/components_price_points.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("filter[date_field]", (input.FilterDateField.HasValue) ? ApiHelper.JsonSerialize(input.FilterDateField.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[end_date]", input.FilterEndDate.HasValue ? input.FilterEndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("filter[end_datetime]", input.FilterEndDatetime.HasValue ? input.FilterEndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("filter[start_date]", input.FilterStartDate.HasValue ? input.FilterStartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("filter[start_datetime]", input.FilterStartDatetime.HasValue ? input.FilterStartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))
+ .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
+ .Query(_query => _query.Setup("filter[archived_at]", (input.FilterArchivedAt.HasValue) ? ApiHelper.JsonSerialize(input.FilterArchivedAt.Value).Trim('\"') : null))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
@@ -117,73 +380,68 @@ public Models.ComponentResponse ReadComponentByHandle(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This request will return information regarding 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:`.
+ /// Sending a DELETE request to this endpoint will archive the component. All current subscribers will be unffected; their subscription/purchase will continue to be charged as usual.
///
/// Required parameter: The Chargify id of the product family to which the component belongs.
/// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
- /// Returns the Models.ComponentResponse response from the API call.
- public Models.ComponentResponse ReadComponentById(
+ /// Returns the Models.Component response from the API call.
+ public Models.Component ArchiveComponent(
int productFamilyId,
string componentId)
- => CoreHelper.RunTask(ReadComponentByIdAsync(productFamilyId, componentId));
+ => CoreHelper.RunTask(ArchiveComponentAsync(productFamilyId, componentId));
///
- /// This request will return information regarding 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:`.
+ /// Sending a DELETE request to this endpoint will archive the component. All current subscribers will be unffected; their subscription/purchase will continue to be charged as usual.
///
/// Required parameter: The Chargify id of the product family to which the component belongs.
/// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
/// cancellationToken.
- /// Returns the Models.ComponentResponse response from the API call.
- public async Task ReadComponentByIdAsync(
+ /// Returns the Models.Component response from the API call.
+ public async Task ArchiveComponentAsync(
int productFamilyId,
string componentId,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/product_families/{product_family_id}/components/{component_id}.json")
+ .Setup(HttpMethod.Delete, "/product_families/{product_family_id}/components/{component_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("product_family_id", productFamilyId))
.Template(_template => _template.Setup("component_id", componentId).Required())))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This request will update a component from a specific product family.
+ /// This request will update 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:`.
///
- /// Required parameter: The Chargify id of the product family to which the component belongs.
- /// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
+ /// Required parameter: The id or handle of the component.
/// Optional parameter: Example: .
/// Returns the Models.ComponentResponse response from the API call.
- public Models.ComponentResponse UpdateProductFamilyComponent(
- int productFamilyId,
+ public Models.ComponentResponse UpdateComponent(
string componentId,
Models.UpdateComponentRequest body = null)
- => CoreHelper.RunTask(UpdateProductFamilyComponentAsync(productFamilyId, componentId, body));
+ => CoreHelper.RunTask(UpdateComponentAsync(componentId, body));
///
- /// This request will update a component from a specific product family.
+ /// This request will update 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:`.
///
- /// Required parameter: The Chargify id of the product family to which the component belongs.
- /// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
+ /// Required parameter: The id or handle of the component.
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ComponentResponse response from the API call.
- public async Task UpdateProductFamilyComponentAsync(
- int productFamilyId,
+ public async Task UpdateComponentAsync(
string componentId,
Models.UpdateComponentRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/product_families/{product_family_id}/components/{component_id}.json")
+ .Setup(HttpMethod.Put, "/components/{component_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("product_family_id", productFamilyId))
.Template(_template => _template.Setup("component_id", componentId).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
@@ -191,103 +449,182 @@ public Models.ComponentResponse UpdateProductFamilyComponent(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Sending a DELETE request to this endpoint will archive the component. All current subscribers will be unffected; their subscription/purchase will continue to be charged as usual.
+ /// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones.
+ /// Passing in a price bracket without an `id` will attempt to create a new price.
+ /// Including an `id` will update the corresponding price, and including the `_destroy` flag set to true along with the `id` will remove that price.
+ /// Note: Custom price points cannot be updated directly. They must be edited through the Subscription.
+ ///
+ /// Required parameter: The Chargify id of the component to which the price point belongs.
+ /// Required parameter: The Chargify id of the price point.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ComponentPricePointResponse response from the API call.
+ public Models.ComponentPricePointResponse UpdateComponentPricePoint(
+ int componentId,
+ int pricePointId,
+ Models.UpdateComponentPricePointRequest body = null)
+ => CoreHelper.RunTask(UpdateComponentPricePointAsync(componentId, pricePointId, body));
+
+ ///
+ /// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones.
+ /// Passing in a price bracket without an `id` will attempt to create a new price.
+ /// Including an `id` will update the corresponding price, and including the `_destroy` flag set to true along with the `id` will remove that price.
+ /// Note: Custom price points cannot be updated directly. They must be edited through the Subscription.
+ ///
+ /// Required parameter: The Chargify id of the component to which the price point belongs.
+ /// Required parameter: The Chargify id of the price point.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.ComponentPricePointResponse response from the API call.
+ public async Task UpdateComponentPricePointAsync(
+ int componentId,
+ int pricePointId,
+ Models.UpdateComponentPricePointRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Put, "/components/{component_id}/price_points/{price_point_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("component_id", componentId))
+ .Template(_template => _template.Setup("price_point_id", pricePointId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// A price point can be archived at any time. Subscriptions using a price point that has been archived will continue using it until they're moved to another price point.
+ ///
+ /// Required parameter: The Chargify id of the component to which the price point belongs.
+ /// Required parameter: The Chargify id of the price point.
+ /// Returns the Models.ComponentPricePointResponse response from the API call.
+ public Models.ComponentPricePointResponse ArchiveComponentPricePoint(
+ int componentId,
+ int pricePointId)
+ => CoreHelper.RunTask(ArchiveComponentPricePointAsync(componentId, pricePointId));
+
+ ///
+ /// A price point can be archived at any time. Subscriptions using a price point that has been archived will continue using it until they're moved to another price point.
+ ///
+ /// Required parameter: The Chargify id of the component to which the price point belongs.
+ /// Required parameter: The Chargify id of the price point.
+ /// cancellationToken.
+ /// Returns the Models.ComponentPricePointResponse response from the API call.
+ public async Task ArchiveComponentPricePointAsync(
+ int componentId,
+ int pricePointId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Delete, "/components/{component_id}/price_points/{price_point_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("component_id", componentId))
+ .Template(_template => _template.Setup("price_point_id", pricePointId))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// Use this endpoint to unarchive a component price point.
+ ///
+ /// Required parameter: The Chargify id of the component to which the price point belongs.
+ /// Required parameter: The Chargify id of the price point.
+ /// Returns the Models.ComponentPricePointResponse response from the API call.
+ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
+ int componentId,
+ int pricePointId)
+ => CoreHelper.RunTask(UnarchiveComponentPricePointAsync(componentId, pricePointId));
+
+ ///
+ /// Use this endpoint to unarchive a component price point.
+ ///
+ /// Required parameter: The Chargify id of the component to which the price point belongs.
+ /// Required parameter: The Chargify id of the price point.
+ /// cancellationToken.
+ /// Returns the Models.ComponentPricePointResponse response from the API call.
+ public async Task UnarchiveComponentPricePointAsync(
+ int componentId,
+ int pricePointId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Put, "/components/{component_id}/price_points/{price_point_id}/unarchive.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("component_id", componentId))
+ .Template(_template => _template.Setup("price_point_id", pricePointId))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This request will return information regarding 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:`.
///
/// Required parameter: The Chargify id of the product family to which the component belongs.
/// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
- /// Returns the Models.Component response from the API call.
- public Models.Component ArchiveComponent(
+ /// Returns the Models.ComponentResponse response from the API call.
+ public Models.ComponentResponse ReadComponentById(
int productFamilyId,
string componentId)
- => CoreHelper.RunTask(ArchiveComponentAsync(productFamilyId, componentId));
+ => CoreHelper.RunTask(ReadComponentByIdAsync(productFamilyId, componentId));
///
- /// Sending a DELETE request to this endpoint will archive the component. All current subscribers will be unffected; their subscription/purchase will continue to be charged as usual.
+ /// This request will return information regarding 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:`.
///
/// Required parameter: The Chargify id of the product family to which the component belongs.
/// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
/// cancellationToken.
- /// Returns the Models.Component response from the API call.
- public async Task ArchiveComponentAsync(
+ /// Returns the Models.ComponentResponse response from the API call.
+ public async Task ReadComponentByIdAsync(
int productFamilyId,
string componentId,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/product_families/{product_family_id}/components/{component_id}.json")
+ .Setup(HttpMethod.Get, "/product_families/{product_family_id}/components/{component_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("product_family_id", productFamilyId))
.Template(_template => _template.Setup("component_id", componentId).Required())))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This request will return a list of components for a site.
- ///
- /// Object containing request parameters.
- /// Returns the List of Models.ComponentResponse response from the API call.
- public List ListComponents(
- Models.ListComponentsInput input)
- => CoreHelper.RunTask(ListComponentsAsync(input));
-
- ///
- /// This request will return a list of components for a site.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the List of Models.ComponentResponse response from the API call.
- public async Task> ListComponentsAsync(
- Models.ListComponentsInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall>()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/components.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("start_date", input.StartDate))
- .Query(_query => _query.Setup("end_date", input.EndDate))
- .Query(_query => _query.Setup("start_datetime", input.StartDatetime))
- .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
- .Query(_query => _query.Setup("include_archived", input.IncludeArchived))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
- .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This request will update a component.
+ /// This request will update 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:`.
///
- /// Required parameter: The id or handle of the component.
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
/// Optional parameter: Example: .
/// Returns the Models.ComponentResponse response from the API call.
- public Models.ComponentResponse UpdateComponent(
+ public Models.ComponentResponse UpdateProductFamilyComponent(
+ int productFamilyId,
string componentId,
Models.UpdateComponentRequest body = null)
- => CoreHelper.RunTask(UpdateComponentAsync(componentId, body));
+ => CoreHelper.RunTask(UpdateProductFamilyComponentAsync(productFamilyId, componentId, body));
///
- /// This request will update a component.
+ /// This request will update 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:`.
///
- /// Required parameter: The id or handle of the component.
+ /// Required parameter: The Chargify id of the product family to which the component belongs.
+ /// Required parameter: Either the Chargify id of the component or the handle for the component prefixed with `handle:`.
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ComponentResponse response from the API call.
- public async Task UpdateComponentAsync(
+ public async Task UpdateProductFamilyComponentAsync(
+ int productFamilyId,
string componentId,
Models.UpdateComponentRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/components/{component_id}.json")
+ .Setup(HttpMethod.Put, "/product_families/{product_family_id}/components/{component_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
.Template(_template => _template.Setup("component_id", componentId).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
@@ -397,42 +734,6 @@ public Models.ComponentPricePointResponse CreateComponentPricePoint(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// Use this endpoint to read current price points that are 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.
- ///
- /// Object containing request parameters.
- /// Returns the Models.ComponentPricePointsResponse response from the API call.
- public Models.ComponentPricePointsResponse ListComponentPricePoints(
- Models.ListComponentPricePointsInput input)
- => CoreHelper.RunTask(ListComponentPricePointsAsync(input));
-
- ///
- /// Use this endpoint to read current price points that are 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.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the Models.ComponentPricePointsResponse response from the API call.
- public async Task ListComponentPricePointsAsync(
- Models.ListComponentPricePointsInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/components/{component_id}/price_points.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("component_id", input.ComponentId))
- .Query(_query => _query.Setup("currency_prices", input.CurrencyPrices))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// Use this endpoint to create multiple component price points in one request.
///
@@ -465,111 +766,6 @@ public Models.ComponentPricePointsResponse CreateComponentPricePoints(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones.
- /// Passing in a price bracket without an `id` will attempt to create a new price.
- /// Including an `id` will update the corresponding price, and including the `_destroy` flag set to true along with the `id` will remove that price.
- /// Note: Custom price points cannot be updated directly. They must be edited through the Subscription.
- ///
- /// Required parameter: The Chargify id of the component to which the price point belongs.
- /// Required parameter: The Chargify id of the price point.
- /// Optional parameter: Example: .
- /// Returns the Models.ComponentPricePointResponse response from the API call.
- public Models.ComponentPricePointResponse UpdateComponentPricePoint(
- int componentId,
- int pricePointId,
- Models.UpdateComponentPricePointRequest body = null)
- => CoreHelper.RunTask(UpdateComponentPricePointAsync(componentId, pricePointId, body));
-
- ///
- /// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones.
- /// Passing in a price bracket without an `id` will attempt to create a new price.
- /// Including an `id` will update the corresponding price, and including the `_destroy` flag set to true along with the `id` will remove that price.
- /// Note: Custom price points cannot be updated directly. They must be edited through the Subscription.
- ///
- /// Required parameter: The Chargify id of the component to which the price point belongs.
- /// Required parameter: The Chargify id of the price point.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.ComponentPricePointResponse response from the API call.
- public async Task UpdateComponentPricePointAsync(
- int componentId,
- int pricePointId,
- Models.UpdateComponentPricePointRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/components/{component_id}/price_points/{price_point_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("component_id", componentId))
- .Template(_template => _template.Setup("price_point_id", pricePointId))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// A price point can be archived at any time. Subscriptions using a price point that has been archived will continue using it until they're moved to another price point.
- ///
- /// Required parameter: The Chargify id of the component to which the price point belongs.
- /// Required parameter: The Chargify id of the price point.
- /// Returns the Models.ComponentPricePointResponse response from the API call.
- public Models.ComponentPricePointResponse ArchiveComponentPricePoint(
- int componentId,
- int pricePointId)
- => CoreHelper.RunTask(ArchiveComponentPricePointAsync(componentId, pricePointId));
-
- ///
- /// A price point can be archived at any time. Subscriptions using a price point that has been archived will continue using it until they're moved to another price point.
- ///
- /// Required parameter: The Chargify id of the component to which the price point belongs.
- /// Required parameter: The Chargify id of the price point.
- /// cancellationToken.
- /// Returns the Models.ComponentPricePointResponse response from the API call.
- public async Task ArchiveComponentPricePointAsync(
- int componentId,
- int pricePointId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/components/{component_id}/price_points/{price_point_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("component_id", componentId))
- .Template(_template => _template.Setup("price_point_id", pricePointId))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// Use this endpoint to unarchive a component price point.
- ///
- /// Required parameter: The Chargify id of the component to which the price point belongs.
- /// Required parameter: The Chargify id of the price point.
- /// Returns the Models.ComponentPricePointResponse response from the API call.
- public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
- int componentId,
- int pricePointId)
- => CoreHelper.RunTask(UnarchiveComponentPricePointAsync(componentId, pricePointId));
-
- ///
- /// Use this endpoint to unarchive a component price point.
- ///
- /// Required parameter: The Chargify id of the component to which the price point belongs.
- /// Required parameter: The Chargify id of the price point.
- /// cancellationToken.
- /// Returns the Models.ComponentPricePointResponse response from the API call.
- public async Task UnarchiveComponentPricePointAsync(
- int componentId,
- int pricePointId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/components/{component_id}/price_points/{price_point_id}/unarchive.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("component_id", componentId))
- .Template(_template => _template.Setup("price_point_id", pricePointId))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings.
/// When creating currency prices, they need to mirror the structure of your primary pricing. For each price level defined on the component price point, there should be a matching price level created in the given currency.
@@ -577,8 +773,8 @@ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
///
/// Required parameter: The Chargify id of the price point.
/// Optional parameter: Example: .
- /// Returns the List of Models.CurrencyPrice response from the API call.
- public List CreateCurrencyPrices(
+ /// Returns the Models.ComponentCurrencyPricesResponse response from the API call.
+ public Models.ComponentCurrencyPricesResponse CreateCurrencyPrices(
int pricePointId,
Models.CreateCurrencyPricesRequest body = null)
=> CoreHelper.RunTask(CreateCurrencyPricesAsync(pricePointId, body));
@@ -591,12 +787,12 @@ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
/// Required parameter: The Chargify id of the price point.
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the List of Models.CurrencyPrice response from the API call.
- public async Task> CreateCurrencyPricesAsync(
+ /// Returns the Models.ComponentCurrencyPricesResponse response from the API call.
+ public async Task CreateCurrencyPricesAsync(
int pricePointId,
Models.CreateCurrencyPricesRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Post, "/price_points/{price_point_id}/currency_prices.json")
.WithAuth("global")
@@ -604,6 +800,8 @@ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("price_point_id", pricePointId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -612,8 +810,8 @@ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
///
/// Required parameter: The Chargify id of the price point.
/// Optional parameter: Example: .
- /// Returns the List of Models.CurrencyPrice response from the API call.
- public List UpdateCurrencyPrices(
+ /// Returns the Models.ComponentCurrencyPricesResponse response from the API call.
+ public Models.ComponentCurrencyPricesResponse UpdateCurrencyPrices(
int pricePointId,
Models.UpdateCurrencyPricesRequest body = null)
=> CoreHelper.RunTask(UpdateCurrencyPricesAsync(pricePointId, body));
@@ -625,12 +823,12 @@ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
/// Required parameter: The Chargify id of the price point.
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the List of Models.CurrencyPrice response from the API call.
- public async Task> UpdateCurrencyPricesAsync(
+ /// Returns the Models.ComponentCurrencyPricesResponse response from the API call.
+ public async Task UpdateCurrencyPricesAsync(
int pricePointId,
Models.UpdateCurrencyPricesRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Put, "/price_points/{price_point_id}/currency_prices.json")
.WithAuth("global")
@@ -638,45 +836,8 @@ public Models.ComponentPricePointResponse UnarchiveComponentPricePoint(
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("price_point_id", pricePointId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This method allows to retrieve a list of Components Price Points belonging to a Site.
- ///
- /// Object containing request parameters.
- /// Returns the Models.ListComponentsPricePointsResponse response from the API call.
- public Models.ListComponentsPricePointsResponse ListAllComponentPricePoints(
- Models.ListAllComponentPricePointsInput input)
- => CoreHelper.RunTask(ListAllComponentPricePointsAsync(input));
-
- ///
- /// This method allows to retrieve a list of Components Price Points belonging to a Site.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the Models.ListComponentsPricePointsResponse response from the API call.
- public async Task ListAllComponentPricePointsAsync(
- Models.ListAllComponentPricePointsInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/components_price_points.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("filter[date_field]", (input.FilterDateField.HasValue) ? ApiHelper.JsonSerialize(input.FilterDateField.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[end_date]", input.FilterEndDate.HasValue ? input.FilterEndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("filter[end_datetime]", input.FilterEndDatetime.HasValue ? input.FilterEndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("filter[start_date]", input.FilterStartDate.HasValue ? input.FilterStartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("filter[start_datetime]", input.FilterStartDatetime.HasValue ? input.FilterStartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))
- .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
- .Query(_query => _query.Setup("filter[archived_at]", (input.FilterArchivedAt.HasValue) ? ApiHelper.JsonSerialize(input.FilterArchivedAt.Value).Trim('\"') : null))))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/CouponsController.cs b/AdvancedBilling.Standard/Controllers/CouponsController.cs
index 83fec58..2a1cbd8 100644
--- a/AdvancedBilling.Standard/Controllers/CouponsController.cs
+++ b/AdvancedBilling.Standard/Controllers/CouponsController.cs
@@ -82,115 +82,6 @@ public Models.CouponResponse CreateCoupon(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// List coupons for a specific Product Family in a Site.
- /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency.
- ///
- /// Object containing request parameters.
- /// Returns the List of Models.CouponResponse response from the API call.
- public List ListCouponsForProductFamily(
- Models.ListCouponsForProductFamilyInput input)
- => CoreHelper.RunTask(ListCouponsForProductFamilyAsync(input));
-
- ///
- /// List coupons for a specific Product Family in a Site.
- /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the List of Models.CouponResponse response from the API call.
- public async Task> ListCouponsForProductFamilyAsync(
- Models.ListCouponsForProductFamilyInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall>()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/product_families/{product_family_id}/coupons.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_family_id", input.ProductFamilyId))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("filter[date_field]", (input.FilterDateField.HasValue) ? ApiHelper.JsonSerialize(input.FilterDateField.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[end_date]", input.FilterEndDate.HasValue ? input.FilterEndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("filter[end_datetime]", input.FilterEndDatetime.HasValue ? input.FilterEndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("filter[start_date]", input.FilterStartDate.HasValue ? input.FilterStartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("filter[start_datetime]", input.FilterStartDatetime.HasValue ? input.FilterStartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
- .Query(_query => _query.Setup("filter[codes]", input.FilterCodes))
- .Query(_query => _query.Setup("currency_prices", input.CurrencyPrices))
- .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// You can search for a coupon via the API with the find method. By passing a code parameter, the find will attempt to locate a coupon that matches that code. If no coupon is found, a 404 is returned.
- /// 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.
- ///
- /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
- /// Optional parameter: The code of the coupon.
- /// Returns the Models.CouponResponse response from the API call.
- public Models.CouponResponse ReadCouponByCode(
- int? productFamilyId = null,
- string code = null)
- => CoreHelper.RunTask(ReadCouponByCodeAsync(productFamilyId, code));
-
- ///
- /// You can search for a coupon via the API with the find method. By passing a code parameter, the find will attempt to locate a coupon that matches that code. If no coupon is found, a 404 is returned.
- /// 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.
- ///
- /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
- /// Optional parameter: The code of the coupon.
- /// cancellationToken.
- /// Returns the Models.CouponResponse response from the API call.
- public async Task ReadCouponByCodeAsync(
- int? productFamilyId = null,
- string code = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/coupons/find.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("product_family_id", productFamilyId))
- .Query(_query => _query.Setup("code", code))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// You can retrieve the Coupon via the API with the Show method. You must identify the Coupon in this call by the ID parameter that Chargify assigns.
- /// If instead you would like to find a Coupon using a Coupon code, see the Coupon Find method.
- /// 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 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.
- ///
- /// Required parameter: The Chargify id of the product family to which the coupon belongs.
- /// Required parameter: The Chargify id of the coupon.
- /// Returns the Models.CouponResponse response from the API call.
- public Models.CouponResponse ReadCoupon(
- int productFamilyId,
- int couponId)
- => CoreHelper.RunTask(ReadCouponAsync(productFamilyId, couponId));
-
- ///
- /// You can retrieve the Coupon via the API with the Show method. You must identify the Coupon in this call by the ID parameter that Chargify assigns.
- /// If instead you would like to find a Coupon using a Coupon code, see the Coupon Find method.
- /// 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 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.
- ///
- /// Required parameter: The Chargify id of the product family to which the coupon belongs.
- /// Required parameter: The Chargify id of the coupon.
- /// cancellationToken.
- /// Returns the Models.CouponResponse response from the API call.
- public async Task ReadCouponAsync(
- int productFamilyId,
- int couponId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/product_families/{product_family_id}/coupons/{coupon_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_family_id", productFamilyId))
- .Template(_template => _template.Setup("coupon_id", couponId))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// ## Update Coupon.
/// You can update a Coupon via the API with a PUT request to the resource endpoint.
@@ -234,41 +125,6 @@ public Models.CouponResponse UpdateCoupon(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// You can archive a Coupon via the API with the archive method.
- /// Archiving makes that Coupon unavailable for future use, but allows it to remain attached and functional on existing Subscriptions that are using it.
- /// The `archived_at` date and time will be assigned.
- ///
- /// Required parameter: The Chargify id of the product family to which the coupon belongs.
- /// Required parameter: The Chargify id of the coupon.
- /// Returns the Models.CouponResponse response from the API call.
- public Models.CouponResponse ArchiveCoupon(
- int productFamilyId,
- int couponId)
- => CoreHelper.RunTask(ArchiveCouponAsync(productFamilyId, couponId));
-
- ///
- /// You can archive a Coupon via the API with the archive method.
- /// Archiving makes that Coupon unavailable for future use, but allows it to remain attached and functional on existing Subscriptions that are using it.
- /// The `archived_at` date and time will be assigned.
- ///
- /// Required parameter: The Chargify id of the product family to which the coupon belongs.
- /// Required parameter: The Chargify id of the coupon.
- /// cancellationToken.
- /// Returns the Models.CouponResponse response from the API call.
- public async Task ArchiveCouponAsync(
- int productFamilyId,
- int couponId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/product_families/{product_family_id}/coupons/{coupon_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_family_id", productFamilyId))
- .Template(_template => _template.Setup("coupon_id", couponId))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// You can retrieve a list of coupons.
/// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency.
@@ -343,99 +199,6 @@ public Models.CouponResponse ArchiveCoupon(
.Template(_template => _template.Setup("coupon_id", couponId))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// You can verify if a specific coupon code is valid using the `validate` method. 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.
- /// 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.
- /// Eg.
- /// ```.
- /// https://.chargify.com/product_families/handle:/coupons/validate.?code=.
- /// ```.
- /// Or:.
- /// ```.
- /// https://.chargify.com/coupons/validate.?code=&product_family_id=.
- /// ```.
- ///
- /// Required parameter: The code of the coupon.
- /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
- /// Returns the Models.CouponResponse response from the API call.
- public Models.CouponResponse ValidateCoupon(
- string code,
- int? productFamilyId = null)
- => CoreHelper.RunTask(ValidateCouponAsync(code, productFamilyId));
-
- ///
- /// You can verify if a specific coupon code is valid using the `validate` method. 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.
- /// 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.
- /// Eg.
- /// ```.
- /// https://.chargify.com/product_families/handle:/coupons/validate.?code=.
- /// ```.
- /// Or:.
- /// ```.
- /// https://.chargify.com/coupons/validate.?code=&product_family_id=.
- /// ```.
- ///
- /// Required parameter: The code of the coupon.
- /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
- /// cancellationToken.
- /// Returns the Models.CouponResponse response from the API call.
- public async Task ValidateCouponAsync(
- string code,
- int? productFamilyId = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/coupons/validate.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("code", code).Required())
- .Query(_query => _query.Setup("product_family_id", productFamilyId))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new SingleStringErrorResponseException(_reason, _context))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This endpoint allows you to create and/or update currency prices for an existing coupon. Multiple prices can be created or updated in a single request but each of the currencies must be defined on the site level already and the coupon must be an amount-based coupon, not percentage.
- /// Currency pricing for coupons must mirror the setup of the primary coupon pricing - if the primary coupon is percentage based, you will not be able to define pricing in non-primary currencies.
- ///
- /// Required parameter: The Chargify id of the coupon.
- /// Optional parameter: Example: .
- /// Returns the Models.CouponCurrencyResponse response from the API call.
- public Models.CouponCurrencyResponse UpdateCouponCurrencyPrices(
- int couponId,
- Models.CouponCurrencyRequest body = null)
- => CoreHelper.RunTask(UpdateCouponCurrencyPricesAsync(couponId, body));
-
- ///
- /// This endpoint allows you to create and/or update currency prices for an existing coupon. Multiple prices can be created or updated in a single request but each of the currencies must be defined on the site level already and the coupon must be an amount-based coupon, not percentage.
- /// Currency pricing for coupons must mirror the setup of the primary coupon pricing - if the primary coupon is percentage based, you will not be able to define pricing in non-primary currencies.
- ///
- /// Required parameter: The Chargify id of the coupon.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.CouponCurrencyResponse response from the API call.
- public async Task UpdateCouponCurrencyPricesAsync(
- int couponId,
- Models.CouponCurrencyRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/coupons/{coupon_id}/currency_prices.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("coupon_id", couponId))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// ## Coupon Subcodes Intro.
/// Coupon Subcodes allow you to create a set of unique codes that allow you to expand the use of one coupon.
@@ -514,6 +277,74 @@ public Models.CouponSubcodesResponse CreateCouponSubcodes(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// You can search for a coupon via the API with the find method. By passing a code parameter, the find will attempt to locate a coupon that matches that code. If no coupon is found, a 404 is returned.
+ /// 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.
+ ///
+ /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Optional parameter: The code of the coupon.
+ /// Returns the Models.CouponResponse response from the API call.
+ public Models.CouponResponse ReadCouponByCode(
+ int? productFamilyId = null,
+ string code = null)
+ => CoreHelper.RunTask(ReadCouponByCodeAsync(productFamilyId, code));
+
+ ///
+ /// You can search for a coupon via the API with the find method. By passing a code parameter, the find will attempt to locate a coupon that matches that code. If no coupon is found, a 404 is returned.
+ /// 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.
+ ///
+ /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Optional parameter: The code of the coupon.
+ /// cancellationToken.
+ /// Returns the Models.CouponResponse response from the API call.
+ public async Task ReadCouponByCodeAsync(
+ int? productFamilyId = null,
+ string code = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/coupons/find.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("product_family_id", productFamilyId))
+ .Query(_query => _query.Setup("code", code))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// You can archive a Coupon via the API with the archive method.
+ /// Archiving makes that Coupon unavailable for future use, but allows it to remain attached and functional on existing Subscriptions that are using it.
+ /// The `archived_at` date and time will be assigned.
+ ///
+ /// Required parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Required parameter: The Chargify id of the coupon.
+ /// Returns the Models.CouponResponse response from the API call.
+ public Models.CouponResponse ArchiveCoupon(
+ int productFamilyId,
+ int couponId)
+ => CoreHelper.RunTask(ArchiveCouponAsync(productFamilyId, couponId));
+
+ ///
+ /// You can archive a Coupon via the API with the archive method.
+ /// Archiving makes that Coupon unavailable for future use, but allows it to remain attached and functional on existing Subscriptions that are using it.
+ /// The `archived_at` date and time will be assigned.
+ ///
+ /// Required parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Required parameter: The Chargify id of the coupon.
+ /// cancellationToken.
+ /// Returns the Models.CouponResponse response from the API call.
+ public async Task ArchiveCouponAsync(
+ int productFamilyId,
+ int couponId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Delete, "/product_families/{product_family_id}/coupons/{coupon_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Template(_template => _template.Setup("coupon_id", couponId))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// This request allows you to request the subcodes that are attached to a coupon.
///
@@ -542,6 +373,102 @@ public Models.CouponSubcodes ListCouponSubcodes(
.Query(_query => _query.Setup("per_page", input.PerPage))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// You can retrieve the Coupon via the API with the Show method. You must identify the Coupon in this call by the ID parameter that Chargify assigns.
+ /// If instead you would like to find a Coupon using a Coupon code, see the Coupon Find method.
+ /// 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 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.
+ ///
+ /// Required parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Required parameter: The Chargify id of the coupon.
+ /// Returns the Models.CouponResponse response from the API call.
+ public Models.CouponResponse ReadCoupon(
+ int productFamilyId,
+ int couponId)
+ => CoreHelper.RunTask(ReadCouponAsync(productFamilyId, couponId));
+
+ ///
+ /// You can retrieve the Coupon via the API with the Show method. You must identify the Coupon in this call by the ID parameter that Chargify assigns.
+ /// If instead you would like to find a Coupon using a Coupon code, see the Coupon Find method.
+ /// 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 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.
+ ///
+ /// Required parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Required parameter: The Chargify id of the coupon.
+ /// cancellationToken.
+ /// Returns the Models.CouponResponse response from the API call.
+ public async Task ReadCouponAsync(
+ int productFamilyId,
+ int couponId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/product_families/{product_family_id}/coupons/{coupon_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Template(_template => _template.Setup("coupon_id", couponId))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// You can verify if a specific coupon code is valid using the `validate` method. 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.
+ /// 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.
+ /// Eg.
+ /// ```.
+ /// https://.chargify.com/product_families/handle:/coupons/validate.?code=.
+ /// ```.
+ /// Or:.
+ /// ```.
+ /// https://.chargify.com/coupons/validate.?code=&product_family_id=.
+ /// ```.
+ ///
+ /// Required parameter: The code of the coupon.
+ /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
+ /// Returns the Models.CouponResponse response from the API call.
+ public Models.CouponResponse ValidateCoupon(
+ string code,
+ int? productFamilyId = null)
+ => CoreHelper.RunTask(ValidateCouponAsync(code, productFamilyId));
+
+ ///
+ /// You can verify if a specific coupon code is valid using the `validate` method. 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.
+ /// 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.
+ /// Eg.
+ /// ```.
+ /// https://.chargify.com/product_families/handle:/coupons/validate.?code=.
+ /// ```.
+ /// Or:.
+ /// ```.
+ /// https://.chargify.com/coupons/validate.?code=&product_family_id=.
+ /// ```.
+ ///
+ /// Required parameter: The code of the coupon.
+ /// Optional parameter: The Chargify id of the product family to which the coupon belongs.
+ /// cancellationToken.
+ /// Returns the Models.CouponResponse response from the API call.
+ public async Task ValidateCouponAsync(
+ string code,
+ int? productFamilyId = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/coupons/validate.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("code", code).Required())
+ .Query(_query => _query.Setup("product_family_id", productFamilyId))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new SingleStringErrorResponseException(_reason, _context))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// You can update the subcodes for the given Coupon via the API with a PUT request to the resource endpoint.
/// Send an array of new coupon subcodes.
@@ -586,6 +513,79 @@ public Models.CouponSubcodesResponse UpdateCouponSubcodes(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// List coupons for a specific Product Family in a Site.
+ /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency.
+ ///
+ /// Object containing request parameters.
+ /// Returns the List of Models.CouponResponse response from the API call.
+ public List ListCouponsForProductFamily(
+ Models.ListCouponsForProductFamilyInput input)
+ => CoreHelper.RunTask(ListCouponsForProductFamilyAsync(input));
+
+ ///
+ /// List coupons for a specific Product Family in a Site.
+ /// If the coupon is set to `use_site_exchange_rate: true`, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the List of Models.CouponResponse response from the API call.
+ public async Task> ListCouponsForProductFamilyAsync(
+ Models.ListCouponsForProductFamilyInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall>()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/product_families/{product_family_id}/coupons.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("product_family_id", input.ProductFamilyId))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("filter[date_field]", (input.FilterDateField.HasValue) ? ApiHelper.JsonSerialize(input.FilterDateField.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[end_date]", input.FilterEndDate.HasValue ? input.FilterEndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("filter[end_datetime]", input.FilterEndDatetime.HasValue ? input.FilterEndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("filter[start_date]", input.FilterStartDate.HasValue ? input.FilterStartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("filter[start_datetime]", input.FilterStartDatetime.HasValue ? input.FilterStartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
+ .Query(_query => _query.Setup("filter[codes]", input.FilterCodes))
+ .Query(_query => _query.Setup("currency_prices", input.CurrencyPrices))
+ .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This endpoint allows you to create and/or update currency prices for an existing coupon. Multiple prices can be created or updated in a single request but each of the currencies must be defined on the site level already and the coupon must be an amount-based coupon, not percentage.
+ /// Currency pricing for coupons must mirror the setup of the primary coupon pricing - if the primary coupon is percentage based, you will not be able to define pricing in non-primary currencies.
+ ///
+ /// Required parameter: The Chargify id of the coupon.
+ /// Optional parameter: Example: .
+ /// Returns the Models.CouponCurrencyResponse response from the API call.
+ public Models.CouponCurrencyResponse UpdateCouponCurrencyPrices(
+ int couponId,
+ Models.CouponCurrencyRequest body = null)
+ => CoreHelper.RunTask(UpdateCouponCurrencyPricesAsync(couponId, body));
+
+ ///
+ /// This endpoint allows you to create and/or update currency prices for an existing coupon. Multiple prices can be created or updated in a single request but each of the currencies must be defined on the site level already and the coupon must be an amount-based coupon, not percentage.
+ /// Currency pricing for coupons must mirror the setup of the primary coupon pricing - if the primary coupon is percentage based, you will not be able to define pricing in non-primary currencies.
+ ///
+ /// Required parameter: The Chargify id of the coupon.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.CouponCurrencyResponse response from the API call.
+ public async Task UpdateCouponCurrencyPricesAsync(
+ int couponId,
+ Models.CouponCurrencyRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Put, "/coupons/{coupon_id}/currency_prices.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("coupon_id", couponId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// ## Example.
/// Given a coupon with an ID of 567, and a coupon subcode of 20OFF, the URL to `DELETE` this coupon subcode would be:.
diff --git a/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs b/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs
index c2302c4..1166e40 100644
--- a/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs
+++ b/AdvancedBilling.Standard/Controllers/CustomFieldsController.cs
@@ -18,6 +18,7 @@ namespace AdvancedBilling.Standard.Controllers
using AdvancedBilling.Standard.Http.Client;
using AdvancedBilling.Standard.Utilities;
using APIMatic.Core;
+ using APIMatic.Core.Http.Configuration;
using APIMatic.Core.Types;
using APIMatic.Core.Utilities;
using APIMatic.Core.Utilities.Date.Xml;
@@ -35,61 +36,72 @@ public class CustomFieldsController : BaseController
internal CustomFieldsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// ## Custom Fields: Metafield Intro.
- /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
- /// + **Metafield is the custom field**.
- /// + **Metadata is the data populating the custom field.**.
- /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405332553613-Custom-Fields-Reference). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404434903181-Subscription-Summary#custom-fields).
- /// Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record.
- /// ## Create Metafields.
- /// Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact.
- /// Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer.
- /// ### Metafields "On-the-Fly".
- /// It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existant name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”.
- /// ### Metafield Scope Warning.
- /// If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**.
+ /// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact.
///
/// Required parameter: the resource type to which the metafields belong.
/// Optional parameter: Example: .
/// Returns the List of Models.Metafield response from the API call.
- public List CreateMetafields(
+ public List UpdateMetafield(
Models.ResourceType resourceType,
- Models.CreateMetafieldsRequest body = null)
- => CoreHelper.RunTask(CreateMetafieldsAsync(resourceType, body));
+ Models.UpdateMetafieldsRequest body = null)
+ => CoreHelper.RunTask(UpdateMetafieldAsync(resourceType, body));
///
- /// ## Custom Fields: Metafield Intro.
- /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
- /// + **Metafield is the custom field**.
- /// + **Metadata is the data populating the custom field.**.
- /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405332553613-Custom-Fields-Reference). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404434903181-Subscription-Summary#custom-fields).
- /// Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record.
- /// ## Create Metafields.
- /// Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact.
- /// Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer.
- /// ### Metafields "On-the-Fly".
- /// It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existant name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”.
- /// ### Metafield Scope Warning.
- /// If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**.
+ /// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact.
///
/// Required parameter: the resource type to which the metafields belong.
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the List of Models.Metafield response from the API call.
- public async Task> CreateMetafieldsAsync(
+ public async Task> UpdateMetafieldAsync(
Models.ResourceType resourceType,
- Models.CreateMetafieldsRequest body = null,
+ Models.UpdateMetafieldsRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/{resource_type}/metafields.json")
+ .Setup(HttpMethod.Put, "/{resource_type}/metafields.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("resource_type", ApiHelper.JsonSerialize(resourceType).Trim('\"')))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This method allows you to update the existing metadata associated with a subscription or customer.
+ ///
+ /// Required parameter: the resource type to which the metafields belong.
+ /// Required parameter: The Chargify id of the customer or the subscription for which the metadata applies.
+ /// Optional parameter: Example: .
+ /// Returns the List of Models.Metadata response from the API call.
+ public List UpdateMetadata(
+ Models.ResourceType resourceType,
+ string resourceId,
+ Models.UpdateMetadataRequest body = null)
+ => CoreHelper.RunTask(UpdateMetadataAsync(resourceType, resourceId, body));
+
+ ///
+ /// This method allows you to update the existing metadata associated with a subscription or customer.
+ ///
+ /// Required parameter: the resource type to which the metafields belong.
+ /// Required parameter: The Chargify id of the customer or the subscription for which the metadata applies.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the List of Models.Metadata response from the API call.
+ public async Task> UpdateMetadataAsync(
+ Models.ResourceType resourceType,
+ string resourceId,
+ Models.UpdateMetadataRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall>()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Put, "/{resource_type}/{resource_id}/metadata.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("resource_type", ApiHelper.JsonSerialize(resourceType).Trim('\"')))
+ .Template(_template => _template.Setup("resource_id", resourceId).Required())
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -122,48 +134,6 @@ public Models.ListMetafieldsResponse ListMetafields(
.Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact.
- ///
- /// Required parameter: the resource type to which the metafields belong.
- /// Required parameter: Name of the custom field..
- /// Optional parameter: This only applies when you are updating an existing record and you wish to rename the field. Note you must supply name and current_name to rename the field.
- /// Optional parameter: Example: .
- /// Returns the List of Models.Metafield response from the API call.
- public List UpdateMetafield(
- Models.ResourceType resourceType,
- string name,
- string currentName = null,
- Models.UpdateMetafieldsRequest body = null)
- => CoreHelper.RunTask(UpdateMetafieldAsync(resourceType, name, currentName, body));
-
- ///
- /// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact.
- ///
- /// Required parameter: the resource type to which the metafields belong.
- /// Required parameter: Name of the custom field..
- /// Optional parameter: This only applies when you are updating an existing record and you wish to rename the field. Note you must supply name and current_name to rename the field.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the List of Models.Metafield response from the API call.
- public async Task> UpdateMetafieldAsync(
- Models.ResourceType resourceType,
- string name,
- string currentName = null,
- Models.UpdateMetafieldsRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall>()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/{resource_type}/metafields.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("resource_type", ApiHelper.JsonSerialize(resourceType).Trim('\"')))
- .Query(_query => _query.Setup("name", name).Required())
- .Header(_header => _header.Setup("Content-Type", "application/json"))
- .Query(_query => _query.Setup("current_name", currentName))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// Use the following method to delete a metafield. This will remove the metafield from the Site.
/// Additionally, this will remove the metafield and associated metadata with all Subscriptions on the Site.
@@ -198,67 +168,6 @@ public async Task DeleteMetafieldAsync(
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// ## Custom Fields: Metadata Intro.
- /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
- /// + **Metafield is the custom field**.
- /// + **Metadata is the data populating the custom field.**.
- /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407659856411). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://chargify.zendesk.com/hc/en-us/articles/4407884887835#custom-fields).
- /// Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**.
- /// ## Metadata limits.
- /// Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource.
- /// ## Create Metadata.
- /// This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value.
- /// ### Subscription or Customer Resource.
- /// Please pay special attention to the resource you use when creating metadata.
- ///
- /// Required parameter: the resource type to which the metafields belong.
- /// Required parameter: The Chargify id of the customer or the subscription for which the metadata applies.
- /// Optional parameter: Example: .
- /// Returns the List of Models.Metadata response from the API call.
- public List CreateMetadata(
- Models.ResourceType resourceType,
- string resourceId,
- Models.CreateMetadataRequest body = null)
- => CoreHelper.RunTask(CreateMetadataAsync(resourceType, resourceId, body));
-
- ///
- /// ## Custom Fields: Metadata Intro.
- /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
- /// + **Metafield is the custom field**.
- /// + **Metadata is the data populating the custom field.**.
- /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407659856411). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://chargify.zendesk.com/hc/en-us/articles/4407884887835#custom-fields).
- /// Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**.
- /// ## Metadata limits.
- /// Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource.
- /// ## Create Metadata.
- /// This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value.
- /// ### Subscription or Customer Resource.
- /// Please pay special attention to the resource you use when creating metadata.
- ///
- /// Required parameter: the resource type to which the metafields belong.
- /// Required parameter: The Chargify id of the customer or the subscription for which the metadata applies.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the List of Models.Metadata response from the API call.
- public async Task> CreateMetadataAsync(
- Models.ResourceType resourceType,
- string resourceId,
- Models.CreateMetadataRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall>()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/{resource_type}/{resource_id}/metadata.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("resource_type", ApiHelper.JsonSerialize(resourceType).Trim('\"')))
- .Template(_template => _template.Setup("resource_id", resourceId).Required())
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("Unprocessable Entity (WebDAV)", (_reason, _context) => new SingleErrorResponseException(_reason, _context))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// This request will list all of the metadata belonging to a particular resource (ie. subscription, customer) that is specified.
/// ## Metadata Data.
@@ -281,7 +190,7 @@ public Models.PaginatedMetadata ListMetadata(
public async Task ListMetadataAsync(
Models.ListMetadataInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall(ArraySerialization.Plain)
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Get, "/{resource_type}/{resource_id}/metadata.json")
.WithAuth("global")
@@ -293,40 +202,122 @@ public Models.PaginatedMetadata ListMetadata(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method allows you to update the existing metadata associated with a subscription or customer.
+ /// ## Custom Fields: Metafield Intro.
+ /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
+ /// + **Metafield is the custom field**.
+ /// + **Metadata is the data populating the custom field.**.
+ /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405332553613-Custom-Fields-Reference). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404434903181-Subscription-Summary#custom-fields).
+ /// Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record.
+ /// ## Create Metafields.
+ /// Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact.
+ /// Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer.
+ /// ### Metafields "On-the-Fly".
+ /// It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existant name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”.
+ /// ### Metafield Scope Warning.
+ /// If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**.
+ ///
+ /// Required parameter: the resource type to which the metafields belong.
+ /// Optional parameter: Example: .
+ /// Returns the List of Models.Metafield response from the API call.
+ public List CreateMetafields(
+ Models.ResourceType resourceType,
+ Models.CreateMetafieldsRequest body = null)
+ => CoreHelper.RunTask(CreateMetafieldsAsync(resourceType, body));
+
+ ///
+ /// ## Custom Fields: Metafield Intro.
+ /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
+ /// + **Metafield is the custom field**.
+ /// + **Metadata is the data populating the custom field.**.
+ /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405332553613-Custom-Fields-Reference). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404434903181-Subscription-Summary#custom-fields).
+ /// Metafield are the place where you will set up your resource to accept additional data. It is scoped to the site instead of a specific customer or subscription. Think of it as the key, and Metadata as the value on every record.
+ /// ## Create Metafields.
+ /// Use this endpoint to create metafields for your Site. Metafields can be populated with metadata after the fact.
+ /// Each site is limited to 100 unique Metafields (i.e. keys, or names) per resource. This means you can have 100 Metafields for Subscription and another 100 for Customer.
+ /// ### Metafields "On-the-Fly".
+ /// It is possible to create Metafields “on the fly” when you create your Metadata – if a non-existant name is passed when creating Metadata, a Metafield for that key will be automatically created. The Metafield API, however, gives you more control over your “keys”.
+ /// ### Metafield Scope Warning.
+ /// If configuring metafields in the Admin UI or via the API, be careful sending updates to metafields with the scope attribute – **if a partial update is sent it will overwrite the current configuration**.
+ ///
+ /// Required parameter: the resource type to which the metafields belong.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the List of Models.Metafield response from the API call.
+ public async Task> CreateMetafieldsAsync(
+ Models.ResourceType resourceType,
+ Models.CreateMetafieldsRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall>()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/{resource_type}/metafields.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("resource_type", ApiHelper.JsonSerialize(resourceType).Trim('\"')))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// ## Custom Fields: Metadata Intro.
+ /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
+ /// + **Metafield is the custom field**.
+ /// + **Metadata is the data populating the custom field.**.
+ /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407659856411). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://chargify.zendesk.com/hc/en-us/articles/4407884887835#custom-fields).
+ /// Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**.
+ /// ## Metadata limits.
+ /// Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource.
+ /// ## Create Metadata.
+ /// This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value.
+ /// ### Subscription or Customer Resource.
+ /// Please pay special attention to the resource you use when creating metadata.
///
/// Required parameter: the resource type to which the metafields belong.
/// Required parameter: The Chargify id of the customer or the subscription for which the metadata applies.
/// Optional parameter: Example: .
/// Returns the List of Models.Metadata response from the API call.
- public List UpdateMetadata(
+ public List CreateMetadata(
Models.ResourceType resourceType,
string resourceId,
- Models.UpdateMetadataRequest body = null)
- => CoreHelper.RunTask(UpdateMetadataAsync(resourceType, resourceId, body));
+ Models.CreateMetadataRequest body = null)
+ => CoreHelper.RunTask(CreateMetadataAsync(resourceType, resourceId, body));
///
- /// This method allows you to update the existing metadata associated with a subscription or customer.
+ /// ## Custom Fields: Metadata Intro.
+ /// **Chargify refers to Custom Fields in the API documentation as metafields and metadata.** Within the Chargify UI, metadata and metafields are grouped together under the umbrella of "Custom Fields." All of our UI-based documentation that references custom fields will not cite the terminology metafields or metadata.
+ /// + **Metafield is the custom field**.
+ /// + **Metadata is the data populating the custom field.**.
+ /// Chargify Metafields are used to add meaningful attributes to subscription and customer resources. Full documentation on how to create Custom Fields in the Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407659856411). For additional documentation on how to record data within custom fields, please see our subscription-based documentation [here.](https://chargify.zendesk.com/hc/en-us/articles/4407884887835#custom-fields).
+ /// Metadata is associated to a customer or subscription, and corresponds to a Metafield. When creating a new metadata object for a given record, **if the metafield is not present it will be created**.
+ /// ## Metadata limits.
+ /// Metadata values are limited to 2kB in size. Additonally, there are limits on the number of unique metafields available per resource.
+ /// ## Create Metadata.
+ /// This method will create a metafield for the site on the fly if it does not already exist, and populate the metadata value.
+ /// ### Subscription or Customer Resource.
+ /// Please pay special attention to the resource you use when creating metadata.
///
/// Required parameter: the resource type to which the metafields belong.
/// Required parameter: The Chargify id of the customer or the subscription for which the metadata applies.
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the List of Models.Metadata response from the API call.
- public async Task> UpdateMetadataAsync(
+ public async Task> CreateMetadataAsync(
Models.ResourceType resourceType,
string resourceId,
- Models.UpdateMetadataRequest body = null,
+ Models.CreateMetadataRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/{resource_type}/{resource_id}/metadata.json")
+ .Setup(HttpMethod.Post, "/{resource_type}/{resource_id}/metadata.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("resource_type", ApiHelper.JsonSerialize(resourceType).Trim('\"')))
.Template(_template => _template.Setup("resource_id", resourceId).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SingleErrorResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -384,7 +375,7 @@ public async Task DeleteMetadataAsync(
string name = null,
List names = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall(ArraySerialization.Plain)
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Delete, "/{resource_type}/{resource_id}/metadata.json")
.WithAuth("global")
diff --git a/AdvancedBilling.Standard/Controllers/CustomersController.cs b/AdvancedBilling.Standard/Controllers/CustomersController.cs
index 6b6223d..b46cf5c 100644
--- a/AdvancedBilling.Standard/Controllers/CustomersController.cs
+++ b/AdvancedBilling.Standard/Controllers/CustomersController.cs
@@ -88,116 +88,90 @@ public Models.CustomerResponse CreateCustomer(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This request will by default list all customers associated with your Site.
- /// ## Find Customer.
- /// Use the search feature with the `q` query parameter to retrieve an array of customers that matches the search query.
- /// Common use cases are:.
- /// + Search by an email.
- /// + Search by a Chargify ID.
- /// + Search by an organization.
- /// + Search by a reference value from your application.
- /// + Search by a first or last name.
- /// To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference).
+ /// This method allows to update the Customer.
///
- /// Object containing request parameters.
- /// Returns the List of Models.CustomerResponse response from the API call.
- public List ListCustomers(
- Models.ListCustomersInput input)
- => CoreHelper.RunTask(ListCustomersAsync(input));
+ /// Required parameter: The Chargify id of the customer.
+ /// Optional parameter: Example: .
+ /// Returns the Models.CustomerResponse response from the API call.
+ public Models.CustomerResponse UpdateCustomer(
+ int id,
+ Models.UpdateCustomerRequest body = null)
+ => CoreHelper.RunTask(UpdateCustomerAsync(id, body));
///
- /// This request will by default list all customers associated with your Site.
- /// ## Find Customer.
- /// Use the search feature with the `q` query parameter to retrieve an array of customers that matches the search query.
- /// Common use cases are:.
- /// + Search by an email.
- /// + Search by a Chargify ID.
- /// + Search by an organization.
- /// + Search by a reference value from your application.
- /// + Search by a first or last name.
- /// To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference).
+ /// This method allows to update the Customer.
///
- /// Object containing request parameters.
+ /// Required parameter: The Chargify id of the customer.
+ /// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the List of Models.CustomerResponse response from the API call.
- public async Task> ListCustomersAsync(
- Models.ListCustomersInput input,
+ /// Returns the Models.CustomerResponse response from the API call.
+ public async Task UpdateCustomerAsync(
+ int id,
+ Models.UpdateCustomerRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/customers.json")
+ .Setup(HttpMethod.Put, "/customers/{id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("start_date", input.StartDate))
- .Query(_query => _query.Setup("end_date", input.EndDate))
- .Query(_query => _query.Setup("start_datetime", input.StartDatetime))
- .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
- .Query(_query => _query.Setup("q", input.Q))))
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("id", id))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new CustomerErrorResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method allows to retrieve the Customer properties by Chargify-generated Customer ID.
+ /// Use this method to return the customer object if you have the unique **Reference ID (Your App)** value handy. It will return a single match.
///
- /// Required parameter: The Chargify id of the customer.
+ /// Required parameter: Customer reference.
/// Returns the Models.CustomerResponse response from the API call.
- public Models.CustomerResponse ReadCustomer(
- int id)
- => CoreHelper.RunTask(ReadCustomerAsync(id));
+ public Models.CustomerResponse ReadCustomerByReference(
+ string reference)
+ => CoreHelper.RunTask(ReadCustomerByReferenceAsync(reference));
///
- /// This method allows to retrieve the Customer properties by Chargify-generated Customer ID.
+ /// Use this method to return the customer object if you have the unique **Reference ID (Your App)** value handy. It will return a single match.
///
- /// Required parameter: The Chargify id of the customer.
+ /// Required parameter: Customer reference.
/// cancellationToken.
/// Returns the Models.CustomerResponse response from the API call.
- public async Task ReadCustomerAsync(
- int id,
+ public async Task ReadCustomerByReferenceAsync(
+ string reference,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/customers/{id}.json")
+ .Setup(HttpMethod.Get, "/customers/lookup.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("id", id))))
+ .Query(_query => _query.Setup("reference", reference).Required())))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method allows to update the Customer.
+ /// This method allows to retrieve the Customer properties by Chargify-generated Customer ID.
///
/// Required parameter: The Chargify id of the customer.
- /// Optional parameter: Example: .
/// Returns the Models.CustomerResponse response from the API call.
- public Models.CustomerResponse UpdateCustomer(
- int id,
- Models.UpdateCustomerRequest body = null)
- => CoreHelper.RunTask(UpdateCustomerAsync(id, body));
+ public Models.CustomerResponse ReadCustomer(
+ int id)
+ => CoreHelper.RunTask(ReadCustomerAsync(id));
///
- /// This method allows to update the Customer.
+ /// This method allows to retrieve the Customer properties by Chargify-generated Customer ID.
///
/// Required parameter: The Chargify id of the customer.
- /// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.CustomerResponse response from the API call.
- public async Task UpdateCustomerAsync(
+ public async Task ReadCustomerAsync(
int id,
- Models.UpdateCustomerRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/customers/{id}.json")
+ .Setup(HttpMethod.Get, "/customers/{id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("id", id))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new CustomerErrorResponseException(_reason, _context), true)))
+ .Template(_template => _template.Setup("id", id))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -226,29 +200,55 @@ public async Task DeleteCustomerAsync(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Use this method to return the customer object if you have the unique **Reference ID (Your App)** value handy. It will return a single match.
+ /// This request will by default list all customers associated with your Site.
+ /// ## Find Customer.
+ /// Use the search feature with the `q` query parameter to retrieve an array of customers that matches the search query.
+ /// Common use cases are:.
+ /// + Search by an email.
+ /// + Search by a Chargify ID.
+ /// + Search by an organization.
+ /// + Search by a reference value from your application.
+ /// + Search by a first or last name.
+ /// To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference).
///
- /// Required parameter: Customer reference.
- /// Returns the Models.CustomerResponse response from the API call.
- public Models.CustomerResponse ReadCustomerByReference(
- string reference)
- => CoreHelper.RunTask(ReadCustomerByReferenceAsync(reference));
+ /// Object containing request parameters.
+ /// Returns the List of Models.CustomerResponse response from the API call.
+ public List ListCustomers(
+ Models.ListCustomersInput input)
+ => CoreHelper.RunTask(ListCustomersAsync(input));
///
- /// Use this method to return the customer object if you have the unique **Reference ID (Your App)** value handy. It will return a single match.
+ /// This request will by default list all customers associated with your Site.
+ /// ## Find Customer.
+ /// Use the search feature with the `q` query parameter to retrieve an array of customers that matches the search query.
+ /// Common use cases are:.
+ /// + Search by an email.
+ /// + Search by a Chargify ID.
+ /// + Search by an organization.
+ /// + Search by a reference value from your application.
+ /// + Search by a first or last name.
+ /// To retrieve a single, exact match by reference, please use the [lookup endpoint](https://developers.chargify.com/docs/api-docs/b710d8fbef104-read-customer-by-reference).
///
- /// Required parameter: Customer reference.
+ /// Object containing request parameters.
/// cancellationToken.
- /// Returns the Models.CustomerResponse response from the API call.
- public async Task ReadCustomerByReferenceAsync(
- string reference,
+ /// Returns the List of Models.CustomerResponse response from the API call.
+ public async Task> ListCustomersAsync(
+ Models.ListCustomersInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/customers/lookup.json")
+ .Setup(HttpMethod.Get, "/customers.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("reference", reference).Required())))
+ .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("start_date", input.StartDate))
+ .Query(_query => _query.Setup("end_date", input.EndDate))
+ .Query(_query => _query.Setup("start_datetime", input.StartDatetime))
+ .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
+ .Query(_query => _query.Setup("q", input.Q))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
diff --git a/AdvancedBilling.Standard/Controllers/EventsBasedBillingSegmentsController.cs b/AdvancedBilling.Standard/Controllers/EventsBasedBillingSegmentsController.cs
index d401309..7724a52 100644
--- a/AdvancedBilling.Standard/Controllers/EventsBasedBillingSegmentsController.cs
+++ b/AdvancedBilling.Standard/Controllers/EventsBasedBillingSegmentsController.cs
@@ -34,48 +34,6 @@ public class EventsBasedBillingSegmentsController : BaseController
///
internal EventsBasedBillingSegmentsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
- ///
- /// This endpoint creates a new Segment for a Component with segmented Metric. It allows you to specify properties to bill upon and prices for each Segment. You can only pass as many "property_values" as the related Metric has segmenting properties defined.
- /// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
- ///
- /// Required parameter: ID or Handle for the Component.
- /// Required parameter: ID or Handle for the Price Point belonging to the Component.
- /// Optional parameter: Example: .
- /// Returns the Models.SegmentResponse response from the API call.
- public Models.SegmentResponse CreateSegment(
- string componentId,
- string pricePointId,
- Models.CreateSegmentRequest body = null)
- => CoreHelper.RunTask(CreateSegmentAsync(componentId, pricePointId, body));
-
- ///
- /// This endpoint creates a new Segment for a Component with segmented Metric. It allows you to specify properties to bill upon and prices for each Segment. You can only pass as many "property_values" as the related Metric has segmenting properties defined.
- /// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
- ///
- /// Required parameter: ID or Handle for the Component.
- /// Required parameter: ID or Handle for the Price Point belonging to the Component.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.SegmentResponse response from the API call.
- public async Task CreateSegmentAsync(
- string componentId,
- string pricePointId,
- Models.CreateSegmentRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/components/{component_id}/price_points/{price_point_id}/segments.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("component_id", componentId).Required())
- .Template(_template => _template.Setup("price_point_id", pricePointId).Required())
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new EventBasedBillingSegmentErrorsException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// This endpoint allows you to fetch Segments created for a given Price Point. They will be returned in the order of creation.
/// You can pass `page` and `per_page` parameters in order to access all of the segments. By default it will return `30` records. You can set `per_page` to `200` at most.
@@ -116,6 +74,46 @@ public Models.ListSegmentsResponse ListSegmentsForPricePoint(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new EventBasedBillingListSegmentsErrorsException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// This endpoint allows you to delete a Segment with specified ID.
+ /// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
+ ///
+ /// Required parameter: ID or Handle of the Component.
+ /// Required parameter: ID or Handle of the Price Point belonging to the Component.
+ /// Required parameter: The ID of the Segment.
+ public void DeleteSegment(
+ string componentId,
+ string pricePointId,
+ double id)
+ => CoreHelper.RunVoidTask(DeleteSegmentAsync(componentId, pricePointId, id));
+
+ ///
+ /// This endpoint allows you to delete a Segment with specified ID.
+ /// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
+ ///
+ /// Required parameter: ID or Handle of the Component.
+ /// Required parameter: ID or Handle of the Price Point belonging to the Component.
+ /// Required parameter: The ID of the Segment.
+ /// cancellationToken.
+ /// Returns the void response from the API call.
+ public async Task DeleteSegmentAsync(
+ string componentId,
+ string pricePointId,
+ double id,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Delete, "/components/{component_id}/price_points/{price_point_id}/segments/{id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("component_id", componentId).Required())
+ .Template(_template => _template.Setup("price_point_id", pricePointId).Required())
+ .Template(_template => _template.Setup("id", id))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ApiException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// This endpoint updates a single Segment for a Component with a segmented Metric. It allows you to 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.
@@ -164,78 +162,80 @@ public Models.SegmentResponse UpdateSegment(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint allows you to delete a Segment with specified ID.
+ /// This endpoint allows you to update multiple segments in one request. The array of segments can contain up to `1000` records.
+ /// If any of the records contain an error the whole request would fail and none of the requested segments get updated. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
/// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
///
- /// Required parameter: ID or Handle of the Component.
- /// Required parameter: ID or Handle of the Price Point belonging to the Component.
- /// Required parameter: The ID of the Segment.
- public void DeleteSegment(
+ /// Required parameter: ID or Handle for the Component.
+ /// Required parameter: ID or Handle for the Price Point belonging to the Component.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ListSegmentsResponse response from the API call.
+ public Models.ListSegmentsResponse UpdateSegments(
string componentId,
string pricePointId,
- double id)
- => CoreHelper.RunVoidTask(DeleteSegmentAsync(componentId, pricePointId, id));
+ Models.BulkUpdateSegments body = null)
+ => CoreHelper.RunTask(UpdateSegmentsAsync(componentId, pricePointId, body));
///
- /// This endpoint allows you to delete a Segment with specified ID.
+ /// This endpoint allows you to update multiple segments in one request. The array of segments can contain up to `1000` records.
+ /// If any of the records contain an error the whole request would fail and none of the requested segments get updated. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
/// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
///
- /// Required parameter: ID or Handle of the Component.
- /// Required parameter: ID or Handle of the Price Point belonging to the Component.
- /// Required parameter: The ID of the Segment.
+ /// Required parameter: ID or Handle for the Component.
+ /// Required parameter: ID or Handle for the Price Point belonging to the Component.
+ /// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the void response from the API call.
- public async Task DeleteSegmentAsync(
+ /// Returns the Models.ListSegmentsResponse response from the API call.
+ public async Task UpdateSegmentsAsync(
string componentId,
string pricePointId,
- double id,
+ Models.BulkUpdateSegments body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/components/{component_id}/price_points/{price_point_id}/segments/{id}.json")
+ .Setup(HttpMethod.Put, "/components/{component_id}/price_points/{price_point_id}/segments/bulk.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("component_id", componentId).Required())
.Template(_template => _template.Setup("price_point_id", pricePointId).Required())
- .Template(_template => _template.Setup("id", id))))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ApiException(_reason, _context), true)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new EventBasedBillingSegmentException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint allows you to create multiple segments in one request. The array of segments can contain up to `2000` records.
- /// If any of the records contain an error the whole request would fail and none of the requested segments get created. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
+ /// This endpoint creates a new Segment for a Component with segmented Metric. It allows you to specify properties to bill upon and prices for each Segment. You can only pass as many "property_values" as the related Metric has segmenting properties defined.
/// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
///
/// Required parameter: ID or Handle for the Component.
/// Required parameter: ID or Handle for the Price Point belonging to the Component.
/// Optional parameter: Example: .
- /// Returns the Models.ListSegmentsResponse response from the API call.
- public Models.ListSegmentsResponse CreateSegments(
+ /// Returns the Models.SegmentResponse response from the API call.
+ public Models.SegmentResponse CreateSegment(
string componentId,
string pricePointId,
- Models.BulkCreateSegments body = null)
- => CoreHelper.RunTask(CreateSegmentsAsync(componentId, pricePointId, body));
+ Models.CreateSegmentRequest body = null)
+ => CoreHelper.RunTask(CreateSegmentAsync(componentId, pricePointId, body));
///
- /// This endpoint allows you to create multiple segments in one request. The array of segments can contain up to `2000` records.
- /// If any of the records contain an error the whole request would fail and none of the requested segments get created. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
+ /// This endpoint creates a new Segment for a Component with segmented Metric. It allows you to specify properties to bill upon and prices for each Segment. You can only pass as many "property_values" as the related Metric has segmenting properties defined.
/// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
///
/// Required parameter: ID or Handle for the Component.
/// Required parameter: ID or Handle for the Price Point belonging to the Component.
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the Models.ListSegmentsResponse response from the API call.
- public async Task CreateSegmentsAsync(
+ /// Returns the Models.SegmentResponse response from the API call.
+ public async Task CreateSegmentAsync(
string componentId,
string pricePointId,
- Models.BulkCreateSegments body = null,
+ Models.CreateSegmentRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/components/{component_id}/price_points/{price_point_id}/segments/bulk.json")
+ .Setup(HttpMethod.Post, "/components/{component_id}/price_points/{price_point_id}/segments.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
@@ -244,27 +244,27 @@ public Models.ListSegmentsResponse CreateSegments(
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new EventBasedBillingSegmentException(_reason, _context), true)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new EventBasedBillingSegmentErrorsException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint allows you to update multiple segments in one request. The array of segments can contain up to `1000` records.
- /// If any of the records contain an error the whole request would fail and none of the requested segments get updated. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
+ /// This endpoint allows you to create multiple segments in one request. The array of segments can contain up to `2000` records.
+ /// If any of the records contain an error the whole request would fail and none of the requested segments get created. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
/// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
///
/// Required parameter: ID or Handle for the Component.
/// Required parameter: ID or Handle for the Price Point belonging to the Component.
/// Optional parameter: Example: .
/// Returns the Models.ListSegmentsResponse response from the API call.
- public Models.ListSegmentsResponse UpdateSegments(
+ public Models.ListSegmentsResponse CreateSegments(
string componentId,
string pricePointId,
- Models.BulkUpdateSegments body = null)
- => CoreHelper.RunTask(UpdateSegmentsAsync(componentId, pricePointId, body));
+ Models.BulkCreateSegments body = null)
+ => CoreHelper.RunTask(CreateSegmentsAsync(componentId, pricePointId, body));
///
- /// This endpoint allows you to update multiple segments in one request. The array of segments can contain up to `1000` records.
- /// If any of the records contain an error the whole request would fail and none of the requested segments get updated. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
+ /// This endpoint allows you to create multiple segments in one request. The array of segments can contain up to `2000` records.
+ /// If any of the records contain an error the whole request would fail and none of the requested segments get created. The error response contains a message for only the one segment that failed validation, with the corresponding index in the array.
/// You may specify component and/or price point by using either the numeric ID or the `handle:gold` syntax.
///
/// Required parameter: ID or Handle for the Component.
@@ -272,14 +272,14 @@ public Models.ListSegmentsResponse UpdateSegments(
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ListSegmentsResponse response from the API call.
- public async Task UpdateSegmentsAsync(
+ public async Task CreateSegmentsAsync(
string componentId,
string pricePointId,
- Models.BulkUpdateSegments body = null,
+ Models.BulkCreateSegments body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/components/{component_id}/price_points/{price_point_id}/segments/bulk.json")
+ .Setup(HttpMethod.Post, "/components/{component_id}/price_points/{price_point_id}/segments/bulk.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
diff --git a/AdvancedBilling.Standard/Controllers/InsightsController.cs b/AdvancedBilling.Standard/Controllers/InsightsController.cs
index f42bd5f..5c01af3 100644
--- a/AdvancedBilling.Standard/Controllers/InsightsController.cs
+++ b/AdvancedBilling.Standard/Controllers/InsightsController.cs
@@ -63,6 +63,40 @@ public Models.SiteSummary ReadSiteStats()
.WithAuth("global"))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// This endpoint returns your site's current MRR, including plan and usage breakouts split per subscription.
+ ///
+ /// Object containing request parameters.
+ /// Returns the Models.SubscriptionMRRResponse response from the API call.
+ [Obsolete]
+ public Models.SubscriptionMRRResponse ListMrrPerSubscription(
+ Models.ListMrrPerSubscriptionInput input)
+ => CoreHelper.RunTask(ListMrrPerSubscriptionAsync(input));
+
+ ///
+ /// This endpoint returns your site's current MRR, including plan and usage breakouts split per subscription.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the Models.SubscriptionMRRResponse response from the API call.
+ [Obsolete]
+ public async Task ListMrrPerSubscriptionAsync(
+ Models.ListMrrPerSubscriptionInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/subscriptions_mrr.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("filter[subscription_ids]", input.FilterSubscriptionIds))
+ .Query(_query => _query.Setup("at_time", input.AtTime))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("400", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SubscriptionsMrrErrorResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// This endpoint returns your site's current MRR, including plan and usage breakouts.
///
@@ -152,39 +186,5 @@ public Models.ListMRRResponse ReadMrrMovements(
.Query(_query => _query.Setup("per_page", input.PerPage))
.Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This endpoint returns your site's current MRR, including plan and usage breakouts split per subscription.
- ///
- /// Object containing request parameters.
- /// Returns the Models.SubscriptionMRRResponse response from the API call.
- [Obsolete]
- public Models.SubscriptionMRRResponse ListMrrPerSubscription(
- Models.ListMrrPerSubscriptionInput input)
- => CoreHelper.RunTask(ListMrrPerSubscriptionAsync(input));
-
- ///
- /// This endpoint returns your site's current MRR, including plan and usage breakouts split per subscription.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the Models.SubscriptionMRRResponse response from the API call.
- [Obsolete]
- public async Task ListMrrPerSubscriptionAsync(
- Models.ListMrrPerSubscriptionInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/subscriptions_mrr.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("filter[subscription_ids]", input.FilterSubscriptionIds))
- .Query(_query => _query.Setup("at_time", input.AtTime))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("400", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new SubscriptionsMrrErrorResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/InvoicesController.cs b/AdvancedBilling.Standard/Controllers/InvoicesController.cs
index d189076..898ab20 100644
--- a/AdvancedBilling.Standard/Controllers/InvoicesController.cs
+++ b/AdvancedBilling.Standard/Controllers/InvoicesController.cs
@@ -70,147 +70,43 @@ public Models.Invoice RefundInvoice(
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("uid", uid).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// 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`.
+ /// 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`.
///
/// Object containing request parameters.
- /// Returns the Models.ListInvoicesResponse response from the API call.
- public Models.ListInvoicesResponse ListInvoices(
- Models.ListInvoicesInput input)
- => CoreHelper.RunTask(ListInvoicesAsync(input));
+ /// Returns the Models.ListCreditNotesResponse response from the API call.
+ public Models.ListCreditNotesResponse ListCreditNotes(
+ Models.ListCreditNotesInput input)
+ => CoreHelper.RunTask(ListCreditNotesAsync(input));
///
- /// 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`.
+ /// 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`.
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the Models.ListInvoicesResponse response from the API call.
- public async Task ListInvoicesAsync(
- Models.ListInvoicesInput input,
+ /// Returns the Models.ListCreditNotesResponse response from the API call.
+ public async Task ListCreditNotesAsync(
+ Models.ListCreditNotesInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/invoices.json")
+ .Setup(HttpMethod.Get, "/credit_notes.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("start_date", input.StartDate))
- .Query(_query => _query.Setup("end_date", input.EndDate))
- .Query(_query => _query.Setup("status", (input.Status.HasValue) ? ApiHelper.JsonSerialize(input.Status.Value).Trim('\"') : null))
.Query(_query => _query.Setup("subscription_id", input.SubscriptionId))
- .Query(_query => _query.Setup("subscription_group_uid", input.SubscriptionGroupUid))
.Query(_query => _query.Setup("page", input.Page))
.Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : "desc"))
.Query(_query => _query.Setup("line_items", input.LineItems))
.Query(_query => _query.Setup("discounts", input.Discounts))
.Query(_query => _query.Setup("taxes", input.Taxes))
- .Query(_query => _query.Setup("credits", input.Credits))
- .Query(_query => _query.Setup("payments", input.Payments))
- .Query(_query => _query.Setup("custom_fields", input.CustomFields))
.Query(_query => _query.Setup("refunds", input.Refunds))
- .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : "due_date"))
- .Query(_query => _query.Setup("start_datetime", input.StartDatetime))
- .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
- .Query(_query => _query.Setup("customer_ids", input.CustomerIds))
- .Query(_query => _query.Setup("number", input.Number))
- .Query(_query => _query.Setup("product_ids", input.ProductIds))
- .Query(_query => _query.Setup("sort", (input.Sort.HasValue) ? ApiHelper.JsonSerialize(input.Sort.Value).Trim('\"') : "number"))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// Use this endpoint to retrieve the details for an invoice.
- ///
- /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
- /// Returns the Models.Invoice response from the API call.
- public Models.Invoice ReadInvoice(
- string uid)
- => CoreHelper.RunTask(ReadInvoiceAsync(uid));
-
- ///
- /// Use this endpoint to retrieve the details for an invoice.
- ///
- /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
- /// cancellationToken.
- /// Returns the Models.Invoice response from the API call.
- public async Task ReadInvoiceAsync(
- string uid,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/invoices/{uid}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("uid", uid).Required())))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// 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.
- /// Exposed event types are:.
- /// + issue_invoice.
- /// + apply_credit_note.
- /// + apply_payment.
- /// + refund_invoice.
- /// + void_invoice.
- /// + void_remainder.
- /// + backport_invoice.
- /// + change_invoice_status.
- /// + change_invoice_collection_method.
- /// + remove_payment.
- /// + failed_payment.
- /// + apply_debit_note.
- /// + create_debit_note.
- /// + change_chargeback_status.
- /// Invoice events are returned in ascending order.
- /// If both a `since_date` and `since_id` are provided in request parameters, the `since_date` will be used.
- /// Note - invoice events that occurred prior to 09/05/2018 __will not__ contain an `invoice` snapshot.
- ///
- /// Object containing request parameters.
- /// Returns the Models.ListInvoiceEventsResponse response from the API call.
- public Models.ListInvoiceEventsResponse ListInvoiceEvents(
- Models.ListInvoiceEventsInput input)
- => CoreHelper.RunTask(ListInvoiceEventsAsync(input));
-
- ///
- /// 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.
- /// Exposed event types are:.
- /// + issue_invoice.
- /// + apply_credit_note.
- /// + apply_payment.
- /// + refund_invoice.
- /// + void_invoice.
- /// + void_remainder.
- /// + backport_invoice.
- /// + change_invoice_status.
- /// + change_invoice_collection_method.
- /// + remove_payment.
- /// + failed_payment.
- /// + apply_debit_note.
- /// + create_debit_note.
- /// + change_chargeback_status.
- /// Invoice events are returned in ascending order.
- /// If both a `since_date` and `since_id` are provided in request parameters, the `since_date` will be used.
- /// Note - invoice events that occurred prior to 09/05/2018 __will not__ contain an `invoice` snapshot.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the Models.ListInvoiceEventsResponse response from the API call.
- public async Task ListInvoiceEventsAsync(
- Models.ListInvoiceEventsInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/invoices/events.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("since_date", input.SinceDate))
- .Query(_query => _query.Setup("since_id", input.SinceId))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("invoice_uid", input.InvoiceUid))
- .Query(_query => _query.Setup("with_change_invoice_status", input.WithChangeInvoiceStatus))
- .Query(_query => _query.Setup("event_types", input.EventTypes?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
+ .Query(_query => _query.Setup("applications", input.Applications))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -385,145 +281,144 @@ public Models.MultiInvoicePaymentResponse RecordExternalPaymentForInvoices(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// 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`.
+ /// 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`.
///
/// Object containing request parameters.
- /// Returns the Models.ListCreditNotesResponse response from the API call.
- public Models.ListCreditNotesResponse ListCreditNotes(
- Models.ListCreditNotesInput input)
- => CoreHelper.RunTask(ListCreditNotesAsync(input));
+ /// Returns the Models.ListInvoicesResponse response from the API call.
+ public Models.ListInvoicesResponse ListInvoices(
+ Models.ListInvoicesInput input)
+ => CoreHelper.RunTask(ListInvoicesAsync(input));
///
- /// 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`.
+ /// 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`.
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the Models.ListCreditNotesResponse response from the API call.
- public async Task ListCreditNotesAsync(
- Models.ListCreditNotesInput input,
+ /// Returns the Models.ListInvoicesResponse response from the API call.
+ public async Task ListInvoicesAsync(
+ Models.ListInvoicesInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/credit_notes.json")
+ .Setup(HttpMethod.Get, "/invoices.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("start_date", input.StartDate))
+ .Query(_query => _query.Setup("end_date", input.EndDate))
+ .Query(_query => _query.Setup("status", (input.Status.HasValue) ? ApiHelper.JsonSerialize(input.Status.Value).Trim('\"') : null))
.Query(_query => _query.Setup("subscription_id", input.SubscriptionId))
+ .Query(_query => _query.Setup("subscription_group_uid", input.SubscriptionGroupUid))
.Query(_query => _query.Setup("page", input.Page))
.Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : "desc"))
.Query(_query => _query.Setup("line_items", input.LineItems))
.Query(_query => _query.Setup("discounts", input.Discounts))
.Query(_query => _query.Setup("taxes", input.Taxes))
+ .Query(_query => _query.Setup("credits", input.Credits))
+ .Query(_query => _query.Setup("payments", input.Payments))
+ .Query(_query => _query.Setup("custom_fields", input.CustomFields))
.Query(_query => _query.Setup("refunds", input.Refunds))
- .Query(_query => _query.Setup("applications", input.Applications))))
+ .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : "due_date"))
+ .Query(_query => _query.Setup("start_datetime", input.StartDatetime))
+ .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
+ .Query(_query => _query.Setup("customer_ids", input.CustomerIds))
+ .Query(_query => _query.Setup("number", input.Number))
+ .Query(_query => _query.Setup("product_ids", input.ProductIds))
+ .Query(_query => _query.Setup("sort", (input.Sort.HasValue) ? ApiHelper.JsonSerialize(input.Sort.Value).Trim('\"') : "number"))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Use this endpoint to retrieve the details for a credit note.
+ /// Use this endpoint to retrieve the details for an invoice.
///
- /// Required parameter: The unique identifier of the credit note.
- /// Returns the Models.CreditNote response from the API call.
- public Models.CreditNote ReadCreditNote(
+ /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
+ /// Returns the Models.Invoice response from the API call.
+ public Models.Invoice ReadInvoice(
string uid)
- => CoreHelper.RunTask(ReadCreditNoteAsync(uid));
+ => CoreHelper.RunTask(ReadInvoiceAsync(uid));
///
- /// Use this endpoint to retrieve the details for a credit note.
+ /// Use this endpoint to retrieve the details for an invoice.
///
- /// Required parameter: The unique identifier of the credit note.
+ /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
/// cancellationToken.
- /// Returns the Models.CreditNote response from the API call.
- public async Task ReadCreditNoteAsync(
+ /// Returns the Models.Invoice response from the API call.
+ public async Task ReadInvoiceAsync(
string uid,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/credit_notes/{uid}.json")
+ .Setup(HttpMethod.Get, "/invoices/{uid}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("uid", uid).Required())))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Record 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.
- /// Excess payment will result in the creation of a prepayment on the Invoice Account.
- /// Only ungrouped or primary subscriptions may be paid using the "bulk" payment request.
- ///
- /// Required parameter: The Chargify id of the subscription.
- /// Optional parameter: Example: .
- /// Returns the Models.PaymentResponse response from the API call.
- public Models.PaymentResponse RecordPaymentForSubscription(
- int subscriptionId,
- Models.RecordPaymentRequest body = null)
- => CoreHelper.RunTask(RecordPaymentForSubscriptionAsync(subscriptionId, body));
-
- ///
- /// Record 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.
- /// Excess payment will result in the creation of a prepayment on the Invoice Account.
- /// Only ungrouped or primary subscriptions may be paid using the "bulk" payment request.
- ///
- /// Required parameter: The Chargify id of the subscription.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.PaymentResponse response from the API call.
- public async Task RecordPaymentForSubscriptionAsync(
- int subscriptionId,
- Models.RecordPaymentRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/payments.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("subscription_id", subscriptionId))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// 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).
- /// 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:.
- /// - Reactivating the subscription, which will capture all open invoices (See note below about automatic reopening of invoices.).
- /// - Recording a payment directly against the invoice.
- /// A note about reactivations: any canceled invoices from the most recent active period are automatically opened as a part of the reactivation process. Reactivating via this endpoint prior to reactivation is only necessary when you wish to capture older invoices from previous periods during the reactivation.
- /// ### Reopening Consolidated Invoices.
- /// When reopening a consolidated invoice, all of its canceled segments will also be reopened.
+ /// 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.
+ /// Exposed event types are:.
+ /// + issue_invoice.
+ /// + apply_credit_note.
+ /// + apply_payment.
+ /// + refund_invoice.
+ /// + void_invoice.
+ /// + void_remainder.
+ /// + backport_invoice.
+ /// + change_invoice_status.
+ /// + change_invoice_collection_method.
+ /// + remove_payment.
+ /// + failed_payment.
+ /// + apply_debit_note.
+ /// + create_debit_note.
+ /// + change_chargeback_status.
+ /// Invoice events are returned in ascending order.
+ /// If both a `since_date` and `since_id` are provided in request parameters, the `since_date` will be used.
+ /// Note - invoice events that occurred prior to 09/05/2018 __will not__ contain an `invoice` snapshot.
///
- /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
- /// Returns the Models.Invoice response from the API call.
- public Models.Invoice ReopenInvoice(
- string uid)
- => CoreHelper.RunTask(ReopenInvoiceAsync(uid));
+ /// Object containing request parameters.
+ /// Returns the Models.ListInvoiceEventsResponse response from the API call.
+ public Models.ListInvoiceEventsResponse ListInvoiceEvents(
+ Models.ListInvoiceEventsInput input)
+ => CoreHelper.RunTask(ListInvoiceEventsAsync(input));
///
- /// 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).
- /// 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:.
- /// - Reactivating the subscription, which will capture all open invoices (See note below about automatic reopening of invoices.).
- /// - Recording a payment directly against the invoice.
- /// A note about reactivations: any canceled invoices from the most recent active period are automatically opened as a part of the reactivation process. Reactivating via this endpoint prior to reactivation is only necessary when you wish to capture older invoices from previous periods during the reactivation.
- /// ### Reopening Consolidated Invoices.
- /// When reopening a consolidated invoice, all of its canceled segments will also be reopened.
+ /// 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.
+ /// Exposed event types are:.
+ /// + issue_invoice.
+ /// + apply_credit_note.
+ /// + apply_payment.
+ /// + refund_invoice.
+ /// + void_invoice.
+ /// + void_remainder.
+ /// + backport_invoice.
+ /// + change_invoice_status.
+ /// + change_invoice_collection_method.
+ /// + remove_payment.
+ /// + failed_payment.
+ /// + apply_debit_note.
+ /// + create_debit_note.
+ /// + change_chargeback_status.
+ /// Invoice events are returned in ascending order.
+ /// If both a `since_date` and `since_id` are provided in request parameters, the `since_date` will be used.
+ /// Note - invoice events that occurred prior to 09/05/2018 __will not__ contain an `invoice` snapshot.
///
- /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
+ /// Object containing request parameters.
/// cancellationToken.
- /// Returns the Models.Invoice response from the API call.
- public async Task ReopenInvoiceAsync(
- string uid,
+ /// Returns the Models.ListInvoiceEventsResponse response from the API call.
+ public async Task ListInvoiceEventsAsync(
+ Models.ListInvoiceEventsInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/invoices/{uid}/reopen.json")
+ .Setup(HttpMethod.Get, "/invoices/events.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("uid", uid).Required())))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .Query(_query => _query.Setup("since_date", input.SinceDate))
+ .Query(_query => _query.Setup("since_id", input.SinceId))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("invoice_uid", input.InvoiceUid))
+ .Query(_query => _query.Setup("with_change_invoice_status", input.WithChangeInvoiceStatus))
+ .Query(_query => _query.Setup("event_types", input.EventTypes?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -561,6 +456,37 @@ public Models.Invoice VoidInvoice(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// Customer information may change after an invoice is issued which may lead to a mismatch between customer information that are present on an open invoice and actual customer information. This endpoint allows to preview these differences, if any.
+ /// The endpoint doesn't accept a request body. Customer information differences are calculated on the application side.
+ ///
+ /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
+ /// Returns the Models.CustomerChangesPreviewResponse response from the API call.
+ public Models.CustomerChangesPreviewResponse PreviewCustomerInformationChanges(
+ string uid)
+ => CoreHelper.RunTask(PreviewCustomerInformationChangesAsync(uid));
+
+ ///
+ /// Customer information may change after an invoice is issued which may lead to a mismatch between customer information that are present on an open invoice and actual customer information. This endpoint allows to preview these differences, if any.
+ /// The endpoint doesn't accept a request body. Customer information differences are calculated on the application side.
+ ///
+ /// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
+ /// cancellationToken.
+ /// Returns the Models.CustomerChangesPreviewResponse response from the API call.
+ public async Task PreviewCustomerInformationChangesAsync(
+ string uid,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/invoices/{uid}/customer_information/preview.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("uid", uid).Required())))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ErrorListResponseException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// Invoice segments returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, or `custom_fields`.
///
@@ -841,74 +767,160 @@ public Models.InvoiceResponse CreateInvoice(
.Template(_template => _template.Setup("subscription_id", subscriptionId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new NestedErrorResponseException(_reason, _context), true)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients.
- /// Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address.
- /// On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned.
+ /// This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option.
+ /// You cannot issue a pending child invoice that was created for a member subscription in a group.
+ /// For Remittance subscriptions, the invoice will go into "open" status and payment won't be attempted. The value for `on_failed_payment` would be rejected if sent. Any prepayments or service credits that exist on subscription will be automatically applied. Additionally, if setting is on, an email will be sent for issued invoice.
+ /// For Automatic subscriptions, prepayments and service credits will apply to the invoice and before payment is attempted. On successful payment, the invoice will go into "paid" status and email will be sent to the customer (if setting applies). When payment fails, the next event depends on the `on_failed_payment` value:.
+ /// - `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).
///
/// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
/// Optional parameter: Example: .
- public void SendInvoice(
+ /// Returns the Models.Invoice response from the API call.
+ public Models.Invoice IssueInvoice(
string uid,
- Models.SendInvoiceRequest body = null)
- => CoreHelper.RunVoidTask(SendInvoiceAsync(uid, body));
+ Models.IssueInvoiceRequest body = null)
+ => CoreHelper.RunTask(IssueInvoiceAsync(uid, 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.
- /// Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address.
- /// On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned.
+ /// This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option.
+ /// You cannot issue a pending child invoice that was created for a member subscription in a group.
+ /// For Remittance subscriptions, the invoice will go into "open" status and payment won't be attempted. The value for `on_failed_payment` would be rejected if sent. Any prepayments or service credits that exist on subscription will be automatically applied. Additionally, if setting is on, an email will be sent for issued invoice.
+ /// For Automatic subscriptions, prepayments and service credits will apply to the invoice and before payment is attempted. On successful payment, the invoice will go into "paid" status and email will be sent to the customer (if setting applies). When payment fails, the next event depends on the `on_failed_payment` value:.
+ /// - `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).
///
/// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the void response from the API call.
- public async Task SendInvoiceAsync(
+ /// Returns the Models.Invoice response from the API call.
+ public async Task IssueInvoiceAsync(
string uid,
- Models.SendInvoiceRequest body = null,
+ Models.IssueInvoiceRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/invoices/{uid}/deliveries.json")
+ .Setup(HttpMethod.Post, "/invoices/{uid}/issue.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("uid", uid).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Customer information may change after an invoice is issued which may lead to a mismatch between customer information that are present on an open invoice and actual customer information. This endpoint allows to preview these differences, if any.
- /// The endpoint doesn't accept a request body. Customer information differences are calculated on the application side.
+ /// Use this endpoint to retrieve the details for a credit note.
+ ///
+ /// Required parameter: The unique identifier of the credit note.
+ /// Returns the Models.CreditNote response from the API call.
+ public Models.CreditNote ReadCreditNote(
+ string uid)
+ => CoreHelper.RunTask(ReadCreditNoteAsync(uid));
+
+ ///
+ /// Use this endpoint to retrieve the details for a credit note.
+ ///
+ /// Required parameter: The unique identifier of the credit note.
+ /// cancellationToken.
+ /// Returns the Models.CreditNote response from the API call.
+ public async Task ReadCreditNoteAsync(
+ string uid,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/credit_notes/{uid}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("uid", uid).Required())))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// Record 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.
+ /// Excess payment will result in the creation of a prepayment on the Invoice Account.
+ /// Only ungrouped or primary subscriptions may be paid using the "bulk" payment request.
+ ///
+ /// Required parameter: The Chargify id of the subscription.
+ /// Optional parameter: Example: .
+ /// Returns the Models.PaymentResponse response from the API call.
+ public Models.PaymentResponse RecordPaymentForSubscription(
+ int subscriptionId,
+ Models.RecordPaymentRequest body = null)
+ => CoreHelper.RunTask(RecordPaymentForSubscriptionAsync(subscriptionId, body));
+
+ ///
+ /// Record 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.
+ /// Excess payment will result in the creation of a prepayment on the Invoice Account.
+ /// Only ungrouped or primary subscriptions may be paid using the "bulk" payment request.
+ ///
+ /// Required parameter: The Chargify id of the subscription.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.PaymentResponse response from the API call.
+ public async Task RecordPaymentForSubscriptionAsync(
+ int subscriptionId,
+ Models.RecordPaymentRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/payments.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("subscription_id", subscriptionId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// 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).
+ /// 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:.
+ /// - Reactivating the subscription, which will capture all open invoices (See note below about automatic reopening of invoices.).
+ /// - Recording a payment directly against the invoice.
+ /// A note about reactivations: any canceled invoices from the most recent active period are automatically opened as a part of the reactivation process. Reactivating via this endpoint prior to reactivation is only necessary when you wish to capture older invoices from previous periods during the reactivation.
+ /// ### Reopening Consolidated Invoices.
+ /// When reopening a consolidated invoice, all of its canceled segments will also be reopened.
///
/// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
- /// Returns the Models.CustomerChangesPreviewResponse response from the API call.
- public Models.CustomerChangesPreviewResponse PreviewCustomerInformationChanges(
+ /// Returns the Models.Invoice response from the API call.
+ public Models.Invoice ReopenInvoice(
string uid)
- => CoreHelper.RunTask(PreviewCustomerInformationChangesAsync(uid));
+ => CoreHelper.RunTask(ReopenInvoiceAsync(uid));
///
- /// Customer information may change after an invoice is issued which may lead to a mismatch between customer information that are present on an open invoice and actual customer information. This endpoint allows to preview these differences, if any.
- /// The endpoint doesn't accept a request body. Customer information differences are calculated on the application side.
+ /// 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).
+ /// 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:.
+ /// - Reactivating the subscription, which will capture all open invoices (See note below about automatic reopening of invoices.).
+ /// - Recording a payment directly against the invoice.
+ /// A note about reactivations: any canceled invoices from the most recent active period are automatically opened as a part of the reactivation process. Reactivating via this endpoint prior to reactivation is only necessary when you wish to capture older invoices from previous periods during the reactivation.
+ /// ### Reopening Consolidated Invoices.
+ /// When reopening a consolidated invoice, all of its canceled segments will also be reopened.
///
/// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
/// cancellationToken.
- /// Returns the Models.CustomerChangesPreviewResponse response from the API call.
- public async Task PreviewCustomerInformationChangesAsync(
+ /// Returns the Models.Invoice response from the API call.
+ public async Task ReopenInvoiceAsync(
string uid,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/invoices/{uid}/customer_information/preview.json")
+ .Setup(HttpMethod.Post, "/invoices/{uid}/reopen.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("uid", uid).Required())))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ErrorListResponseException(_reason, _context), true))
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
@@ -944,49 +956,39 @@ public Models.Invoice UpdateCustomerInformation(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option.
- /// You cannot issue a pending child invoice that was created for a member subscription in a group.
- /// For Remittance subscriptions, the invoice will go into "open" status and payment won't be attempted. The value for `on_failed_payment` would be rejected if sent. Any prepayments or service credits that exist on subscription will be automatically applied. Additionally, if setting is on, an email will be sent for issued invoice.
- /// For Automatic subscriptions, prepayments and service credits will apply to the invoice and before payment is attempted. On successful payment, the invoice will go into "paid" status and email will be sent to the customer (if setting applies). When payment fails, the next event depends on the `on_failed_payment` value:.
- /// - `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).
+ /// This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients.
+ /// Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address.
+ /// On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned.
///
/// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
/// Optional parameter: Example: .
- /// Returns the Models.Invoice response from the API call.
- public Models.Invoice IssueInvoice(
+ public void SendInvoice(
string uid,
- Models.IssueInvoiceRequest body = null)
- => CoreHelper.RunTask(IssueInvoiceAsync(uid, body));
+ Models.SendInvoiceRequest body = null)
+ => CoreHelper.RunVoidTask(SendInvoiceAsync(uid, body));
///
- /// This endpoint allows you to issue an invoice that is in "pending" status. For example, you can issue an invoice that was created when allocating new quantity on a component and using "accrue charges" option.
- /// You cannot issue a pending child invoice that was created for a member subscription in a group.
- /// For Remittance subscriptions, the invoice will go into "open" status and payment won't be attempted. The value for `on_failed_payment` would be rejected if sent. Any prepayments or service credits that exist on subscription will be automatically applied. Additionally, if setting is on, an email will be sent for issued invoice.
- /// For Automatic subscriptions, prepayments and service credits will apply to the invoice and before payment is attempted. On successful payment, the invoice will go into "paid" status and email will be sent to the customer (if setting applies). When payment fails, the next event depends on the `on_failed_payment` value:.
- /// - `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).
+ /// This endpoint allows for invoices to be programmatically delivered via email. This endpoint supports the delivery of both ad-hoc and automatically generated invoices. Additionally, this endpoint supports email delivery to direct recipients, carbon-copy (cc) recipients, and blind carbon-copy (bcc) recipients.
+ /// Please note that if no recipient email addresses are specified in the request, then the subscription's default email configuration will be used. For example, if `recipient_emails` is left blank, then the invoice will be delivered to the subscription's customer email address.
+ /// On success, a 204 no-content response will be returned. Please note that this does not indicate that email(s) have been delivered, but instead indicates that emails have been successfully queued for delivery. If _any_ invalid or malformed email address is found in the request body, the entire request will be rejected and a 422 response will be returned.
///
/// Required parameter: The unique identifier for the invoice, this does not refer to the public facing invoice number..
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the Models.Invoice response from the API call.
- public async Task IssueInvoiceAsync(
+ /// Returns the void response from the API call.
+ public async Task SendInvoiceAsync(
string uid,
- Models.IssueInvoiceRequest body = null,
+ Models.SendInvoiceRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/invoices/{uid}/issue.json")
+ .Setup(HttpMethod.Post, "/invoices/{uid}/deliveries.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
.Template(_template => _template.Setup("uid", uid).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
diff --git a/AdvancedBilling.Standard/Controllers/OffersController.cs b/AdvancedBilling.Standard/Controllers/OffersController.cs
index f5107fa..0cf7015 100644
--- a/AdvancedBilling.Standard/Controllers/OffersController.cs
+++ b/AdvancedBilling.Standard/Controllers/OffersController.cs
@@ -35,95 +35,51 @@ public class OffersController : BaseController
internal OffersController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// Create an offer within your Chargify site by sending a POST request.
- /// ## Documentation.
- /// 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 Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407753852059).
- /// ## Using a Product Price Point.
- /// You can optionally pass in a `product_price_point_id` that corresponds with the `product_id` and the offer will use that price point. If a `product_price_point_id` is not passed in, the product's default price point will be used.
+ /// This method allows you to list a specific offer's attributes. This is different than list all offers for a site, as it requires an `offer_id`.
///
- /// Optional parameter: Example: .
+ /// Required parameter: The Chargify id of the offer.
/// Returns the Models.OfferResponse response from the API call.
- public Models.OfferResponse CreateOffer(
- Models.CreateOfferRequest body = null)
- => CoreHelper.RunTask(CreateOfferAsync(body));
+ public Models.OfferResponse ReadOffers(
+ int offerId)
+ => CoreHelper.RunTask(ReadOffersAsync(offerId));
///
- /// Create an offer within your Chargify site by sending a POST request.
- /// ## Documentation.
- /// 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 Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407753852059).
- /// ## Using a Product Price Point.
- /// You can optionally pass in a `product_price_point_id` that corresponds with the `product_id` and the offer will use that price point. If a `product_price_point_id` is not passed in, the product's default price point will be used.
+ /// This method allows you to list a specific offer's attributes. This is different than list all offers for a site, as it requires an `offer_id`.
///
- /// Optional parameter: Example: .
+ /// Required parameter: The Chargify id of the offer.
/// cancellationToken.
/// Returns the Models.OfferResponse response from the API call.
- public async Task CreateOfferAsync(
- Models.CreateOfferRequest body = null,
+ public async Task ReadOffersAsync(
+ int offerId,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/offers.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorMapResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This endpoint will list offers for a site.
- ///
- /// Object containing request parameters.
- /// Returns the Models.ListOffersResponse response from the API call.
- public Models.ListOffersResponse ListOffers(
- Models.ListOffersInput input)
- => CoreHelper.RunTask(ListOffersAsync(input));
-
- ///
- /// This endpoint will list offers for a site.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the Models.ListOffersResponse response from the API call.
- public async Task ListOffersAsync(
- Models.ListOffersInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/offers.json")
+ .Setup(HttpMethod.Get, "/offers/{offer_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("include_archived", input.IncludeArchived))))
+ .Template(_template => _template.Setup("offer_id", offerId))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method allows you to list a specific offer's attributes. This is different than list all offers for a site, as it requires an `offer_id`.
+ /// Unarchive a previously archived offer. Please provide an `offer_id` in order to un-archive the correct item.
///
/// Required parameter: The Chargify id of the offer.
- /// Returns the Models.OfferResponse response from the API call.
- public Models.OfferResponse ReadOffers(
+ public void UnarchiveOffer(
int offerId)
- => CoreHelper.RunTask(ReadOffersAsync(offerId));
+ => CoreHelper.RunVoidTask(UnarchiveOfferAsync(offerId));
///
- /// This method allows you to list a specific offer's attributes. This is different than list all offers for a site, as it requires an `offer_id`.
+ /// Unarchive a previously archived offer. Please provide an `offer_id` in order to un-archive the correct item.
///
/// Required parameter: The Chargify id of the offer.
/// cancellationToken.
- /// Returns the Models.OfferResponse response from the API call.
- public async Task ReadOffersAsync(
+ /// Returns the void response from the API call.
+ public async Task UnarchiveOfferAsync(
int offerId,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/offers/{offer_id}.json")
+ .Setup(HttpMethod.Put, "/offers/{offer_id}/unarchive.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("offer_id", offerId))))
@@ -155,28 +111,72 @@ public async Task ArchiveOfferAsync(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Unarchive a previously archived offer. Please provide an `offer_id` in order to un-archive the correct item.
+ /// Create an offer within your Chargify site by sending a POST request.
+ /// ## Documentation.
+ /// 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 Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407753852059).
+ /// ## Using a Product Price Point.
+ /// You can optionally pass in a `product_price_point_id` that corresponds with the `product_id` and the offer will use that price point. If a `product_price_point_id` is not passed in, the product's default price point will be used.
///
- /// Required parameter: The Chargify id of the offer.
- public void UnarchiveOffer(
- int offerId)
- => CoreHelper.RunVoidTask(UnarchiveOfferAsync(offerId));
+ /// Optional parameter: Example: .
+ /// Returns the Models.OfferResponse response from the API call.
+ public Models.OfferResponse CreateOffer(
+ Models.CreateOfferRequest body = null)
+ => CoreHelper.RunTask(CreateOfferAsync(body));
///
- /// Unarchive a previously archived offer. Please provide an `offer_id` in order to un-archive the correct item.
+ /// Create an offer within your Chargify site by sending a POST request.
+ /// ## Documentation.
+ /// 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 Chargify UI can be located [here](https://chargify.zendesk.com/hc/en-us/articles/4407753852059).
+ /// ## Using a Product Price Point.
+ /// You can optionally pass in a `product_price_point_id` that corresponds with the `product_id` and the offer will use that price point. If a `product_price_point_id` is not passed in, the product's default price point will be used.
///
- /// Required parameter: The Chargify id of the offer.
+ /// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the void response from the API call.
- public async Task UnarchiveOfferAsync(
- int offerId,
+ /// Returns the Models.OfferResponse response from the API call.
+ public async Task CreateOfferAsync(
+ Models.CreateOfferRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/offers/{offer_id}/unarchive.json")
+ .Setup(HttpMethod.Post, "/offers.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("offer_id", offerId))))
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This endpoint will list offers for a site.
+ ///
+ /// Object containing request parameters.
+ /// Returns the Models.ListOffersResponse response from the API call.
+ public Models.ListOffersResponse ListOffers(
+ Models.ListOffersInput input)
+ => CoreHelper.RunTask(ListOffersAsync(input));
+
+ ///
+ /// This endpoint will list offers for a site.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the Models.ListOffersResponse response from the API call.
+ public async Task ListOffersAsync(
+ Models.ListOffersInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/offers.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("include_archived", input.IncludeArchived))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs b/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs
index 0dba836..b6cf63b 100644
--- a/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs
+++ b/AdvancedBilling.Standard/Controllers/PaymentProfilesController.cs
@@ -34,6 +34,153 @@ public class PaymentProfilesController : BaseController
///
internal PaymentProfilesController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
+ ///
+ /// ## Partial Card Updates.
+ /// In the event that you are using the Authorize.net, Stripe, Cybersource, Forte or Braintree Blue payment gateways, you can update just the billing and contact information for a payment method. Note the lack of credit-card related data contained in the JSON payload.
+ /// In this case, the following JSON is acceptable:.
+ /// ```.
+ /// {.
+ /// "payment_profile": {.
+ /// "first_name": "Kelly",.
+ /// "last_name": "Test",.
+ /// "billing_address": "789 Juniper Court",.
+ /// "billing_city": "Boulder",.
+ /// "billing_state": "CO",.
+ /// "billing_zip": "80302",.
+ /// "billing_country": "US",.
+ /// "billing_address_2": null.
+ /// }.
+ /// }.
+ /// ```.
+ /// The result will be that you have updated the billing information for the card, yet retained the original card number data.
+ /// ## Specific notes on updating payment profiles.
+ /// - Merchants with **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe** as their payment gateway can update their Customer’s credit cards without passing in the full credit card number and CVV.
+ /// - If you are using **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe**, Chargify will ignore the credit card number and CVV when processing an update via the API, and attempt a partial update instead. If you wish to change the card number on a payment profile, you will need to create a new payment profile for the given customer.
+ /// - A Payment Profile cannot be updated with the attributes of another type of Payment Profile. For example, if the payment profile you are attempting to update is a credit card, you cannot pass in bank account attributes (like `bank_account_number`), and vice versa.
+ /// - Updating a payment profile directly will not trigger an attempt to capture a past-due balance. If this is the intent, update the card details via the Subscription instead.
+ /// - If you are using Authorize.net or Stripe, you may elect to manually trigger a retry for a past due subscription after a partial update.
+ ///
+ /// Required parameter: The Chargify id of the payment profile.
+ /// Optional parameter: Example: .
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public Models.PaymentProfileResponse UpdatePaymentProfile(
+ int paymentProfileId,
+ Models.UpdatePaymentProfileRequest body = null)
+ => CoreHelper.RunTask(UpdatePaymentProfileAsync(paymentProfileId, body));
+
+ ///
+ /// ## Partial Card Updates.
+ /// In the event that you are using the Authorize.net, Stripe, Cybersource, Forte or Braintree Blue payment gateways, you can update just the billing and contact information for a payment method. Note the lack of credit-card related data contained in the JSON payload.
+ /// In this case, the following JSON is acceptable:.
+ /// ```.
+ /// {.
+ /// "payment_profile": {.
+ /// "first_name": "Kelly",.
+ /// "last_name": "Test",.
+ /// "billing_address": "789 Juniper Court",.
+ /// "billing_city": "Boulder",.
+ /// "billing_state": "CO",.
+ /// "billing_zip": "80302",.
+ /// "billing_country": "US",.
+ /// "billing_address_2": null.
+ /// }.
+ /// }.
+ /// ```.
+ /// The result will be that you have updated the billing information for the card, yet retained the original card number data.
+ /// ## Specific notes on updating payment profiles.
+ /// - Merchants with **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe** as their payment gateway can update their Customer’s credit cards without passing in the full credit card number and CVV.
+ /// - If you are using **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe**, Chargify will ignore the credit card number and CVV when processing an update via the API, and attempt a partial update instead. If you wish to change the card number on a payment profile, you will need to create a new payment profile for the given customer.
+ /// - A Payment Profile cannot be updated with the attributes of another type of Payment Profile. For example, if the payment profile you are attempting to update is a credit card, you cannot pass in bank account attributes (like `bank_account_number`), and vice versa.
+ /// - Updating a payment profile directly will not trigger an attempt to capture a past-due balance. If this is the intent, update the card details via the Subscription instead.
+ /// - If you are using Authorize.net or Stripe, you may elect to manually trigger a retry for a past due subscription after a partial update.
+ ///
+ /// Required parameter: The Chargify id of the payment profile.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public async Task UpdatePaymentProfileAsync(
+ int paymentProfileId,
+ Models.UpdatePaymentProfileRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Put, "/payment_profiles/{payment_profile_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new ApiException(_reason, _context)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorStringMapResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This will delete a Payment Profile belonging to a Subscription Group.
+ /// **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them.
+ ///
+ /// Required parameter: The uid of the subscription group.
+ /// Required parameter: The Chargify id of the payment profile.
+ public void DeleteSubscriptionGroupPaymentProfile(
+ string uid,
+ int paymentProfileId)
+ => CoreHelper.RunVoidTask(DeleteSubscriptionGroupPaymentProfileAsync(uid, paymentProfileId));
+
+ ///
+ /// This will delete a Payment Profile belonging to a Subscription Group.
+ /// **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them.
+ ///
+ /// Required parameter: The uid of the subscription group.
+ /// Required parameter: The Chargify id of the payment profile.
+ /// cancellationToken.
+ /// Returns the void response from the API call.
+ public async Task DeleteSubscriptionGroupPaymentProfileAsync(
+ string uid,
+ int paymentProfileId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Delete, "/subscription_groups/{uid}/payment_profiles/{payment_profile_id}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("uid", uid).Required())
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// You can send 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.
+ /// Additionally, if you attempt to send a "request payment update" email for a subscription that does not exist, you will receive a `404` error response. This error message will indicate that the subscription could not be found, and will provide instructions on how to correct the error and resubmit the request.
+ /// These error responses are designed to prevent excessive or invalid requests, and to provide clear and helpful information to users who encounter errors during the request process.
+ ///
+ /// Required parameter: The Chargify id of the subscription.
+ public void SendRequestUpdatePaymentEmail(
+ int subscriptionId)
+ => CoreHelper.RunVoidTask(SendRequestUpdatePaymentEmailAsync(subscriptionId));
+
+ ///
+ /// You can send 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.
+ /// Additionally, if you attempt to send a "request payment update" email for a subscription that does not exist, you will receive a `404` error response. This error message will indicate that the subscription could not be found, and will provide instructions on how to correct the error and resubmit the request.
+ /// These error responses are designed to prevent excessive or invalid requests, and to provide clear and helpful information to users who encounter errors during the request process.
+ ///
+ /// Required parameter: The Chargify id of the subscription.
+ /// cancellationToken.
+ /// Returns the void response from the API call.
+ public async Task SendRequestUpdatePaymentEmailAsync(
+ int subscriptionId,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/request_payment_profiles_update.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("subscription_id", subscriptionId))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// Use this endpoint to create a payment profile for a customer.
/// Payment Profiles house the credit card, ACH (Authorize.Net or Stripe only,) or PayPal (Braintree only,) data for a customer. The payment information is attached to the customer within Chargify, as opposed to the Subscription itself.
@@ -221,8 +368,8 @@ internal PaymentProfilesController(GlobalConfiguration globalConfiguration) : ba
/// 8. Optionally, you can use the applied "msg" param in the `redirect_url` to determine whether it was successful or not.
///
/// Optional parameter: When following the IBAN or the Local Bank details examples, a customer, bank account and mandate will be created in your current vault. If the customer, bank account, and mandate already exist in your vault, follow the Import example to link the payment profile into Chargify..
- /// Returns the Models.CreatePaymentProfileResponse response from the API call.
- public Models.CreatePaymentProfileResponse CreatePaymentProfile(
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public Models.PaymentProfileResponse CreatePaymentProfile(
Models.CreatePaymentProfileRequest body = null)
=> CoreHelper.RunTask(CreatePaymentProfileAsync(body));
@@ -414,11 +561,11 @@ public Models.CreatePaymentProfileResponse CreatePaymentProfile(
///
/// Optional parameter: When following the IBAN or the Local Bank details examples, a customer, bank account and mandate will be created in your current vault. If the customer, bank account, and mandate already exist in your vault, follow the Import example to link the payment profile into Chargify..
/// cancellationToken.
- /// Returns the Models.CreatePaymentProfileResponse response from the API call.
- public async Task CreatePaymentProfileAsync(
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public async Task CreatePaymentProfileAsync(
Models.CreatePaymentProfileRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Post, "/payment_profiles.json")
.WithAuth("global")
@@ -434,8 +581,8 @@ public Models.CreatePaymentProfileResponse CreatePaymentProfile(
/// This method will return all of the 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.
///
/// Object containing request parameters.
- /// Returns the List of Models.ListPaymentProfilesResponse response from the API call.
- public List ListPaymentProfiles(
+ /// Returns the List of Models.PaymentProfileResponse response from the API call.
+ public List ListPaymentProfiles(
Models.ListPaymentProfilesInput input)
=> CoreHelper.RunTask(ListPaymentProfilesAsync(input));
@@ -444,11 +591,11 @@ public Models.CreatePaymentProfileResponse CreatePaymentProfile(
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the List of Models.ListPaymentProfilesResponse response from the API call.
- public async Task> ListPaymentProfilesAsync(
+ /// Returns the List of Models.PaymentProfileResponse response from the API call.
+ public async Task> ListPaymentProfilesAsync(
Models.ListPaymentProfilesInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Get, "/payment_profiles.json")
.WithAuth("global")
@@ -492,9 +639,9 @@ public Models.CreatePaymentProfileResponse CreatePaymentProfile(
/// ```.
///
/// Required parameter: The Chargify id of the payment profile.
- /// Returns the Models.ReadPaymentProfileResponse response from the API call.
- public Models.ReadPaymentProfileResponse ReadPaymentProfile(
- string paymentProfileId)
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public Models.PaymentProfileResponse ReadPaymentProfile(
+ int paymentProfileId)
=> CoreHelper.RunTask(ReadPaymentProfileAsync(paymentProfileId));
///
@@ -532,157 +679,118 @@ public Models.ReadPaymentProfileResponse ReadPaymentProfile(
///
/// Required parameter: The Chargify id of the payment profile.
/// cancellationToken.
- /// Returns the Models.ReadPaymentProfileResponse response from the API call.
- public async Task ReadPaymentProfileAsync(
- string paymentProfileId,
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public async Task ReadPaymentProfileAsync(
+ int paymentProfileId,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Get, "/payment_profiles/{payment_profile_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId).Required())))
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new ApiException(_reason, _context))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// ## Partial Card Updates.
- /// In the event that you are using the Authorize.net, Stripe, Cybersource, Forte or Braintree Blue payment gateways, you can update just the billing and contact information for a payment method. Note the lack of credit-card related data contained in the JSON payload.
- /// In this case, the following JSON is acceptable:.
- /// ```.
- /// {.
- /// "payment_profile": {.
- /// "first_name": "Kelly",.
- /// "last_name": "Test",.
- /// "billing_address": "789 Juniper Court",.
- /// "billing_city": "Boulder",.
- /// "billing_state": "CO",.
- /// "billing_zip": "80302",.
- /// "billing_country": "US",.
- /// "billing_address_2": null.
- /// }.
- /// }.
- /// ```.
- /// The result will be that you have updated the billing information for the card, yet retained the original card number data.
- /// ## Specific notes on updating payment profiles.
- /// - Merchants with **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe** as their payment gateway can update their Customer’s credit cards without passing in the full credit card number and CVV.
- /// - If you are using **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe**, Chargify will ignore the credit card number and CVV when processing an update via the API, and attempt a partial update instead. If you wish to change the card number on a payment profile, you will need to create a new payment profile for the given customer.
- /// - A Payment Profile cannot be updated with the attributes of another type of Payment Profile. For example, if the payment profile you are attempting to update is a credit card, you cannot pass in bank account attributes (like `bank_account_number`), and vice versa.
- /// - Updating a payment profile directly will not trigger an attempt to capture a past-due balance. If this is the intent, update the card details via the Subscription instead.
- /// - If you are using Authorize.net or Stripe, you may elect to manually trigger a retry for a past due subscription after a partial update.
+ /// This will delete a payment profile belonging to the customer on the subscription.
+ /// + If the customer has multiple subscriptions, the payment profile will be removed from all of them.
+ /// + If you delete the default payment profile for a subscription, you will 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).
///
+ /// Required parameter: The Chargify id of the subscription.
/// Required parameter: The Chargify id of the payment profile.
- /// Optional parameter: Example: .
- /// Returns the Models.UpdatePaymentProfileResponse response from the API call.
- public Models.UpdatePaymentProfileResponse UpdatePaymentProfile(
- string paymentProfileId,
- Models.UpdatePaymentProfileRequest body = null)
- => CoreHelper.RunTask(UpdatePaymentProfileAsync(paymentProfileId, body));
+ public void DeleteSubscriptionsPaymentProfile(
+ int subscriptionId,
+ int paymentProfileId)
+ => CoreHelper.RunVoidTask(DeleteSubscriptionsPaymentProfileAsync(subscriptionId, paymentProfileId));
///
- /// ## Partial Card Updates.
- /// In the event that you are using the Authorize.net, Stripe, Cybersource, Forte or Braintree Blue payment gateways, you can update just the billing and contact information for a payment method. Note the lack of credit-card related data contained in the JSON payload.
- /// In this case, the following JSON is acceptable:.
- /// ```.
- /// {.
- /// "payment_profile": {.
- /// "first_name": "Kelly",.
- /// "last_name": "Test",.
- /// "billing_address": "789 Juniper Court",.
- /// "billing_city": "Boulder",.
- /// "billing_state": "CO",.
- /// "billing_zip": "80302",.
- /// "billing_country": "US",.
- /// "billing_address_2": null.
- /// }.
- /// }.
- /// ```.
- /// The result will be that you have updated the billing information for the card, yet retained the original card number data.
- /// ## Specific notes on updating payment profiles.
- /// - Merchants with **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe** as their payment gateway can update their Customer’s credit cards without passing in the full credit card number and CVV.
- /// - If you are using **Authorize.net**, **Cybersource**, **Forte**, **Braintree Blue** or **Stripe**, Chargify will ignore the credit card number and CVV when processing an update via the API, and attempt a partial update instead. If you wish to change the card number on a payment profile, you will need to create a new payment profile for the given customer.
- /// - A Payment Profile cannot be updated with the attributes of another type of Payment Profile. For example, if the payment profile you are attempting to update is a credit card, you cannot pass in bank account attributes (like `bank_account_number`), and vice versa.
- /// - Updating a payment profile directly will not trigger an attempt to capture a past-due balance. If this is the intent, update the card details via the Subscription instead.
- /// - If you are using Authorize.net or Stripe, you may elect to manually trigger a retry for a past due subscription after a partial update.
+ /// This will delete a payment profile belonging to the customer on the subscription.
+ /// + If the customer has multiple subscriptions, the payment profile will be removed from all of them.
+ /// + If you delete the default payment profile for a subscription, you will 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).
///
+ /// Required parameter: The Chargify id of the subscription.
/// Required parameter: The Chargify id of the payment profile.
- /// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the Models.UpdatePaymentProfileResponse response from the API call.
- public async Task UpdatePaymentProfileAsync(
- string paymentProfileId,
- Models.UpdatePaymentProfileRequest body = null,
+ /// Returns the void response from the API call.
+ public async Task DeleteSubscriptionsPaymentProfileAsync(
+ int subscriptionId,
+ int paymentProfileId,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/payment_profiles/{payment_profile_id}.json")
+ .Setup(HttpMethod.Delete, "/subscriptions/{subscription_id}/payment_profiles/{payment_profile_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId).Required())
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .Template(_template => _template.Setup("subscription_id", subscriptionId))
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// 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.
+ /// This will change the default payment profile on the subscription to the existing payment profile with the id specified.
+ /// 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.
///
+ /// Required parameter: The Chargify id of the subscription.
/// Required parameter: The Chargify id of the payment profile.
- public void DeleteUnusedPaymentProfile(
- string paymentProfileId)
- => CoreHelper.RunVoidTask(DeleteUnusedPaymentProfileAsync(paymentProfileId));
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public Models.PaymentProfileResponse UpdateSubscriptionDefaultPaymentProfile(
+ int subscriptionId,
+ int paymentProfileId)
+ => CoreHelper.RunTask(UpdateSubscriptionDefaultPaymentProfileAsync(subscriptionId, paymentProfileId));
///
- /// 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.
+ /// This will change the default payment profile on the subscription to the existing payment profile with the id specified.
+ /// 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.
///
+ /// Required parameter: The Chargify id of the subscription.
/// Required parameter: The Chargify id of the payment profile.
/// cancellationToken.
- /// Returns the void response from the API call.
- public async Task DeleteUnusedPaymentProfileAsync(
- string paymentProfileId,
+ /// Returns the Models.PaymentProfileResponse response from the API call.
+ public async Task UpdateSubscriptionDefaultPaymentProfileAsync(
+ int subscriptionId,
+ int paymentProfileId,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/payment_profiles/{payment_profile_id}.json")
+ .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/payment_profiles/{payment_profile_id}/change_payment_profile.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId).Required())))
+ .Template(_template => _template.Setup("subscription_id", subscriptionId))
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
.ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new ApiException(_reason, _context)))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This will delete a payment profile belonging to the customer on the subscription.
- /// + If the customer has multiple subscriptions, the payment profile will be removed from all of them.
- /// + If you delete the default payment profile for a subscription, you will 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).
+ /// 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.
///
- /// Required parameter: The Chargify id of the subscription.
/// Required parameter: The Chargify id of the payment profile.
- public void DeleteSubscriptionsPaymentProfile(
- int subscriptionId,
- string paymentProfileId)
- => CoreHelper.RunVoidTask(DeleteSubscriptionsPaymentProfileAsync(subscriptionId, paymentProfileId));
+ public void DeleteUnusedPaymentProfile(
+ int paymentProfileId)
+ => CoreHelper.RunVoidTask(DeleteUnusedPaymentProfileAsync(paymentProfileId));
///
- /// This will delete a payment profile belonging to the customer on the subscription.
- /// + If the customer has multiple subscriptions, the payment profile will be removed from all of them.
- /// + If you delete the default payment profile for a subscription, you will 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).
+ /// 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.
///
- /// Required parameter: The Chargify id of the subscription.
/// Required parameter: The Chargify id of the payment profile.
/// cancellationToken.
/// Returns the void response from the API call.
- public async Task DeleteSubscriptionsPaymentProfileAsync(
- int subscriptionId,
- string paymentProfileId,
+ public async Task DeleteUnusedPaymentProfileAsync(
+ int paymentProfileId,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/subscriptions/{subscription_id}/payment_profiles/{payment_profile_id}.json")
+ .Setup(HttpMethod.Delete, "/payment_profiles/{payment_profile_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("subscription_id", subscriptionId))
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId).Required())))
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new ApiException(_reason, _context)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -720,73 +828,6 @@ public Models.BankAccountResponse VerifyBankAccount(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// This will delete a Payment Profile belonging to a Subscription Group.
- /// **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them.
- ///
- /// Required parameter: The uid of the subscription group.
- /// Required parameter: The Chargify id of the payment profile.
- public void DeleteSubscriptionGroupPaymentProfile(
- string uid,
- string paymentProfileId)
- => CoreHelper.RunVoidTask(DeleteSubscriptionGroupPaymentProfileAsync(uid, paymentProfileId));
-
- ///
- /// This will delete a Payment Profile belonging to a Subscription Group.
- /// **Note**: If the Payment Profile belongs to multiple Subscription Groups and/or Subscriptions, it will be removed from all of them.
- ///
- /// Required parameter: The uid of the subscription group.
- /// Required parameter: The Chargify id of the payment profile.
- /// cancellationToken.
- /// Returns the void response from the API call.
- public async Task DeleteSubscriptionGroupPaymentProfileAsync(
- string uid,
- string paymentProfileId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/subscription_groups/{uid}/payment_profiles/{payment_profile_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("uid", uid).Required())
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId).Required())))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This will change the default payment profile on the subscription to the existing payment profile with the id specified.
- /// 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.
- ///
- /// Required parameter: The Chargify id of the subscription.
- /// Required parameter: The Chargify id of the payment profile.
- /// Returns the Models.PaymentProfileResponse response from the API call.
- public Models.PaymentProfileResponse UpdateSubscriptionDefaultPaymentProfile(
- int subscriptionId,
- int paymentProfileId)
- => CoreHelper.RunTask(UpdateSubscriptionDefaultPaymentProfileAsync(subscriptionId, paymentProfileId));
-
- ///
- /// This will change the default payment profile on the subscription to the existing payment profile with the id specified.
- /// 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.
- ///
- /// Required parameter: The Chargify id of the subscription.
- /// Required parameter: The Chargify id of the payment profile.
- /// cancellationToken.
- /// Returns the Models.PaymentProfileResponse response from the API call.
- public async Task UpdateSubscriptionDefaultPaymentProfileAsync(
- int subscriptionId,
- int paymentProfileId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/payment_profiles/{payment_profile_id}/change_payment_profile.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("subscription_id", subscriptionId))
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// This will change the default payment profile on the subscription group to the existing payment profile with the id specified.
/// 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.
@@ -797,7 +838,7 @@ public Models.PaymentProfileResponse UpdateSubscriptionDefaultPaymentProfile(
/// Returns the Models.PaymentProfileResponse response from the API call.
public Models.PaymentProfileResponse UpdateSubscriptionGroupDefaultPaymentProfile(
string uid,
- string paymentProfileId)
+ int paymentProfileId)
=> CoreHelper.RunTask(UpdateSubscriptionGroupDefaultPaymentProfileAsync(uid, paymentProfileId));
///
@@ -811,7 +852,7 @@ public Models.PaymentProfileResponse UpdateSubscriptionGroupDefaultPaymentProfil
/// Returns the Models.PaymentProfileResponse response from the API call.
public async Task UpdateSubscriptionGroupDefaultPaymentProfileAsync(
string uid,
- string paymentProfileId,
+ int paymentProfileId,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
@@ -819,7 +860,7 @@ public Models.PaymentProfileResponse UpdateSubscriptionGroupDefaultPaymentProfil
.WithAuth("global")
.Parameters(_parameters => _parameters
.Template(_template => _template.Setup("uid", uid).Required())
- .Template(_template => _template.Setup("payment_profile_id", paymentProfileId).Required())))
+ .Template(_template => _template.Setup("payment_profile_id", paymentProfileId))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
@@ -855,39 +896,5 @@ public Models.GetOneTimeTokenRequest ReadOneTimeToken(
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// You can send 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.
- /// Additionally, if you attempt to send a "request payment update" email for a subscription that does not exist, you will receive a `404` error response. This error message will indicate that the subscription could not be found, and will provide instructions on how to correct the error and resubmit the request.
- /// These error responses are designed to prevent excessive or invalid requests, and to provide clear and helpful information to users who encounter errors during the request process.
- ///
- /// Required parameter: The Chargify id of the subscription.
- public void SendRequestUpdatePaymentEmail(
- int subscriptionId)
- => CoreHelper.RunVoidTask(SendRequestUpdatePaymentEmailAsync(subscriptionId));
-
- ///
- /// You can send 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.
- /// Additionally, if you attempt to send a "request payment update" email for a subscription that does not exist, you will receive a `404` error response. This error message will indicate that the subscription could not be found, and will provide instructions on how to correct the error and resubmit the request.
- /// These error responses are designed to prevent excessive or invalid requests, and to provide clear and helpful information to users who encounter errors during the request process.
- ///
- /// Required parameter: The Chargify id of the subscription.
- /// cancellationToken.
- /// Returns the void response from the API call.
- public async Task SendRequestUpdatePaymentEmailAsync(
- int subscriptionId,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/subscriptions/{subscription_id}/request_payment_profiles_update.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("subscription_id", subscriptionId))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs b/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs
index e20637a..be44582 100644
--- a/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs
+++ b/AdvancedBilling.Standard/Controllers/ProductFamiliesController.cs
@@ -35,42 +35,33 @@ public class ProductFamiliesController : BaseController
internal ProductFamiliesController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// This method allows to retrieve a list of Products belonging to a Product Family.
+ /// This method allows to retrieve a list of Product Families for a site.
///
/// Object containing request parameters.
- /// Returns the List of Models.ProductResponse response from the API call.
- public List ListProductsForProductFamily(
- Models.ListProductsForProductFamilyInput input)
- => CoreHelper.RunTask(ListProductsForProductFamilyAsync(input));
+ /// Returns the List of Models.ProductFamilyResponse response from the API call.
+ public List ListProductFamilies(
+ Models.ListProductFamiliesInput input)
+ => CoreHelper.RunTask(ListProductFamiliesAsync(input));
///
- /// This method allows to retrieve a list of Products belonging to a Product Family.
+ /// This method allows to retrieve a list of Product Families for a site.
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the List of Models.ProductResponse response from the API call.
- public async Task> ListProductsForProductFamilyAsync(
- Models.ListProductsForProductFamilyInput input,
+ /// Returns the List of Models.ProductFamilyResponse response from the API call.
+ public async Task> ListProductFamiliesAsync(
+ Models.ListProductFamiliesInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/product_families/{product_family_id}/products.json")
+ .Setup(HttpMethod.Get, "/product_families.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_family_id", input.ProductFamilyId))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
.Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
.Query(_query => _query.Setup("start_date", input.StartDate))
.Query(_query => _query.Setup("end_date", input.EndDate))
.Query(_query => _query.Setup("start_datetime", input.StartDatetime))
- .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
- .Query(_query => _query.Setup("include_archived", input.IncludeArchived))
- .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[prepaid_product_price_point][product_price_point_id]", (input.FilterPrepaidProductPricePointProductPricePointId.HasValue) ? ApiHelper.JsonSerialize(input.FilterPrepaidProductPricePointProductPricePointId.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new ApiException(_reason, _context))))
+ .Query(_query => _query.Setup("end_datetime", input.EndDatetime))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -105,33 +96,42 @@ public Models.ProductFamilyResponse CreateProductFamily(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method allows to retrieve a list of Product Families for a site.
+ /// This method allows to retrieve a list of Products belonging to a Product Family.
///
/// Object containing request parameters.
- /// Returns the List of Models.ProductFamilyResponse response from the API call.
- public List ListProductFamilies(
- Models.ListProductFamiliesInput input)
- => CoreHelper.RunTask(ListProductFamiliesAsync(input));
+ /// Returns the List of Models.ProductResponse response from the API call.
+ public List ListProductsForProductFamily(
+ Models.ListProductsForProductFamilyInput input)
+ => CoreHelper.RunTask(ListProductsForProductFamilyAsync(input));
///
- /// This method allows to retrieve a list of Product Families for a site.
+ /// This method allows to retrieve a list of Products belonging to a Product Family.
///
/// Object containing request parameters.
/// cancellationToken.
- /// Returns the List of Models.ProductFamilyResponse response from the API call.
- public async Task> ListProductFamiliesAsync(
- Models.ListProductFamiliesInput input,
+ /// Returns the List of Models.ProductResponse response from the API call.
+ public async Task> ListProductsForProductFamilyAsync(
+ Models.ListProductsForProductFamilyInput input,
CancellationToken cancellationToken = default)
- => await CreateApiCall>()
+ => await CreateApiCall>()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/product_families.json")
+ .Setup(HttpMethod.Get, "/product_families/{product_family_id}/products.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("product_family_id", input.ProductFamilyId))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
.Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
.Query(_query => _query.Setup("start_date", input.StartDate))
.Query(_query => _query.Setup("end_date", input.EndDate))
.Query(_query => _query.Setup("start_datetime", input.StartDatetime))
- .Query(_query => _query.Setup("end_datetime", input.EndDatetime))))
+ .Query(_query => _query.Setup("end_datetime", input.EndDatetime))
+ .Query(_query => _query.Setup("include_archived", input.IncludeArchived))
+ .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[prepaid_product_price_point][product_price_point_id]", (input.FilterPrepaidProductPricePointProductPricePointId.HasValue) ? ApiHelper.JsonSerialize(input.FilterPrepaidProductPricePointProductPricePointId.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found", (_reason, _context) => new ApiException(_reason, _context))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
diff --git a/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs b/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs
index 511dc9e..9516b78 100644
--- a/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs
+++ b/AdvancedBilling.Standard/Controllers/ProductPricePointsController.cs
@@ -69,111 +69,6 @@ public Models.ProductPricePointResponse CreateProductPricePoint(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ProductPricePointErrorResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// Use this endpoint to retrieve a list of product price points.
- ///
- /// Object containing request parameters.
- /// Returns the Models.ListProductPricePointsResponse response from the API call.
- public Models.ListProductPricePointsResponse ListProductPricePoints(
- Models.ListProductPricePointsInput input)
- => CoreHelper.RunTask(ListProductPricePointsAsync(input));
-
- ///
- /// Use this endpoint to retrieve a list of product price points.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the Models.ListProductPricePointsResponse response from the API call.
- public async Task ListProductPricePointsAsync(
- Models.ListProductPricePointsInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/products/{product_id}/price_points.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_id", input.ProductId).Required())
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("currency_prices", input.CurrencyPrices))
- .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// Use this endpoint to update a product price point.
- /// Note: Custom product price points are not able to be updated.
- ///
- /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
- /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
- /// Optional parameter: Example: .
- /// Returns the Models.ProductPricePointResponse response from the API call.
- public Models.ProductPricePointResponse UpdateProductPricePoint(
- UpdateProductPricePointProductId productId,
- UpdateProductPricePointPricePointId pricePointId,
- Models.UpdateProductPricePointRequest body = null)
- => CoreHelper.RunTask(UpdateProductPricePointAsync(productId, pricePointId, body));
-
- ///
- /// Use this endpoint to update a product price point.
- /// Note: Custom product price points are not able to be updated.
- ///
- /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
- /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.ProductPricePointResponse response from the API call.
- public async Task UpdateProductPricePointAsync(
- UpdateProductPricePointProductId productId,
- UpdateProductPricePointPricePointId pricePointId,
- Models.UpdateProductPricePointRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/products/{product_id}/price_points/{price_point_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("product_id", productId).Required())
- .Template(_template => _template.Setup("price_point_id", pricePointId).Required())
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// Use this endpoint to retrieve details for a specific product price point.
- ///
- /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
- /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
- /// Optional parameter: 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..
- /// Returns the Models.ProductPricePointResponse response from the API call.
- public Models.ProductPricePointResponse ReadProductPricePoint(
- ReadProductPricePointProductId productId,
- ReadProductPricePointPricePointId pricePointId,
- bool? currencyPrices = null)
- => CoreHelper.RunTask(ReadProductPricePointAsync(productId, pricePointId, currencyPrices));
-
- ///
- /// Use this endpoint to retrieve details for a specific product price point.
- ///
- /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
- /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
- /// Optional parameter: 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..
- /// cancellationToken.
- /// Returns the Models.ProductPricePointResponse response from the API call.
- public async Task ReadProductPricePointAsync(
- ReadProductPricePointProductId productId,
- ReadProductPricePointPricePointId pricePointId,
- bool? currencyPrices = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/products/{product_id}/price_points/{price_point_id}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_id", productId).Required())
- .Template(_template => _template.Setup("price_point_id", pricePointId).Required())
- .Query(_query => _query.Setup("currency_prices", currencyPrices))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// Use this endpoint to archive a product price point.
///
@@ -238,6 +133,83 @@ public Models.ProductPricePointResponse UnarchiveProductPricePoint(
.Template(_template => _template.Setup("price_point_id", pricePointId))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// This method allows retrieval of a list of Products Price Points belonging to a Site.
+ ///
+ /// Object containing request parameters.
+ /// Returns the Models.ListProductPricePointsResponse response from the API call.
+ public Models.ListProductPricePointsResponse ListAllProductPricePoints(
+ Models.ListAllProductPricePointsInput input)
+ => CoreHelper.RunTask(ListAllProductPricePointsAsync(input));
+
+ ///
+ /// This method allows retrieval of a list of Products Price Points belonging to a Site.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the Models.ListProductPricePointsResponse response from the API call.
+ public async Task ListAllProductPricePointsAsync(
+ Models.ListAllProductPricePointsInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/products_price_points.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[archived_at]", (input.FilterArchivedAt.HasValue) ? ApiHelper.JsonSerialize(input.FilterArchivedAt.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[date_field]", (input.FilterDateField.HasValue) ? ApiHelper.JsonSerialize(input.FilterDateField.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[end_date]", input.FilterEndDate.HasValue ? input.FilterEndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("filter[end_datetime]", input.FilterEndDatetime.HasValue ? input.FilterEndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
+ .Query(_query => _query.Setup("filter[start_date]", input.FilterStartDate.HasValue ? input.FilterStartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("filter[start_datetime]", input.FilterStartDatetime.HasValue ? input.FilterStartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))
+ .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point.
+ /// When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee.
+ /// Note: Currency Prices are not able to be updated for custom product price points.
+ ///
+ /// Required parameter: The Chargify id of the product price point.
+ /// Optional parameter: Example: .
+ /// Returns the Models.CurrencyPricesResponse response from the API call.
+ public Models.CurrencyPricesResponse UpdateProductCurrencyPrices(
+ int productPricePointId,
+ Models.UpdateCurrencyPricesRequest body = null)
+ => CoreHelper.RunTask(UpdateProductCurrencyPricesAsync(productPricePointId, body));
+
+ ///
+ /// This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point.
+ /// When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee.
+ /// Note: Currency Prices are not able to be updated for custom product price points.
+ ///
+ /// Required parameter: The Chargify id of the product price point.
+ /// Optional parameter: Example: .
+ /// cancellationToken.
+ /// Returns the Models.CurrencyPricesResponse response from the API call.
+ public async Task UpdateProductCurrencyPricesAsync(
+ int productPricePointId,
+ Models.UpdateCurrencyPricesRequest body = null,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Put, "/product_price_points/{product_price_point_id}/currency_prices.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_price_point_id", productPricePointId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// Use this endpoint to make a product price point the default for the product.
/// Note: Custom product price points are not able to be set as the default for a product.
@@ -312,8 +284,8 @@ public Models.BulkCreateProductPricePointsResponse CreateProductPricePoints(
///
/// Required parameter: The Chargify id of the product price point.
/// Optional parameter: Example: .
- /// Returns the Models.ProductPricePointCurrencyPrice response from the API call.
- public Models.ProductPricePointCurrencyPrice CreateProductCurrencyPrices(
+ /// Returns the Models.CurrencyPricesResponse response from the API call.
+ public Models.CurrencyPricesResponse CreateProductCurrencyPrices(
int productPricePointId,
Models.CreateProductCurrencyPricesRequest body = null)
=> CoreHelper.RunTask(CreateProductCurrencyPricesAsync(productPricePointId, body));
@@ -326,12 +298,12 @@ public Models.ProductPricePointCurrencyPrice CreateProductCurrencyPrices(
/// Required parameter: The Chargify id of the product price point.
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the Models.ProductPricePointCurrencyPrice response from the API call.
- public async Task CreateProductCurrencyPricesAsync(
+ /// Returns the Models.CurrencyPricesResponse response from the API call.
+ public async Task CreateProductCurrencyPricesAsync(
int productPricePointId,
Models.CreateProductCurrencyPricesRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
.Setup(HttpMethod.Post, "/product_price_points/{product_price_point_id}/currency_prices.json")
.WithAuth("global")
@@ -340,84 +312,112 @@ public Models.ProductPricePointCurrencyPrice CreateProductCurrencyPrices(
.Template(_template => _template.Setup("product_price_point_id", productPricePointId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorMapResponseException(_reason, _context), true)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point.
- /// When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee.
- /// Note: Currency Prices are not able to be updated for custom product price points.
+ /// Use this endpoint to retrieve a list of product price points.
///
- /// Required parameter: The Chargify id of the product price point.
+ /// Object containing request parameters.
+ /// Returns the Models.ListProductPricePointsResponse response from the API call.
+ public Models.ListProductPricePointsResponse ListProductPricePoints(
+ Models.ListProductPricePointsInput input)
+ => CoreHelper.RunTask(ListProductPricePointsAsync(input));
+
+ ///
+ /// Use this endpoint to retrieve a list of product price points.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the Models.ListProductPricePointsResponse response from the API call.
+ public async Task ListProductPricePointsAsync(
+ Models.ListProductPricePointsInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/products/{product_id}/price_points.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("product_id", input.ProductId).Required())
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("currency_prices", input.CurrencyPrices))
+ .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// Use this endpoint to update a product price point.
+ /// Note: Custom product price points are not able to be updated.
+ ///
+ /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
+ /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
/// Optional parameter: Example: .
- /// Returns the Models.ProductPricePointCurrencyPrice response from the API call.
- public Models.ProductPricePointCurrencyPrice UpdateProductCurrencyPrices(
- int productPricePointId,
- Models.UpdateCurrencyPricesRequest body = null)
- => CoreHelper.RunTask(UpdateProductCurrencyPricesAsync(productPricePointId, body));
+ /// Returns the Models.ProductPricePointResponse response from the API call.
+ public Models.ProductPricePointResponse UpdateProductPricePoint(
+ UpdateProductPricePointProductId productId,
+ UpdateProductPricePointPricePointId pricePointId,
+ Models.UpdateProductPricePointRequest body = null)
+ => CoreHelper.RunTask(UpdateProductPricePointAsync(productId, pricePointId, body));
///
- /// This endpoint allows you to update the `price`s of currency prices for a given currency that exists on the product price point.
- /// When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee.
- /// Note: Currency Prices are not able to be updated for custom product price points.
+ /// Use this endpoint to update a product price point.
+ /// Note: Custom product price points are not able to be updated.
///
- /// Required parameter: The Chargify id of the product price point.
+ /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
+ /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
/// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the Models.ProductPricePointCurrencyPrice response from the API call.
- public async Task UpdateProductCurrencyPricesAsync(
- int productPricePointId,
- Models.UpdateCurrencyPricesRequest body = null,
+ /// Returns the Models.ProductPricePointResponse response from the API call.
+ public async Task UpdateProductPricePointAsync(
+ UpdateProductPricePointProductId productId,
+ UpdateProductPricePointPricePointId pricePointId,
+ Models.UpdateProductPricePointRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Put, "/product_price_points/{product_price_point_id}/currency_prices.json")
+ .Setup(HttpMethod.Put, "/products/{product_id}/price_points/{price_point_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("product_price_point_id", productPricePointId))
+ .Template(_template => _template.Setup("product_id", productId).Required())
+ .Template(_template => _template.Setup("price_point_id", pricePointId).Required())
.Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method allows retrieval of a list of Products Price Points belonging to a Site.
+ /// Use this endpoint to retrieve details for a specific product price point.
///
- /// Object containing request parameters.
- /// Returns the Models.ListProductPricePointsResponse response from the API call.
- public Models.ListProductPricePointsResponse ListAllProductPricePoints(
- Models.ListAllProductPricePointsInput input)
- => CoreHelper.RunTask(ListAllProductPricePointsAsync(input));
+ /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
+ /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
+ /// Optional parameter: 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..
+ /// Returns the Models.ProductPricePointResponse response from the API call.
+ public Models.ProductPricePointResponse ReadProductPricePoint(
+ ReadProductPricePointProductId productId,
+ ReadProductPricePointPricePointId pricePointId,
+ bool? currencyPrices = null)
+ => CoreHelper.RunTask(ReadProductPricePointAsync(productId, pricePointId, currencyPrices));
///
- /// This method allows retrieval of a list of Products Price Points belonging to a Site.
+ /// Use this endpoint to retrieve details for a specific product price point.
///
- /// Object containing request parameters.
+ /// Required parameter: The id or handle of the product. When using the handle, it must be prefixed with `handle:`.
+ /// Required parameter: The id or handle of the price point. When using the handle, it must be prefixed with `handle:`.
+ /// Optional parameter: 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..
/// cancellationToken.
- /// Returns the Models.ListProductPricePointsResponse response from the API call.
- public async Task ListAllProductPricePointsAsync(
- Models.ListAllProductPricePointsInput input,
+ /// Returns the Models.ProductPricePointResponse response from the API call.
+ public async Task ReadProductPricePointAsync(
+ ReadProductPricePointProductId productId,
+ ReadProductPricePointPricePointId pricePointId,
+ bool? currencyPrices = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/products_price_points.json")
+ .Setup(HttpMethod.Get, "/products/{product_id}/price_points/{price_point_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("direction", (input.Direction.HasValue) ? ApiHelper.JsonSerialize(input.Direction.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[archived_at]", (input.FilterArchivedAt.HasValue) ? ApiHelper.JsonSerialize(input.FilterArchivedAt.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[date_field]", (input.FilterDateField.HasValue) ? ApiHelper.JsonSerialize(input.FilterDateField.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[end_date]", input.FilterEndDate.HasValue ? input.FilterEndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("filter[end_datetime]", input.FilterEndDatetime.HasValue ? input.FilterEndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("filter[ids]", input.FilterIds))
- .Query(_query => _query.Setup("filter[start_date]", input.FilterStartDate.HasValue ? input.FilterStartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("filter[start_datetime]", input.FilterStartDatetime.HasValue ? input.FilterStartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("filter[type]", input.FilterType?.Select(a => ApiHelper.JsonSerialize(a).Trim('\"')).ToList()))
- .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .Template(_template => _template.Setup("product_id", productId).Required())
+ .Template(_template => _template.Setup("price_point_id", pricePointId).Required())
+ .Query(_query => _query.Setup("currency_prices", currencyPrices))))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/ProductsController.cs b/AdvancedBilling.Standard/Controllers/ProductsController.cs
index 4a10ce9..86f196a 100644
--- a/AdvancedBilling.Standard/Controllers/ProductsController.cs
+++ b/AdvancedBilling.Standard/Controllers/ProductsController.cs
@@ -35,43 +35,97 @@ public class ProductsController : BaseController
internal ProductsController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// Use this method to create a product within your Chargify site.
- /// + [Products Documentation](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405561405709).
- /// + [Changing a Subscription's Product](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404225334669-Product-Changes-Migrations).
+ /// Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly.
+ /// This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product.
///
- /// Required parameter: The Chargify id of the product family to which the product belongs.
- /// Optional parameter: Example: .
+ /// Required parameter: The Chargify id of the product.
/// Returns the Models.ProductResponse response from the API call.
- public Models.ProductResponse CreateProduct(
- int productFamilyId,
- Models.CreateOrUpdateProductRequest body = null)
- => CoreHelper.RunTask(CreateProductAsync(productFamilyId, body));
+ public Models.ProductResponse ArchiveProduct(
+ int productId)
+ => CoreHelper.RunTask(ArchiveProductAsync(productId));
///
- /// Use this method to create a product within your Chargify site.
- /// + [Products Documentation](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405561405709).
- /// + [Changing a Subscription's Product](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404225334669-Product-Changes-Migrations).
+ /// Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly.
+ /// This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product.
///
- /// Required parameter: The Chargify id of the product family to which the product belongs.
- /// Optional parameter: Example: .
+ /// Required parameter: The Chargify id of the product.
/// cancellationToken.
/// Returns the Models.ProductResponse response from the API call.
- public async Task CreateProductAsync(
- int productFamilyId,
- Models.CreateOrUpdateProductRequest body = null,
+ public async Task ArchiveProductAsync(
+ int productId,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/product_families/{product_family_id}/products.json")
+ .Setup(HttpMethod.Delete, "/products/{product_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("product_family_id", productFamilyId))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .Template(_template => _template.Setup("product_id", productId))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// This method allows to retrieve a Product object by its `api_handle`.
+ ///
+ /// Required parameter: The handle of the product.
+ /// Returns the Models.ProductResponse response from the API call.
+ public Models.ProductResponse ReadProductByHandle(
+ string apiHandle)
+ => CoreHelper.RunTask(ReadProductByHandleAsync(apiHandle));
+
+ ///
+ /// This method allows to retrieve a Product object by its `api_handle`.
+ ///
+ /// Required parameter: The handle of the product.
+ /// cancellationToken.
+ /// Returns the Models.ProductResponse response from the API call.
+ public async Task ReadProductByHandleAsync(
+ string apiHandle,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/products/handle/{api_handle}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("api_handle", apiHandle).Required())))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
+ ///
+ /// This method allows to retrieve a list of Products belonging to a Site.
+ ///
+ /// Object containing request parameters.
+ /// Returns the List of Models.ProductResponse response from the API call.
+ public List ListProducts(
+ Models.ListProductsInput input)
+ => CoreHelper.RunTask(ListProductsAsync(input));
+
+ ///
+ /// This method allows to retrieve a list of Products belonging to a Site.
+ ///
+ /// Object containing request parameters.
+ /// cancellationToken.
+ /// Returns the List of Models.ProductResponse response from the API call.
+ public async Task> ListProductsAsync(
+ Models.ListProductsInput input,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall>()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/products.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("end_date", input.EndDate.HasValue ? input.EndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("end_datetime", input.EndDatetime.HasValue ? input.EndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("start_date", input.StartDate.HasValue ? input.StartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
+ .Query(_query => _query.Setup("start_datetime", input.StartDatetime.HasValue ? input.StartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
+ .Query(_query => _query.Setup("page", input.Page))
+ .Query(_query => _query.Setup("per_page", input.PerPage))
+ .Query(_query => _query.Setup("include_archived", input.IncludeArchived))
+ .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[prepaid_product_price_point][product_price_point_id]", (input.FilterPrepaidProductPricePointProductPricePointId.HasValue) ? ApiHelper.JsonSerialize(input.FilterPrepaidProductPricePointProductPricePointId.Value).Trim('\"') : null))
+ .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// This endpoint allows you to read the current details of a product that you've created in Chargify.
///
@@ -141,95 +195,41 @@ public Models.ProductResponse UpdateProduct(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly.
- /// This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product.
+ /// Use this method to create a product within your Chargify site.
+ /// + [Products Documentation](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405561405709).
+ /// + [Changing a Subscription's Product](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404225334669-Product-Changes-Migrations).
///
- /// Required parameter: The Chargify id of the product.
+ /// Required parameter: The Chargify id of the product family to which the product belongs.
+ /// Optional parameter: Example: .
/// Returns the Models.ProductResponse response from the API call.
- public Models.ProductResponse ArchiveProduct(
- int productId)
- => CoreHelper.RunTask(ArchiveProductAsync(productId));
+ public Models.ProductResponse CreateProduct(
+ int productFamilyId,
+ Models.CreateOrUpdateProductRequest body = null)
+ => CoreHelper.RunTask(CreateProductAsync(productFamilyId, body));
///
- /// Sending a DELETE request to this endpoint will archive the product. All current subscribers will be unffected; their subscription/purchase will continue to be charged monthly.
- /// This will restrict the option to chose the product for purchase via the Billing Portal, as well as disable Public Signup Pages for the product.
+ /// Use this method to create a product within your Chargify site.
+ /// + [Products Documentation](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405561405709).
+ /// + [Changing a Subscription's Product](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404225334669-Product-Changes-Migrations).
///
- /// Required parameter: The Chargify id of the product.
+ /// Required parameter: The Chargify id of the product family to which the product belongs.
+ /// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ProductResponse response from the API call.
- public async Task ArchiveProductAsync(
- int productId,
+ public async Task CreateProductAsync(
+ int productFamilyId,
+ Models.CreateOrUpdateProductRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Delete, "/products/{product_id}.json")
+ .Setup(HttpMethod.Post, "/product_families/{product_family_id}/products.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("product_id", productId))))
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("product_family_id", productFamilyId))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This method allows to retrieve a Product object by its `api_handle`.
- ///
- /// Required parameter: The handle of the product.
- /// Returns the Models.ProductResponse response from the API call.
- public Models.ProductResponse ReadProductByHandle(
- string apiHandle)
- => CoreHelper.RunTask(ReadProductByHandleAsync(apiHandle));
-
- ///
- /// This method allows to retrieve a Product object by its `api_handle`.
- ///
- /// Required parameter: The handle of the product.
- /// cancellationToken.
- /// Returns the Models.ProductResponse response from the API call.
- public async Task ReadProductByHandleAsync(
- string apiHandle,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/products/handle/{api_handle}.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("api_handle", apiHandle).Required())))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
- ///
- /// This method allows to retrieve a list of Products belonging to a Site.
- ///
- /// Object containing request parameters.
- /// Returns the List of Models.ProductResponse response from the API call.
- public List ListProducts(
- Models.ListProductsInput input)
- => CoreHelper.RunTask(ListProductsAsync(input));
-
- ///
- /// This method allows to retrieve a list of Products belonging to a Site.
- ///
- /// Object containing request parameters.
- /// cancellationToken.
- /// Returns the List of Models.ProductResponse response from the API call.
- public async Task> ListProductsAsync(
- Models.ListProductsInput input,
- CancellationToken cancellationToken = default)
- => await CreateApiCall>()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/products.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Query(_query => _query.Setup("date_field", (input.DateField.HasValue) ? ApiHelper.JsonSerialize(input.DateField.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("end_date", input.EndDate.HasValue ? input.EndDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("end_datetime", input.EndDatetime.HasValue ? input.EndDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("start_date", input.StartDate.HasValue ? input.StartDate.Value.ToString("yyyy'-'MM'-'dd") : null))
- .Query(_query => _query.Setup("start_datetime", input.StartDatetime.HasValue ? input.StartDatetime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null))
- .Query(_query => _query.Setup("page", input.Page))
- .Query(_query => _query.Setup("per_page", input.PerPage))
- .Query(_query => _query.Setup("include_archived", input.IncludeArchived))
- .Query(_query => _query.Setup("include", (input.Include.HasValue) ? ApiHelper.JsonSerialize(input.Include.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[prepaid_product_price_point][product_price_point_id]", (input.FilterPrepaidProductPricePointProductPricePointId.HasValue) ? ApiHelper.JsonSerialize(input.FilterPrepaidProductPricePointProductPricePointId.Value).Trim('\"') : null))
- .Query(_query => _query.Setup("filter[use_site_exchange_rate]", input.FilterUseSiteExchangeRate))))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs b/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs
index 7b2ccb4..65abc58 100644
--- a/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs
+++ b/AdvancedBilling.Standard/Controllers/ProformaInvoicesController.cs
@@ -35,96 +35,110 @@ public class ProformaInvoicesController : BaseController
internal ProformaInvoicesController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// This endpoint will trigger the creation of 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.
- /// If the information becomes outdated, simply void the old consolidated proforma invoice and generate a new one.
+ /// This endpoint will void a proforma invoice that has the status "draft".
/// ## Restrictions.
- /// Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, the subscription must not be prepaid, and must be in a live state.
+ /// Proforma invoices are only available on Relationship Invoicing sites.
+ /// Only proforma invoices that have the appropriate status may be reopened. If the invoice identified by {uid} does not have the appropriate status, the response will have HTTP status code 422 and an error message.
+ /// A reason for the void operation is required to be included in the request body. If one is not provided, the response will have HTTP status code 422 and an error message.
///
- /// Required parameter: The uid of the subscription group.
- public void CreateConsolidatedProformaInvoice(
- string uid)
- => CoreHelper.RunVoidTask(CreateConsolidatedProformaInvoiceAsync(uid));
+ /// Required parameter: The uid of the proforma invoice.
+ /// Optional parameter: Example: .
+ /// Returns the Models.ProformaInvoice response from the API call.
+ public Models.ProformaInvoice VoidProformaInvoice(
+ string proformaInvoiceUid,
+ Models.VoidInvoiceRequest body = null)
+ => CoreHelper.RunTask(VoidProformaInvoiceAsync(proformaInvoiceUid, body));
///
- /// This endpoint will trigger the creation of 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.
- /// If the information becomes outdated, simply void the old consolidated proforma invoice and generate a new one.
+ /// This endpoint will void a proforma invoice that has the status "draft".
/// ## Restrictions.
- /// Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, the subscription must not be prepaid, and must be in a live state.
+ /// Proforma invoices are only available on Relationship Invoicing sites.
+ /// Only proforma invoices that have the appropriate status may be reopened. If the invoice identified by {uid} does not have the appropriate status, the response will have HTTP status code 422 and an error message.
+ /// A reason for the void operation is required to be included in the request body. If one is not provided, the response will have HTTP status code 422 and an error message.
///
- /// Required parameter: The uid of the subscription group.
+ /// Required parameter: The uid of the proforma invoice.
+ /// Optional parameter: Example: .
/// cancellationToken.
- /// Returns the void response from the API call.
- public async Task CreateConsolidatedProformaInvoiceAsync(
- string uid,
+ /// Returns the Models.ProformaInvoice response from the API call.
+ public async Task VoidProformaInvoiceAsync(
+ string proformaInvoiceUid,
+ Models.VoidInvoiceRequest body = null,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/subscription_groups/{uid}/proforma_invoices.json")
+ .Setup(HttpMethod.Post, "/proforma_invoices/{proforma_invoice_uid}/void.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("uid", uid).Required())))
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("proforma_invoice_uid", proformaInvoiceUid).Required())
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Only proforma invoices with a `consolidation_level` of parent are returned.
- /// By default, proforma invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`. To include breakdowns, pass the specific field as a key in the query with a value set to true.
+ /// This endpoint is only available for Relationship Invoicing sites. It cannot be used to create consolidated proforma invoices or preview prepaid subscriptions.
+ /// Create a proforma invoice to preview costs before a subscription's signup. Like other proforma invoices, it can be emailed to the customer, voided, and publicly viewed on the chargifypay domain.
+ /// Pass a payload that resembles a subscription create or signup preview request. For example, you can specify components, coupons/a referral, offers, custom pricing, and an existing customer or payment profile to populate a shipping or billing address.
+ /// A product and customer first name, last name, and email are the minimum requirements. We recommend associating the proforma invoice with a customer_id to easily find their proforma invoices, since the subscription_id will always be blank.
///
- /// Required parameter: The uid of the subscription group.
+ /// Optional parameter: Example: .
/// Returns the Models.ProformaInvoice response from the API call.
- public Models.ProformaInvoice ListSubscriptionGroupProformaInvoices(
- string uid)
- => CoreHelper.RunTask(ListSubscriptionGroupProformaInvoicesAsync(uid));
+ public Models.ProformaInvoice CreateSignupProformaInvoice(
+ Models.CreateSubscriptionRequest body = null)
+ => CoreHelper.RunTask(CreateSignupProformaInvoiceAsync(body));
///
- /// Only proforma invoices with a `consolidation_level` of parent are returned.
- /// By default, proforma invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`. To include breakdowns, pass the specific field as a key in the query with a value set to true.
+ /// This endpoint is only available for Relationship Invoicing sites. It cannot be used to create consolidated proforma invoices or preview prepaid subscriptions.
+ /// Create a proforma invoice to preview costs before a subscription's signup. Like other proforma invoices, it can be emailed to the customer, voided, and publicly viewed on the chargifypay domain.
+ /// Pass a payload that resembles a subscription create or signup preview request. For example, you can specify components, coupons/a referral, offers, custom pricing, and an existing customer or payment profile to populate a shipping or billing address.
+ /// A product and customer first name, last name, and email are the minimum requirements. We recommend associating the proforma invoice with a customer_id to easily find their proforma invoices, since the subscription_id will always be blank.
///
- /// Required parameter: The uid of the subscription group.
+ /// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ProformaInvoice response from the API call.
- public async Task ListSubscriptionGroupProformaInvoicesAsync(
- string uid,
+ public async Task CreateSignupProformaInvoiceAsync(
+ Models.CreateSubscriptionRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/subscription_groups/{uid}/proforma_invoices.json")
+ .Setup(HttpMethod.Post, "/subscriptions/proforma_invoices.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("uid", uid).Required())))
+ .Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
+ .ErrorCase("400", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ProformaBadRequestErrorResponseException(_reason, _context), true))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// Use this endpoint to read the details of an existing proforma invoice.
- /// ## Restrictions.
- /// Proforma invoices are only available on Relationship Invoicing sites.
+ /// Only proforma invoices with a `consolidation_level` of parent are returned.
+ /// By default, proforma invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`. To include breakdowns, pass the specific field as a key in the query with a value set to true.
///
- /// Required parameter: The uid of the proforma invoice.
+ /// Required parameter: The uid of the subscription group.
/// Returns the Models.ProformaInvoice response from the API call.
- public Models.ProformaInvoice ReadProformaInvoice(
- int proformaInvoiceUid)
- => CoreHelper.RunTask(ReadProformaInvoiceAsync(proformaInvoiceUid));
+ public Models.ProformaInvoice ListSubscriptionGroupProformaInvoices(
+ string uid)
+ => CoreHelper.RunTask(ListSubscriptionGroupProformaInvoicesAsync(uid));
///
- /// Use this endpoint to read the details of an existing proforma invoice.
- /// ## Restrictions.
- /// Proforma invoices are only available on Relationship Invoicing sites.
+ /// Only proforma invoices with a `consolidation_level` of parent are returned.
+ /// By default, proforma invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, `custom_fields`. To include breakdowns, pass the specific field as a key in the query with a value set to true.
///
- /// Required parameter: The uid of the proforma invoice.
+ /// Required parameter: The uid of the subscription group.
/// cancellationToken.
/// Returns the Models.ProformaInvoice response from the API call.
- public async Task ReadProformaInvoiceAsync(
- int proformaInvoiceUid,
+ public async Task ListSubscriptionGroupProformaInvoicesAsync(
+ string uid,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Get, "/proforma_invoices/{proforma_invoice_uid}.json")
+ .Setup(HttpMethod.Get, "/subscription_groups/{uid}/proforma_invoices.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Template(_template => _template.Setup("proforma_invoice_uid", proformaInvoiceUid))))
+ .Template(_template => _template.Setup("uid", uid).Required())))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
@@ -163,6 +177,38 @@ public Models.ProformaInvoice CreateProformaInvoice(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
+ ///
+ /// Use this endpoint to read the details of an existing proforma invoice.
+ /// ## Restrictions.
+ /// Proforma invoices are only available on Relationship Invoicing sites.
+ ///
+ /// Required parameter: The uid of the proforma invoice.
+ /// Returns the Models.ProformaInvoice response from the API call.
+ public Models.ProformaInvoice ReadProformaInvoice(
+ int proformaInvoiceUid)
+ => CoreHelper.RunTask(ReadProformaInvoiceAsync(proformaInvoiceUid));
+
+ ///
+ /// Use this endpoint to read the details of an existing proforma invoice.
+ /// ## Restrictions.
+ /// Proforma invoices are only available on Relationship Invoicing sites.
+ ///
+ /// Required parameter: The uid of the proforma invoice.
+ /// cancellationToken.
+ /// Returns the Models.ProformaInvoice response from the API call.
+ public async Task ReadProformaInvoiceAsync(
+ int proformaInvoiceUid,
+ CancellationToken cancellationToken = default)
+ => await CreateApiCall()
+ .RequestBuilder(_requestBuilder => _requestBuilder
+ .Setup(HttpMethod.Get, "/proforma_invoices/{proforma_invoice_uid}.json")
+ .WithAuth("global")
+ .Parameters(_parameters => _parameters
+ .Template(_template => _template.Setup("proforma_invoice_uid", proformaInvoiceUid))))
+ .ResponseHandler(_responseHandler => _responseHandler
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
+ .ExecuteAsync(cancellationToken).ConfigureAwait(false);
+
///
/// By default, proforma invoices returned on the index will only include totals, not detailed breakdowns for `line_items`, `discounts`, `taxes`, `credits`, `payments`, or `custom_fields`. To include breakdowns, pass the specific field as a key in the query with a value set to `true`.
///
@@ -202,45 +248,35 @@ public Models.ProformaInvoice CreateProformaInvoice(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This endpoint will void a proforma invoice that has the status "draft".
+ /// This endpoint will trigger the creation of 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.
+ /// If the information becomes outdated, simply void the old consolidated proforma invoice and generate a new one.
/// ## Restrictions.
- /// Proforma invoices are only available on Relationship Invoicing sites.
- /// Only proforma invoices that have the appropriate status may be reopened. If the invoice identified by {uid} does not have the appropriate status, the response will have HTTP status code 422 and an error message.
- /// A reason for the void operation is required to be included in the request body. If one is not provided, the response will have HTTP status code 422 and an error message.
+ /// Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, the subscription must not be prepaid, and must be in a live state.
///
- /// Required parameter: The uid of the proforma invoice.
- /// Optional parameter: Example: .
- /// Returns the Models.ProformaInvoice response from the API call.
- public Models.ProformaInvoice VoidProformaInvoice(
- string proformaInvoiceUid,
- Models.VoidInvoiceRequest body = null)
- => CoreHelper.RunTask(VoidProformaInvoiceAsync(proformaInvoiceUid, body));
+ /// Required parameter: The uid of the subscription group.
+ public void CreateConsolidatedProformaInvoice(
+ string uid)
+ => CoreHelper.RunVoidTask(CreateConsolidatedProformaInvoiceAsync(uid));
///
- /// This endpoint will void a proforma invoice that has the status "draft".
+ /// This endpoint will trigger the creation of 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.
+ /// If the information becomes outdated, simply void the old consolidated proforma invoice and generate a new one.
/// ## Restrictions.
- /// Proforma invoices are only available on Relationship Invoicing sites.
- /// Only proforma invoices that have the appropriate status may be reopened. If the invoice identified by {uid} does not have the appropriate status, the response will have HTTP status code 422 and an error message.
- /// A reason for the void operation is required to be included in the request body. If one is not provided, the response will have HTTP status code 422 and an error message.
+ /// Proforma invoices are only available on Relationship Invoicing sites. To create a proforma invoice, the subscription must not be prepaid, and must be in a live state.
///
- /// Required parameter: The uid of the proforma invoice.
- /// Optional parameter: Example: .
+ /// Required parameter: The uid of the subscription group.
/// cancellationToken.
- /// Returns the Models.ProformaInvoice response from the API call.
- public async Task VoidProformaInvoiceAsync(
- string proformaInvoiceUid,
- Models.VoidInvoiceRequest body = null,
+ /// Returns the void response from the API call.
+ public async Task CreateConsolidatedProformaInvoiceAsync(
+ string uid,
CancellationToken cancellationToken = default)
- => await CreateApiCall()
+ => await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/proforma_invoices/{proforma_invoice_uid}/void.json")
+ .Setup(HttpMethod.Post, "/subscription_groups/{uid}/proforma_invoices.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Template(_template => _template.Setup("proforma_invoice_uid", proformaInvoiceUid).Required())
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
+ .Template(_template => _template.Setup("uid", uid).Required())))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true))
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
@@ -279,42 +315,6 @@ public Models.ProformaInvoicePreview PreviewProformaInvoice(
.ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
- ///
- /// This endpoint is only available for Relationship Invoicing sites. It cannot be used to create consolidated proforma invoices or preview prepaid subscriptions.
- /// Create a proforma invoice to preview costs before a subscription's signup. Like other proforma invoices, it can be emailed to the customer, voided, and publicly viewed on the chargifypay domain.
- /// Pass a payload that resembles a subscription create or signup preview request. For example, you can specify components, coupons/a referral, offers, custom pricing, and an existing customer or payment profile to populate a shipping or billing address.
- /// A product and customer first name, last name, and email are the minimum requirements. We recommend associating the proforma invoice with a customer_id to easily find their proforma invoices, since the subscription_id will always be blank.
- ///
- /// Optional parameter: Example: .
- /// Returns the Models.ProformaInvoice response from the API call.
- public Models.ProformaInvoice CreateSignupProformaInvoice(
- Models.CreateSubscriptionRequest body = null)
- => CoreHelper.RunTask(CreateSignupProformaInvoiceAsync(body));
-
- ///
- /// This endpoint is only available for Relationship Invoicing sites. It cannot be used to create consolidated proforma invoices or preview prepaid subscriptions.
- /// Create a proforma invoice to preview costs before a subscription's signup. Like other proforma invoices, it can be emailed to the customer, voided, and publicly viewed on the chargifypay domain.
- /// Pass a payload that resembles a subscription create or signup preview request. For example, you can specify components, coupons/a referral, offers, custom pricing, and an existing customer or payment profile to populate a shipping or billing address.
- /// A product and customer first name, last name, and email are the minimum requirements. We recommend associating the proforma invoice with a customer_id to easily find their proforma invoices, since the subscription_id will always be blank.
- ///
- /// Optional parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.ProformaInvoice response from the API call.
- public async Task CreateSignupProformaInvoiceAsync(
- Models.CreateSubscriptionRequest body = null,
- CancellationToken cancellationToken = default)
- => await CreateApiCall()
- .RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/subscriptions/proforma_invoices.json")
- .WithAuth("global")
- .Parameters(_parameters => _parameters
- .Body(_bodyParameter => _bodyParameter.Setup(body))
- .Header(_header => _header.Setup("Content-Type", "application/json"))))
- .ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("400", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ProformaBadRequestErrorResponseException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorMapResponseException(_reason, _context), true)))
- .ExecuteAsync(cancellationToken).ConfigureAwait(false);
-
///
/// This endpoint is only available for Relationship Invoicing sites. It cannot be used to create consolidated proforma invoice previews or preview prepaid subscriptions.
/// Create a signup preview in the format of a proforma invoice to preview costs before a subscription's signup. You have the option of optionally previewing the first renewal's costs as well. The proforma invoice preview will not be persisted.
@@ -353,7 +353,7 @@ public Models.SignupProformaPreviewResponse PreviewSignupProformaInvoice(
.Query(_query => _query.Setup("include=next_proforma_invoice", includeNextProformaInvoice))))
.ResponseHandler(_responseHandler => _responseHandler
.ErrorCase("400", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ProformaBadRequestErrorResponseException(_reason, _context), true))
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorMapResponseException(_reason, _context), true)))
+ .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorArrayMapResponseException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
}
}
\ No newline at end of file
diff --git a/AdvancedBilling.Standard/Controllers/ReasonCodesController.cs b/AdvancedBilling.Standard/Controllers/ReasonCodesController.cs
index 7336950..bb8bc37 100644
--- a/AdvancedBilling.Standard/Controllers/ReasonCodesController.cs
+++ b/AdvancedBilling.Standard/Controllers/ReasonCodesController.cs
@@ -35,46 +35,37 @@ public class ReasonCodesController : BaseController
internal ReasonCodesController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }
///
- /// # Reason Codes Intro.
- /// ReasonCodes are a way to gain a high level view of why your customers are cancelling the subcription to your product or service.
- /// Add a set of churn reason codes to be displayed in-app and/or the Chargify 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 Chargify can be located under the following links.
- /// [Churn Reason Codes](https://chargify.zendesk.com/hc/en-us/articles/4407896775579#churn-reason-codes).
- /// ## Create Reason Code.
- /// This method gives a merchant the option to create a reason codes for a given Site.
+ /// This method gives a merchant the option to update an existing reason code for a given site.
///
+ /// Required parameter: The Chargify id of the reason code.
/// Optional parameter: Example: .
/// Returns the Models.ReasonCodeResponse response from the API call.
- public Models.ReasonCodeResponse CreateReasonCode(
- Models.CreateReasonCodeRequest body = null)
- => CoreHelper.RunTask(CreateReasonCodeAsync(body));
+ public Models.ReasonCodeResponse UpdateReasonCode(
+ int reasonCodeId,
+ Models.UpdateReasonCodeRequest body = null)
+ => CoreHelper.RunTask(UpdateReasonCodeAsync(reasonCodeId, body));
///
- /// # Reason Codes Intro.
- /// ReasonCodes are a way to gain a high level view of why your customers are cancelling the subcription to your product or service.
- /// Add a set of churn reason codes to be displayed in-app and/or the Chargify 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 Chargify can be located under the following links.
- /// [Churn Reason Codes](https://chargify.zendesk.com/hc/en-us/articles/4407896775579#churn-reason-codes).
- /// ## Create Reason Code.
- /// This method gives a merchant the option to create a reason codes for a given Site.
+ /// This method gives a merchant the option to update an existing reason code for a given site.
///
+ /// Required parameter: The Chargify id of the reason code.
/// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ReasonCodeResponse response from the API call.
- public async Task CreateReasonCodeAsync(
- Models.CreateReasonCodeRequest body = null,
+ public async Task UpdateReasonCodeAsync(
+ int reasonCodeId,
+ Models.UpdateReasonCodeRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall()
.RequestBuilder(_requestBuilder => _requestBuilder
- .Setup(HttpMethod.Post, "/reason_codes.json")
+ .Setup(HttpMethod.Put, "/reason_codes/{reason_code_id}.json")
.WithAuth("global")
.Parameters(_parameters => _parameters
.Body(_bodyParameter => _bodyParameter.Setup(body))
+ .Template(_template => _template.Setup("reason_code_id", reasonCodeId))
.Header(_header => _header.Setup("Content-Type", "application/json"))))
.ResponseHandler(_responseHandler => _responseHandler
- .ErrorCase("422", CreateErrorCase("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", (_reason, _context) => new ErrorListResponseException(_reason, _context), true)))
+ .ErrorCase("404", CreateErrorCase("Not Found:'{$response.body}'", (_reason, _context) => new ApiException(_reason, _context), true)))
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
@@ -105,63 +96,72 @@ public Models.ReasonCodeResponse CreateReasonCode(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);
///
- /// This method gives a merchant the option to retrieve a list of a particular code for a given Site by providing the unique numerical ID of the code.
+ /// # Reason Codes Intro.
+ /// ReasonCodes are a way to gain a high level view of why your customers are cancelling the subcription to your product or service.
+ /// Add a set of churn reason codes to be displayed in-app and/or the Chargify 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 Chargify can be located under the following links.
+ /// [Churn Reason Codes](https://chargify.zendesk.com/hc/en-us/articles/4407896775579#churn-reason-codes).
+ /// ## Create Reason Code.
+ /// This method gives a merchant the option to create a reason codes for a given Site.
///
- /// Required parameter: The Chargify id of the reason code.
+ /// Optional parameter: Example: .
/// Returns the Models.ReasonCodeResponse response from the API call.
- public Models.ReasonCodeResponse ReadReasonCode(
- int reasonCodeId)
- => CoreHelper.RunTask(ReadReasonCodeAsync(reasonCodeId));
+ public Models.ReasonCodeResponse CreateReasonCode(
+ Models.CreateReasonCodeRequest body = null)
+ => CoreHelper.RunTask(CreateReasonCodeAsync(body));
///
- /// This method gives a merchant the option to retrieve a list of a particular code for a given Site by providing the unique numerical ID of the code.
+ /// # Reason Codes Intro.
+ /// ReasonCodes are a way to gain a high level view of why your customers are cancelling the subcription to your product or service.
+ /// Add a set of churn reason codes to be displayed in-app and/or the Chargify 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 Chargify can be located under the following links.
+ /// [Churn Reason Codes](https://chargify.zendesk.com/hc/en-us/articles/4407896775579#churn-reason-codes).
+ /// ## Create Reason Code.
+ /// This method gives a merchant the option to create a reason codes for a given Site.
///
- /// Required parameter: The Chargify id of the reason code.
+ /// Optional parameter: Example: .
/// cancellationToken.
/// Returns the Models.ReasonCodeResponse response from the API call.
- public async Task ReadReasonCodeAsync(
- int reasonCodeId,
+ public async Task CreateReasonCodeAsync(
+ Models.CreateReasonCodeRequest body = null,
CancellationToken cancellationToken = default)
=> await CreateApiCall