Skip to content

Commit

Permalink
[DE-801] Release 3.0.0 (#77)
Browse files Browse the repository at this point in the history
- Remove default collection method value
- Reorganize `Invoice Event` structure:
  - Invoice Event is now union type
  - Invoice Event Data is no longer union type. Each Invoice Event has it's own invoice_data with a concrete type
  - Added new event_types
- Set usage ids, events ids and invoice event ids as longs
- Add handle parameter for create product family request body
- Add in_use query parameter for listing subscription components
- Remove some redundant models
  • Loading branch information
maciej-nedza authored Jun 5, 2024
1 parent 29a3357 commit 9e78f92
Show file tree
Hide file tree
Showing 127 changed files with 2,205 additions and 1,599 deletions.
24 changes: 12 additions & 12 deletions doc/controllers/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Here’s an example event for the `subscription_state_change` event:
async listEvents(
page?: number,
perPage?: number,
sinceId?: number,
maxId?: number,
sinceId?: bigint,
maxId?: bigint,
direction?: Direction,
filter?: EventType[],
dateField?: ListEventsDateField,
Expand All @@ -103,8 +103,8 @@ async listEvents(
| --- | --- | --- | --- |
| `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.<br>Use in query `page=1`. |
| `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.<br>Use in query `per_page=200`. |
| `sinceId` | `number \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `number \| undefined` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `sinceId` | `bigint \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `bigint \| undefined` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`Direction \| undefined`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events. |
| `filter` | [`EventType[] \| undefined`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.<br>Use in query `filter=signup_success,payment_success`. |
| `dateField` | [`ListEventsDateField \| undefined`](../../doc/models/list-events-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. |
Expand Down Expand Up @@ -217,8 +217,8 @@ async listSubscriptionEvents(
subscriptionId: number,
page?: number,
perPage?: number,
sinceId?: number,
maxId?: number,
sinceId?: bigint,
maxId?: bigint,
direction?: Direction,
filter?: EventType[],
requestOptions?: RequestOptions
Expand All @@ -232,8 +232,8 @@ async listSubscriptionEvents(
| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription |
| `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.<br>Use in query `page=1`. |
| `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.<br>Use in query `per_page=200`. |
| `sinceId` | `number \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `number \| undefined` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `sinceId` | `bigint \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `bigint \| undefined` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`Direction \| undefined`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events. |
| `filter` | [`EventType[] \| undefined`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.<br>Use in query `filter=signup_success,payment_success`. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
Expand Down Expand Up @@ -319,8 +319,8 @@ Get a count of all the events for a given site by using this method.
async readEventsCount(
page?: number,
perPage?: number,
sinceId?: number,
maxId?: number,
sinceId?: bigint,
maxId?: bigint,
direction?: Direction,
filter?: EventType[],
requestOptions?: RequestOptions
Expand All @@ -333,8 +333,8 @@ async readEventsCount(
| --- | --- | --- | --- |
| `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.<br>Use in query `page=1`. |
| `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.<br>Use in query `per_page=200`. |
| `sinceId` | `number \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `number \| undefined` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `sinceId` | `bigint \| undefined` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `bigint \| undefined` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`Direction \| undefined`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events. |
| `filter` | [`EventType[] \| undefined`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.<br>Use in query `filter=signup_success,payment_success`. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
Expand Down
4 changes: 2 additions & 2 deletions doc/controllers/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ Note - invoice events that occurred prior to 09/05/2018 __will not__ contain an
```ts
async listInvoiceEvents(
sinceDate?: string,
sinceId?: number,
sinceId?: bigint,
page?: number,
perPage?: number,
invoiceUid?: string,
Expand All @@ -683,7 +683,7 @@ async listInvoiceEvents(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `sinceDate` | `string \| undefined` | Query, Optional | The timestamp in a format `YYYY-MM-DD T HH:MM:SS Z`, or `YYYY-MM-DD`(in this case, it returns data from the beginning of the day). of the event from which you want to start the search. All the events before the `since_date` timestamp are not returned in the response. |
| `sinceId` | `number \| undefined` | Query, Optional | The ID of the event from which you want to start the search(ID is not included. e.g. if ID is set to 2, then all events with ID 3 and more will be shown) This parameter is not used if since_date is defined. |
| `sinceId` | `bigint \| undefined` | Query, Optional | The ID of the event from which you want to start the search(ID is not included. e.g. if ID is set to 2, then all events with ID 3 and more will be shown) This parameter is not used if since_date is defined. |
| `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.<br>Use in query `page=1`. |
| `perPage` | `number \| undefined` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 100. The maximum allowed values is 200; any per_page value over 200 will be changed to 200. |
| `invoiceUid` | `string \| undefined` | Query, Optional | Providing an invoice_uid allows for scoping of the invoice events to a single invoice or credit note. |
Expand Down
13 changes: 8 additions & 5 deletions doc/controllers/subscription-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ async listSubscriptionComponents(
startDate?: string,
startDatetime?: string,
include?: ListSubscriptionComponentsInclude[],
inUse?: boolean,
requestOptions?: RequestOptions
): Promise<ApiResponse<SubscriptionComponentResponse[]>>
```
Expand All @@ -143,6 +144,7 @@ async listSubscriptionComponents(
| `startDate` | `string \| undefined` | 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 \| undefined` | 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` | [`ListSubscriptionComponentsInclude[] \| undefined`](../../doc/models/list-subscription-components-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=subscription,historic_usages`. |
| `inUse` | `boolean \| undefined` | Query, Optional | If in_use is set to true, it returns only components that are currently in use. However, if it's set to false or not provided, it returns all components connected with the subscription. |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

## Response Type
Expand Down Expand Up @@ -171,7 +173,8 @@ const collect = {
include: [
ListSubscriptionComponentsInclude.Subscription,
ListSubscriptionComponentsInclude.HistoricUsages
]
],
inUse: true
}
try {
const { result, ...httpResponse } = await subscriptionComponentsController.listSubscriptionComponents(collect);
Expand Down Expand Up @@ -1310,8 +1313,8 @@ Use this endpoint to read the previously recorded components for a subscription.
async listUsages(
subscriptionId: number,
componentId: ListUsagesInputComponentId,
sinceId?: number,
maxId?: number,
sinceId?: bigint,
maxId?: bigint,
sinceDate?: string,
untilDate?: string,
page?: number,
Expand All @@ -1326,8 +1329,8 @@ async listUsages(
| --- | --- | --- | --- |
| `subscriptionId` | `number` | Template, Required | The Chargify id of the subscription |
| `componentId` | [`ListUsagesInputComponentId`](../../doc/models/containers/list-usages-input-component-id.md) | Template, Required | This is a container for one-of cases. |
| `sinceId` | `number \| undefined` | Query, Optional | Returns usages with an id greater than or equal to the one specified |
| `maxId` | `number \| undefined` | Query, Optional | Returns usages with an id less than or equal to the one specified |
| `sinceId` | `bigint \| undefined` | Query, Optional | Returns usages with an id greater than or equal to the one specified |
| `maxId` | `bigint \| undefined` | Query, Optional | Returns usages with an id less than or equal to the one specified |
| `sinceDate` | `string \| undefined` | Query, Optional | Returns usages with a created_at date greater than or equal to midnight (12:00 AM) on the date specified. |
| `untilDate` | `string \| undefined` | Query, Optional | Returns usages with a created_at date less than or equal to midnight (12:00 AM) on the date specified. |
| `page` | `number \| undefined` | Query, Optional | Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.<br>Use in query `page=1`. |
Expand Down
2 changes: 1 addition & 1 deletion doc/models/apply-credit-note-event-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Example schema for an `apply_credit_note` event
| `originalAmount` | `string` | Required | The full, original amount of the credit note. |
| `appliedAmount` | `string` | Required | The amount of the credit note applied to invoice. |
| `transactionTime` | `string \| undefined` | Optional | The time the credit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" |
| `memo` | `string \| undefined` | Optional | The credit note memo. |
| `memo` | `string \| null \| undefined` | Optional | The credit note memo. |
| `role` | `string \| undefined` | Optional | The role of the credit note (e.g. 'general') |
| `consolidatedInvoice` | `boolean \| undefined` | Optional | Shows whether it was applied to consolidated invoice or not |
| `appliedCreditNotes` | [`AppliedCreditNoteData[] \| undefined`](../../doc/models/applied-credit-note-data.md) | Optional | List of credit notes applied to children invoices (if consolidated invoice) |
Expand Down
62 changes: 62 additions & 0 deletions doc/models/apply-credit-note-event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

# Apply Credit Note Event

## Structure

`ApplyCreditNoteEvent`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `id` | `bigint` | Required | - |
| `timestamp` | `string` | Required | - |
| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - |
| `eventType` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType.ApplyCreditNote` |
| `eventData` | [`ApplyCreditNoteEventData`](../../doc/models/apply-credit-note-event-data.md) | Required | Example schema for an `apply_credit_note` event |

## Example (as JSON)

```json
{
"id": 214,
"timestamp": "2016-03-13T12:52:32.123Z",
"invoice": {
"issue_date": "2024-01-01",
"due_date": "2024-01-01",
"paid_date": "2024-01-01",
"id": 166,
"uid": "uid6",
"site_id": 92,
"customer_id": 204,
"subscription_id": 20
},
"event_type": "apply_credit_note",
"event_data": {
"uid": "uid6",
"credit_note_number": "credit_note_number0",
"credit_note_uid": "credit_note_uid0",
"original_amount": "original_amount0",
"applied_amount": "applied_amount2",
"transaction_time": "2016-03-13T12:52:32.123Z",
"memo": "memo0",
"role": "role0",
"consolidated_invoice": false,
"applied_credit_notes": [
{
"uid": "uid4",
"number": "number8"
},
{
"uid": "uid4",
"number": "number8"
},
{
"uid": "uid4",
"number": "number8"
}
]
}
}
```

6 changes: 5 additions & 1 deletion doc/models/apply-debit-note-event-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Example schema for an `apply_debit_note` event
| `debitNoteUid` | `string` | Required | Unique identifier for the debit note. It is generated automatically by Chargify and has the prefix "db_" followed by alphanumeric characters. |
| `originalAmount` | `string` | Required | The full, original amount of the debit note. |
| `appliedAmount` | `string` | Required | The amount of the debit note applied to invoice. |
| `memo` | `string \| null \| undefined` | Optional | The debit note memo. |
| `transactionTime` | `string \| null \| undefined` | Optional | The time the debit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" |

## Example (as JSON)

Expand All @@ -23,7 +25,9 @@ Example schema for an `apply_debit_note` event
"debit_note_number": "debit_note_number0",
"debit_note_uid": "debit_note_uid6",
"original_amount": "original_amount4",
"applied_amount": "applied_amount8"
"applied_amount": "applied_amount8",
"memo": "memo4",
"transaction_time": "2016-03-13T12:52:32.123Z"
}
```

45 changes: 45 additions & 0 deletions doc/models/apply-debit-note-event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

# Apply Debit Note Event

## Structure

`ApplyDebitNoteEvent`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `id` | `bigint` | Required | - |
| `timestamp` | `string` | Required | - |
| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - |
| `eventType` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType.ApplyDebitNote` |
| `eventData` | [`ApplyDebitNoteEventData`](../../doc/models/apply-debit-note-event-data.md) | Required | Example schema for an `apply_debit_note` event |

## Example (as JSON)

```json
{
"id": 164,
"timestamp": "2016-03-13T12:52:32.123Z",
"invoice": {
"issue_date": "2024-01-01",
"due_date": "2024-01-01",
"paid_date": "2024-01-01",
"id": 166,
"uid": "uid6",
"site_id": 92,
"customer_id": 204,
"subscription_id": 20
},
"event_type": "apply_debit_note",
"event_data": {
"debit_note_number": "debit_note_number6",
"debit_note_uid": "debit_note_uid2",
"original_amount": "original_amount0",
"applied_amount": "applied_amount2",
"memo": "memo0",
"transaction_time": "2016-03-13T12:52:32.123Z"
}
}
```

2 changes: 2 additions & 0 deletions doc/models/apply-payment-event-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Example schema for an `apply_payment` event

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `consolidationLevel` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Required | - |
| `memo` | `string` | Required | The payment memo |
| `originalAmount` | `string` | Required | The full, original amount of the payment transaction as a string in full units. Incoming payments can be split amongst several invoices, which will result in a `applied_amount` less than the `original_amount`. Example: A $100.99 payment, of which $40.11 is applied to this invoice, will have an `original_amount` of `"100.99"`. |
| `appliedAmount` | `string` | Required | The amount of the payment applied to this invoice. Incoming payments can be split amongst several invoices, which will result in a `applied_amount` less than the `original_amount`. Example: A $100.99 payment, of which $40.11 is applied to this invoice, will have an `applied_amount` of `"40.11"`. |
Expand All @@ -26,6 +27,7 @@ Example schema for an `apply_payment` event

```json
{
"consolidation_level": "child",
"memo": "memo8",
"original_amount": "original_amount8",
"applied_amount": "applied_amount4",
Expand Down
52 changes: 52 additions & 0 deletions doc/models/apply-payment-event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

# Apply Payment Event

## Structure

`ApplyPaymentEvent`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `id` | `bigint` | Required | - |
| `timestamp` | `string` | Required | - |
| `invoice` | [`Invoice`](../../doc/models/invoice.md) | Required | - |
| `eventType` | [`InvoiceEventType`](../../doc/models/invoice-event-type.md) | Required | **Default**: `InvoiceEventType.ApplyPayment` |
| `eventData` | [`ApplyPaymentEventData`](../../doc/models/apply-payment-event-data.md) | Required | Example schema for an `apply_payment` event |

## Example (as JSON)

```json
{
"id": 234,
"timestamp": "2016-03-13T12:52:32.123Z",
"invoice": {
"issue_date": "2024-01-01",
"due_date": "2024-01-01",
"paid_date": "2024-01-01",
"id": 166,
"uid": "uid6",
"site_id": 92,
"customer_id": 204,
"subscription_id": 20
},
"event_type": "apply_payment",
"event_data": {
"consolidation_level": "child",
"memo": "memo0",
"original_amount": "original_amount0",
"applied_amount": "applied_amount2",
"transaction_time": "2016-03-13T12:52:32.123Z",
"payment_method": {
"type": "apple_pay"
},
"transaction_id": 78,
"parent_invoice_number": 36,
"remaining_prepayment_amount": "remaining_prepayment_amount6",
"prepayment": false,
"external": false
}
}
```

Loading

0 comments on commit 9e78f92

Please sign in to comment.