Skip to content

Commit

Permalink
[DE-799] Add missing nullable types
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-nedza committed May 7, 2024
1 parent 5a2c152 commit dcaf203
Show file tree
Hide file tree
Showing 517 changed files with 1,288 additions and 1,233 deletions.
18 changes: 9 additions & 9 deletions advance_invoice_controller.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package advancedbilling

import (
"context"
"fmt"
"github.com/apimatic/go-core-runtime/https"
"github.com/apimatic/go-core-runtime/utilities"
"github.com/maxio-com/ab-golang-sdk/errors"
"github.com/maxio-com/ab-golang-sdk/models"
"context"
"fmt"
"github.com/apimatic/go-core-runtime/https"

Check failure on line 6 in advance_invoice_controller.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/apimatic/go-core-runtime/https (imported by github.com/ma***io-com/ab-golang-sdk); to add:
"github.com/apimatic/go-core-runtime/utilities"

Check failure on line 7 in advance_invoice_controller.go

View workflow job for this annotation

GitHub Actions / build

missing go.sum entry for module providing package github.com/apimatic/go-core-runtime/utilities (imported by github.com/ma***io-com/ab-golang-sdk); to add:
"github.com/maxio-com/ab-golang-sdk/errors"
"github.com/maxio-com/ab-golang-sdk/models"
)

// AdvanceInvoiceController represents a controller struct.
Expand All @@ -24,7 +24,7 @@ func NewAdvanceInvoiceController(baseController baseController) *AdvanceInvoiceC
// IssueAdvanceInvoice takes context, subscriptionId, body as parameters and
// returns an models.ApiResponse with models.Invoice data and
// an error if there was an issue with the request or response.
// Generate an invoice in advance for a subscription's next renewal date. [Please see our docs]($m/Invoice) 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. [Please see our docs](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404811062541-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 @@ -112,13 +112,13 @@ func (a *AdvanceInvoiceController) VoidAdvanceInvoice(
if body != nil {
req.Json(body)
}

var result models.Invoice
decoder, resp, err := req.CallAsJson()
if err != nil {
return models.NewApiResponse(result, resp), err
}

result, err = utilities.DecodeResults[models.Invoice](decoder)
return models.NewApiResponse(result, resp), err
}
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewClient(configuration Configuration) ClientInterface {
configuration: configuration,
}

