Skip to content

Commit

Permalink
[DE-827] Set new long types, new invoice event types, fix test env (#135
Browse files Browse the repository at this point in the history
)

- Set usage ids, events ids and invoice event ids as longs,
- Set Invoice Event id to long
- Add new invoice event data types
- Add handle parameter for create product family request body
- Add in_use query parameter for listing subscription components
  • Loading branch information
maciej-nedza authored May 22, 2024
1 parent a603227 commit d1b7fbf
Show file tree
Hide file tree
Showing 78 changed files with 7,336 additions and 626 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Install the SDK by adding the following dependency in your project's pom.xml fil
```

You can also view the package at:
https://mvnrepository.com/artifact/com.maxio/advanced-billing-sdk/3.0.0
https://central.sonatype.com/artifact/com.maxio/advanced-billing-sdk/3.0.0

## Initialize the API Client

Expand All @@ -51,7 +51,7 @@ The following parameters are configurable for the API Client:
| `subdomain` | `String` | The subdomain for your Chargify site.<br>*Default*: `"subdomain"` |
| `domain` | `String` | The Chargify server domain.<br>*Default*: `"chargify.com"` |
| `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
| `httpClientConfig` | [`ReadonlyHttpClientConfiguration`](https://www.github.com/maxio-com/ab-java-sdk/tree/3.0.0/doc/http-client-configuration.md) | Http Client Configuration instance. |
| `httpClientConfig` | [`Consumer<HttpClientConfiguration.Builder>`](https://www.github.com/maxio-com/ab-java-sdk/tree/3.0.0/doc/http-client-configuration-builder.md) | Set up Http Client Configuration instance. |
| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-java-sdk/tree/3.0.0/doc/$a/https://www.github.com/maxio-com/ab-java-sdk/tree/3.0.0/basic-authentication.md) | The Credentials Setter for Basic Authentication |

The API client can be initialized as follows:
Expand Down
2 changes: 1 addition & 1 deletion doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The following parameters are configurable for the API Client:
| `subdomain` | `String` | The subdomain for your Chargify site.<br>*Default*: `"subdomain"` |
| `domain` | `String` | The Chargify server domain.<br>*Default*: `"chargify.com"` |
| `environment` | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
| `httpClientConfig` | [`ReadonlyHttpClientConfiguration`](http-client-configuration.md) | Http Client Configuration instance. |
| `httpClientConfig` | [`Consumer<HttpClientConfiguration.Builder>`](http-client-configuration-builder.md) | Set up Http Client Configuration instance. |
| `basicAuthCredentials` | [`BasicAuthCredentials`]($a/basic-authentication.md) | The Credentials Setter for Basic Authentication |

The API client can be initialized as follows:
Expand Down
12 changes: 6 additions & 6 deletions doc/controllers/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ List<EventResponse> listEvents(
| --- | --- | --- | --- |
| `page` | `Integer` | 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` | `Integer` | 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` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `Integer` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `sinceId` | `Long` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `Long` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events. |
| `filter` | [`List<EventType>`](../../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`](../../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 @@ -210,8 +210,8 @@ List<EventResponse> listSubscriptionEvents(
| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription |
| `page` | `Integer` | 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` | `Integer` | 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` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `Integer` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `sinceId` | `Long` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `Long` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events. |
| `filter` | [`List<EventType>`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.<br>Use in query `filter=signup_success,payment_success`. |

Expand Down Expand Up @@ -303,8 +303,8 @@ CountResponse readEventsCount(
| --- | --- | --- | --- |
| `page` | `Integer` | 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` | `Integer` | 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` | `Integer` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `Integer` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `sinceId` | `Long` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `Long` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events. |
| `filter` | [`List<EventType>`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.<br>Use in query `filter=signup_success,payment_success`. |

Expand Down
2 changes: 1 addition & 1 deletion doc/controllers/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ ListInvoiceEventsResponse listInvoiceEvents(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `sinceDate` | `String` | 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` | `Integer` | 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` | `Long` | 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` | `Integer` | 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` | `Integer` | 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` | Query, Optional | Providing an invoice_uid allows for scoping of the invoice events to a single invoice or credit note. |
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: 5 additions & 4 deletions doc/controllers/product-families.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ ProductFamilyResponse createProductFamily(

```java
CreateProductFamilyRequest body = new CreateProductFamilyRequest.Builder(
new CreateProductFamily.Builder()
.name("Acme Projects")
.description("Amazing project management tool")
.build()
new CreateProductFamily.Builder(
"Acme Projects"
)
.description("Amazing project management tool")
.build()
)
.build();

Expand Down
6 changes: 4 additions & 2 deletions doc/controllers/subscription-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ List<SubscriptionComponentResponse> listSubscriptionComponents(
| `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` | [`List<ListSubscriptionComponentsInclude>`](../../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` | 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. |

## Response Type

Expand Down Expand Up @@ -150,6 +151,7 @@ ListSubscriptionComponentsInput listSubscriptionComponentsInput = new ListSubscr
ListSubscriptionComponentsInclude.SUBSCRIPTION,
ListSubscriptionComponentsInclude.HISTORIC_USAGES
))
.inUse(true)
.build();

try {
Expand Down Expand Up @@ -1219,8 +1221,8 @@ List<UsageResponse> listUsages(
| --- | --- | --- | --- |
| `subscriptionId` | `int` | 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` | `Integer` | Query, Optional | Returns usages with an id greater than or equal to the one specified |
| `maxId` | `Integer` | Query, Optional | Returns usages with an id less than or equal to the one specified |
| `sinceId` | `Long` | Query, Optional | Returns usages with an id greater than or equal to the one specified |
| `maxId` | `Long` | Query, Optional | Returns usages with an id less than or equal to the one specified |
| `sinceDate` | `LocalDate` | Query, Optional | Returns usages with a created_at date greater than or equal to midnight (12:00 AM) on the date specified. |
| `untilDate` | `LocalDate` | Query, Optional | Returns usages with a created_at date less than or equal to midnight (12:00 AM) on the date specified. |
| `page` | `Integer` | 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
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: 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. | String getDebitNoteUid() | setDebitNoteUid(String debitNoteUid) |
| `OriginalAmount` | `String` | Required | The full, original amount of the debit note. | String getOriginalAmount() | setOriginalAmount(String originalAmount) |
| `AppliedAmount` | `String` | Required | The amount of the debit note applied to invoice. | String getAppliedAmount() | setAppliedAmount(String appliedAmount) |
| `Memo` | `String` | Optional | The debit note memo. | String getMemo() | setMemo(String memo) |
| `TransactionTime` | `ZonedDateTime` | Optional | The time the debit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z" | ZonedDateTime getTransactionTime() | setTransactionTime(ZonedDateTime transactionTime) |

## 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"
}
```

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 | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `ConsolidationLevel` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Required | - | InvoiceConsolidationLevel getConsolidationLevel() | setConsolidationLevel(InvoiceConsolidationLevel consolidationLevel) |
| `Memo` | `String` | Required | The payment memo | String getMemo() | setMemo(String 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"`. | String getOriginalAmount() | setOriginalAmount(String originalAmount) |
| `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"`. | String getAppliedAmount() | setAppliedAmount(String appliedAmount) |
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
Loading

0 comments on commit d1b7fbf

Please sign in to comment.