Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions AdvancedBilling.Standard/AdvancedBilling.Standard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Maxio.AdvancedBillingSdk</AssemblyName>
<Version>7.0.1.0</Version>
<Version>8.0.0.0</Version>
<Authors>MaxioSdk</Authors>
<Owners></Owners>
<Product>AdvancedBilling.Standard</Product>
<Copyright>Copyright © 2019</Copyright>
<AssemblyVersion>7.0.1.0</AssemblyVersion>
<FileVersion>7.0.1.0</FileVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<FileVersion>8.0.0.0</FileVersion>
<Description>Ultimate billing and pricing flexibility for B2B SaaS.
Maxio integrates directly into your product, so you can seamlessly manage your product catalog, bill customers, and collect payments.</Description>
<LangVersion>7.3</LangVersion>
Expand All @@ -29,12 +29,14 @@ Maxio integrates directly into your product, so you can seamlessly manage your p
<PackageLicenseFile>LICENSE</PackageLicenseFile>

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Link="README.md" />
<PackageReference Include="APIMatic.Core" Version= "[0.4.10, 0.5.0)" />
<PackageReference Include="APIMatic.Core" Version= "[0.4.*, 0.5.0)" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<None Include="..\README.md" Pack="true" PackagePath="\"/>
<None Include="..\LICENSE" Pack="true" PackagePath="\"/>
</ItemGroup>
Expand Down
47 changes: 46 additions & 1 deletion AdvancedBilling.Standard/AdvancedBillingClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using AdvancedBilling.Standard.Controllers;
using AdvancedBilling.Standard.Http.Client;
using AdvancedBilling.Standard.Utilities;
using Microsoft.Extensions.Configuration;

namespace AdvancedBilling.Standard
{
Expand Down Expand Up @@ -42,7 +43,7 @@ public sealed class AdvancedBillingClient : IConfiguration
};

private readonly GlobalConfiguration globalConfiguration;
private const string userAgent = "AB SDK DotNet:7.0.1 on OS {os-info}";
private const string userAgent = "AB SDK DotNet:8.0.0 on OS {os-info}";
private readonly HttpCallback httpCallback;
private readonly Lazy<APIExportsController> aPIExports;
private readonly Lazy<AdvanceInvoiceController> advanceInvoice;
Expand Down Expand Up @@ -435,6 +436,13 @@ internal static AdvancedBillingClient CreateFromEnvironment()
return builder.Build();
}

/// <summary>
/// Creates the client from configuration.
/// </summary>
/// <returns> AdvancedBillingClient.</returns>
public static AdvancedBillingClient FromConfiguration(IConfigurationSection configuration) =>
Builder.FromConfiguration(configuration).Build();

/// <summary>
/// Builder class.
/// </summary>
Expand Down Expand Up @@ -500,6 +508,15 @@ public Builder HttpClientConfig(Action<HttpClientConfiguration.Builder> action)
return this;
}

private Builder HttpClientConfig(HttpClientConfiguration.Builder httpClientConfigurationBuilder)
{
if (httpClientConfigurationBuilder != null)
{
this.httpClientConfig = httpClientConfigurationBuilder;
}

return this;
}


/// <summary>
Expand Down Expand Up @@ -530,6 +547,34 @@ public AdvancedBillingClient Build()
httpCallback,
httpClientConfig.Build());
}

/// <summary>
/// Creates the client builder from configuration.
/// </summary>
/// <returns> Builder.</returns>
public static Builder FromConfiguration(IConfigurationSection config)
{
var builder = new Builder();
var options = config.Get<AdvancedBillingClientOptions>();
if (options == null) return builder;
if (options.Environment != null)
builder.Environment(options.Environment.Value);
if (options.Site != null)
builder.Site(options.Site);
if (options.BasicAuthCredentials != null)
builder.BasicAuthCredentials(BasicAuthModel.FromOptions(options.BasicAuthCredentials));
if (options.HttpClientConfig != null)
builder.HttpClientConfig(Http.Client.HttpClientConfiguration.FromOptions(options.HttpClientConfig));
return builder;
}
}

public class AdvancedBillingClientOptions
{
public Environment? Environment { get; set; }
public string Site { get; set; }
public BasicAuthModelOptions BasicAuthCredentials { get; set; }
public HttpClientConfigurationOptions HttpClientConfig { get; set; }
}
}
}
12 changes: 12 additions & 0 deletions AdvancedBilling.Standard/Authentication/BasicAuthManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,17 @@ public BasicAuthModel Build()
};
}
}