client.userAgent = utilities.UpdateUserAgent("AB SDK Go:3.0.0 on OS {os-info}")
client.userAgent = utilities.UpdateUserAgent("AB SDK Go:0.1.0 on OS {os-info}")
client.callBuilderFactory = callBuilderHandler(
func(server string) string {
if server == "" {
Expand Down
2 changes: 1 addition & 1 deletion doc/controllers/advance-invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ advanceInvoiceController := client.AdvanceInvoiceController()

# Issue Advance Invoice

Generate an invoice in advance for a subscription's next renewal date. [Please see our docs](../../doc/models/invoice.md) 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. [Please see our docs](https://maxio-chargify.zendesk.com/hc/en-us/articles/5404811062541-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
13 changes: 13 additions & 0 deletions doc/controllers/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,19 @@ if err != nil {

Use this endpoint to retrieve the details for an invoice.

## PDF Invoice retrieval

Individual PDF Invoices can be retrieved by using the "Accept" header application/pdf or appending .pdf as the format portion of the URL:

```curl -u <api_key>:x -H
Accept:application/pdf -H
https://acme.chargify.com/invoices/inv_8gd8tdhtd3hgr.pdf > output_file.pdf
URL: `https://<subdomain>.chargify.com/invoices/<uid>.<format>`
Method: GET
Required parameters: `uid`
Response: A single Invoice.
```

```go
ReadInvoice(
ctx context.Context,
Expand Down
28 changes: 28 additions & 0 deletions doc/controllers/payment-profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,34 @@ The following example creates a customer, bank account and mandate in Stripe:
}
```

## Stripe BACS Direct Debit

Contact the support team to enable this payment method.
For more information on Stripe BACS Direct Debit, please view the following resources:

+ [Full documentation on Stripe BACS Direct Debit](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405050826765-Stripe-SEPA-and-BECS-Direct-Debit)

### Stripe BACS Direct Debit Payment Profiles

The following example creates a customer, bank account and mandate in Stripe:

```json
{
"payment_profile": {
"customer_id": "24907598",
"bank_name": "British bank",
"bank_branch_code": "108800",
"bank_account_number": "00012345"
"payment_type": "bank_account",
"billing_address": "Test",
"billing_city": "London",
"billing_state": "LND",
"billing_zip": "12345",
"billing_country": "GB"
}
}
```

## 3D Secure - Checkout

It may happen that a payment needs 3D Secure Authentication when the payment profile is created; this is referred to in our help docs as a [post-authentication flow](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405177432077#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:
Expand Down
9 changes: 6 additions & 3 deletions doc/controllers/subscription-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ListSubscriptionComponents(
| `sort` | [`*models.ListSubscriptionComponentsSort`](../../doc/models/list-subscription-components-sort.md) | Query, Optional | The attribute by which to sort. Use in query `sort=updated_at`. |
| `startDate` | `*string` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
| `startDatetime` | `*string` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of start_date. |
| `include` | [`*models.ListSubscriptionComponentsInclude`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription`. |
| `include` | [`[]models.ListSubscriptionComponentsInclude`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription,historic_usages`. |

## Response Type

Expand All @@ -156,7 +156,10 @@ collectedInput := advancedbilling.ListSubscriptionComponentsInput{
3,
},
Sort: models.ToPointer(models.ListSubscriptionComponentsSort("updated_at")),
Include: models.ToPointer(models.ListSubscriptionComponentsInclude("subscription")),
Include: []models.ListSubscriptionComponentsInclude{
models.ListSubscriptionComponentsInclude("subscription"),
models.ListSubscriptionComponentsInclude("historic_usages"),
},
}

apiResponse, err := subscriptionComponentsController.ListSubscriptionComponents(ctx, collectedInput)
Expand Down Expand Up @@ -1587,7 +1590,7 @@ ListSubscriptionComponentsForSite(
| `subscriptionIds` | `[]int` | Query, Optional | Allows fetching components allocation with matching subscription id based on provided ids. Use in query `subscription_ids=1,2,3`. |
| `pricePointIds` | [`*models.IncludeNotNull`](../../doc/models/include-not-null.md) | Query, Optional | Allows fetching components allocation only if price point id is present. Use in query `price_point_ids=not_null`. |
| `productFamilyIds` | `[]int` | Query, Optional | Allows fetching components allocation with matching product family id based on provided ids. Use in query `product_family_ids=1,2,3`. |
| `include` | [`*models.ListSubscriptionComponentsInclude`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription`. |
| `include` | [`*models.ListSubscriptionComponentsInclude`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription,historic_usages`. |

## Response Type

Expand Down
4 changes: 2 additions & 2 deletions doc/controllers/subscription-group-invoice-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ uid := "uid0"
body := models.IssueServiceCreditRequest{
ServiceCredit: models.IssueServiceCredit{
Amount: models.IssueServiceCreditAmountContainer.FromPrecision(float64(10)),
Memo: "Credit the group account",
Memo: models.ToPointer("Credit the group account"),
},
}

Expand Down Expand Up @@ -261,7 +261,7 @@ uid := "uid0"
body := models.DeductServiceCreditRequest{
Deduction: models.DeductServiceCredit{
Amount: models.DeductServiceCreditAmountContainer.FromPrecision(float64(10)),
Memo: "Deduct from group account",
Memo: models.ToPointer("Deduct from group account"),
},
}

Expand Down
19 changes: 12 additions & 7 deletions doc/controllers/subscription-invoice-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ subscriptionId := 222
body := models.IssueServiceCreditRequest{
ServiceCredit: models.IssueServiceCredit{
Amount: models.IssueServiceCreditAmountContainer.FromString("1"),
Memo: "Courtesy credit",
},
}

Expand All @@ -276,6 +275,12 @@ if err != nil {
}
```

## Errors

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 422 | Unprocessable Entity (WebDAV) | `ApiError` |


# Deduct Service Credit

Expand Down Expand Up @@ -311,7 +316,7 @@ subscriptionId := 222
body := models.DeductServiceCreditRequest{
Deduction: models.DeductServiceCredit{
Amount: models.DeductServiceCreditAmountContainer.FromString("1"),
Memo: "Deduction",
Memo: models.ToPointer("Deduction"),
},
}

Expand All @@ -327,7 +332,7 @@ if err != nil {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
| 422 | Unprocessable Entity (WebDAV) | `ApiError` |


# Refund Prepayment
Expand All @@ -340,7 +345,7 @@ The amount may be passed either as a decimal, with `amount`, or an integer in ce
RefundPrepayment(
ctx context.Context,
subscriptionId int,
prepaymentId string,
prepaymentId int64,
body *models.RefundPrepaymentRequest) (
models.ApiResponse[models.PrepaymentResponse],
error)
Expand All @@ -351,7 +356,7 @@ RefundPrepayment(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription |
| `prepaymentId` | `string` | Template, Required | id of prepayment |
| `prepaymentId` | `int64` | Template, Required | id of prepayment |
| `body` | [`*models.RefundPrepaymentRequest`](../../doc/models/refund-prepayment-request.md) | Body, Optional | - |

## Response Type
Expand All @@ -365,7 +370,7 @@ ctx := context.Background()

subscriptionId := 222

prepaymentId := "prepayment_id8"
prepaymentId := int64(228)



Expand All @@ -385,5 +390,5 @@ if err != nil {
| --- | --- | --- |
| 400 | Bad Request | [`RefundPrepaymentBaseErrorsResponseException`](../../doc/models/refund-prepayment-base-errors-response-exception.md) |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity | [`RefundPrepaymentAggregatedErrorsResponseException`](../../doc/models/refund-prepayment-aggregated-errors-response-exception.md) |
| 422 | Unprocessable Entity | `ApiError` |

42 changes: 39 additions & 3 deletions doc/controllers/subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,13 @@ For more information on Stripe Direct Debit, please view the following two resou

For more information on Stripe Direct Debit, please view the following two resources:

+ [Payment Profiles via API for Stripe BECS Direct Debit](https://developers.chargify.com/docs/api-docs/1f10a4f170405-create-payment-profile#stripe-becs-direct-debit)
+ [Payment Profiles via API for Stripe BECS Direct Debit]($e/Payment%20Profiles/createPaymentProfile)

+ [Full documentation on Stripe Direct Debit](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405050826765-Stripe-SEPA-and-BECS-Direct-Debit)

+ [Using Chargify.js with Stripe SEPA or BECS Direct Debit - minimal example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#minimal-example-with-sepa-or-becs-direct-debit-stripe-gateway)
+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](page:development-tools/chargify-js/examples#minimal-example-with-sepa-becs-or-bacs-direct-debit-stripe-gateway)

+ [Using Chargify.js with Stripe BECS Direct Debit - full example](https://developers.chargify.com/docs/developer-docs/ZG9jOjE0NjAzNDIy-examples#full-example-with-becs-direct-debit-stripe-gateway)
+ [Using Chargify.js with Stripe BECS Direct Debit - full example](page:development-tools/chargify-js/examples#full-example-with-becs-direct-debit-stripe-gateway)

```json
{
Expand All @@ -391,6 +391,42 @@ For more information on Stripe Direct Debit, please view the following two resou
}
```

## Subscription using Stripe BACS Direct Debit

For more information on Stripe Direct Debit, please view the following two resources:

+ [Payment Profiles via API for Stripe BACS Direct Debit]($e/Payment%20Profiles/createPaymentProfile)

+ [Full documentation on Stripe Direct Debit](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405050826765-Stripe-SEPA-and-BECS-Direct-Debit)

+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](page:development-tools/chargify-js/examples#minimal-example-with-sepa-becs-or-bacs-direct-debit-stripe-gateway)

+ [Using Chargify.js with Stripe BACS Direct Debit - full example](page:development-tools/chargify-js/examples#full-example-with-bacs-direct-debit-stripe-gateway)

```json
{
"subscription": {
"product_handle": "gold-product",
"customer_attributes": {
"first_name": "Jane",
"last_name": "Doe",
"email": "[email protected]"
},
"bank_account_attributes": {
"bank_name": "Test Bank",
"bank_branch_code": "108800",
"bank_account_number": "00012345",
"payment_type": "bank_account",
"billing_address": "123 Main St.",
"billing_city": "London",
"billing_state": "LND",
"billing_zip": "W1A 1AA",
"billing_country": "GB"
}
}
}
```

## 3D Secure - Stripe

It may happen that a payment needs 3D Secure Authentication when the subscription is created; this is referred to in our help docs as a [post-authentication flow](https://maxio-chargify.zendesk.com/hc/en-us/articles/5405177432077#psd2-flows-pre-authentication-and-post-authentication). The server returns `422 Unprocessable Entity` in this case with the following response:
Expand Down
6 changes: 3 additions & 3 deletions doc/models/billing-manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
| `TotalDiscountInCents` | `*int64` | Optional | - |
| `TotalTaxInCents` | `*int64` | Optional | - |
| `SubtotalInCents` | `*int64` | Optional | - |
| `StartDate` | `*time.Time` | Optional | - |
| `EndDate` | `*time.Time` | Optional | - |
| `PeriodType` | `*string` | Optional | - |
| `StartDate` | `models.Optional[time.Time]` | Optional | - |
| `EndDate` | `models.Optional[time.Time]` | Optional | - |
| `PeriodType` | `models.Optional[string]` | Optional | - |
| `ExistingBalanceInCents` | `*int64` | Optional | - |

## Example (as JSON)
Expand Down
2 changes: 1 addition & 1 deletion doc/models/component-price-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| `Name` | `*string` | Optional | - |
| `PricingScheme` | [`*models.PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. |
| `ComponentId` | `*int` | Optional | - |
| `Handle` | `*string` | Optional | - |
| `Handle` | `models.Optional[string]` | Optional | - |
| `ArchivedAt` | `models.Optional[time.Time]` | Optional | - |
| `CreatedAt` | `*time.Time` | Optional | - |
| `UpdatedAt` | `*time.Time` | Optional | - |
Expand Down
2 changes: 1 addition & 1 deletion doc/models/component.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
| `OveragePrices` | [`models.Optional[[]models.ComponentPrice]`](../../doc/models/component-price.md) | Optional | An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty. |
| `Prices` | [`models.Optional[[]models.ComponentPrice]`](../../doc/models/component-price.md) | Optional | An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty. |
| `PricePointCount` | `*int` | Optional | Count for the number of price points associated with the component |
| `PricePointsUrl` | `*string` | Optional | URL that points to the location to read the existing price points via GET request |
| `PricePointsUrl` | `models.Optional[string]` | Optional | URL that points to the location to read the existing price points via GET request |
| `DefaultPricePointName` | `*string` | Optional | - |
| `TaxCode` | `models.Optional[string]` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. |
| `Recurring` | `*bool` | Optional | - |
Expand Down
13 changes: 0 additions & 13 deletions doc/models/containers/coupon-compounding-strategy.md

This file was deleted.

13 changes: 0 additions & 13 deletions doc/models/containers/subscription-component-price-point-type.md

This file was deleted.

2 changes: 1 addition & 1 deletion doc/models/coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
| `ArchivedAt` | `models.Optional[time.Time]` | Optional | - |
| `ConversionLimit` | `models.Optional[string]` | Optional | - |
| `Stackable` | `*bool` | Optional | - |
| `CompoundingStrategy` | [`*models.CouponCompoundingStrategy`](../../doc/models/containers/coupon-compounding-strategy.md) | Optional | This is a container for any-of cases. |
| `CompoundingStrategy` | [`models.Optional[models.CompoundingStrategy]`](../../doc/models/compounding-strategy.md) | Optional | - |
| `UseSiteExchangeRate` | `*bool` | Optional | - |
| `CreatedAt` | `*time.Time` | Optional | - |
| `UpdatedAt` | `*time.Time` | Optional | - |
Expand Down
2 changes: 2 additions & 0 deletions doc/models/create-offer-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `ComponentId` | `*int` | Optional | - |
| `PricePointId` | `*int` | Optional | - |
| `StartingQuantity` | `*int` | Optional | - |

## Example (as JSON)

```json
{
"component_id": 242,
"price_point_id": 10,
"starting_quantity": 50
}
```
Expand Down
2 changes: 2 additions & 0 deletions doc/models/create-offer-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
"components": [
{
"component_id": 108,
"price_point_id": 124,
"starting_quantity": 84
},
{
"component_id": 108,
"price_point_id": 124,
"starting_quantity": 84
}
],
Expand Down
Loading

0 comments on commit dcaf203

Please sign in to comment.