internal static BasicAuthModel FromOptions(BasicAuthModelOptions options)
{
var builder = new Builder(options.Username, options.Password);
return builder.Build();
}
}

public class BasicAuthModelOptions
{
public string Username { get; set; }
public string Password { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class AdvanceInvoiceController : BaseController
internal AdvanceInvoiceController(GlobalConfiguration globalConfiguration) : base(globalConfiguration) { }

/// <summary>
/// Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided.
/// Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided.
/// A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error.
/// That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated.
/// We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it.
Expand All @@ -50,7 +50,7 @@ public Models.Invoice IssueAdvanceInvoice(
=> CoreHelper.RunTask(IssueAdvanceInvoiceAsync(subscriptionId, body));

/// <summary>
/// Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided.
/// Generate an invoice in advance for a subscription's next renewal date. [See our docs](https://maxio.zendesk.com/hc/en-us/articles/24252026404749-Issue-Invoice-In-Advance) for more information on advance invoices, including eligibility on generating one; for the most part, they function like any other invoice, except they are issued early and have special behavior upon being voided.
/// A subscription may only have one advance invoice per billing period. Attempting to issue an advance invoice when one already exists will return an error.
/// That said, regeneration of the invoice may be forced with the params `force: true`, which will void an advance invoice if one exists and generate a new one. If no advance invoice exists, a new one will be generated.
/// We recommend using either the create or preview endpoints for proforma invoices to preview this advance invoice before using this endpoint to generate it.
Expand Down Expand Up @@ -106,7 +106,7 @@ public Models.Invoice ReadAdvanceInvoice(

/// <summary>
/// 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]($m/Invoice).
/// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice).
/// </summary>
/// <param name="subscriptionId">Required parameter: The Chargify id of the subscription.</param>
/// <param name="body">Optional parameter: .</param>
Expand All @@ -118,7 +118,7 @@ public Models.Invoice VoidAdvanceInvoice(

/// <summary>
/// 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]($m/Invoice).
/// A `reason` is required in order to void, and the invoice must have an open status. Voiding will cause any prepayments and credits that were applied to the invoice to be returned to the subscription. For a full overview of the impact of voiding, [see our help docs]($m/Invoice).
/// </summary>
/// <param name="subscriptionId">Required parameter: The Chargify id of the subscription.</param>
/// <param name="body">Optional parameter: .</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal BillingPortalController(GlobalConfiguration globalConfiguration) : base
/// ## Billing Portal Security.
/// If your customer has been invited to the Billing Portal, then they will receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.**.
/// If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing.
/// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), please **do not** make an API request to Advanced Billing every time.
/// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time.
/// ]]>
/// </summary>
/// <param name="customerId">Required parameter: The Chargify id of the customer.</param>
Expand All @@ -64,7 +64,7 @@ public Models.CustomerResponse EnableBillingPortalForCustomer(
/// ## Billing Portal Security.
/// If your customer has been invited to the Billing Portal, then they will receive a link to manage their subscription (the “Management URL”) automatically at the bottom of their statements, invoices, and receipts. **This link changes periodically for security and is only valid for 65 days.**.
/// If you need to provide your customer their Management URL through other means, you can retrieve it via the API. Because the URL is cryptographically signed with a timestamp, it is not possible for merchants to generate the URL without requesting it from Advanced Billing.
/// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), please **do not** make an API request to Advanced Billing every time.
/// In order to prevent abuse & overuse, we ask that you request a new URL only when absolutely necessary. Management URLs are good for 65 days, so you should re-use a previously generated one as much as possible. If you use the URL frequently (such as to display on your website), **do not** make an API request to Advanced Billing every time.
/// ]]>
/// </summary>
/// <param name="customerId">Required parameter: The Chargify id of the customer.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public Models.ComponentPricePointsResponse BulkCreateComponentPricePoints(
.ExecuteAsync(cancellationToken).ConfigureAwait(false);

/// <summary>
/// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones.
/// When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones.
/// Passing in a price bracket without an `id` will attempt to create a new price.
/// Including an `id` will update the corresponding price, and including the `_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.
Expand All @@ -192,7 +192,7 @@ public Models.ComponentPricePointResponse UpdateComponentPricePoint(
=> CoreHelper.RunTask(UpdateComponentPricePointAsync(componentId, pricePointId, body));

/// <summary>
/// When updating a price point, it's prices can be updated as well by creating new prices or editing / removing existing ones.
/// When updating a price point, prices can be updated as well by creating new prices or editing / removing existing ones.
/// Passing in a price bracket without an `id` will attempt to create a new price.
/// Including an `id` will update the corresponding price, and including the `_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.
Expand Down
Loading
Loading