Skip to content

Commit

Permalink
DE-117 Code fixes for Java
Browse files Browse the repository at this point in the history
Contains fixes:
DE-117 DE-629 Fix dates for invoices
DE-117 DE-629 Fix statuses for invoices
DE-643 Fix subscription component subscription state
DE-598: added null option for update coupon endpoint
  • Loading branch information
michalpierog authored Dec 14, 2023
1 parent 62f81fb commit 39f2185
Show file tree
Hide file tree
Showing 24 changed files with 382 additions and 224 deletions.
8 changes: 4 additions & 4 deletions doc/controllers/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ ListInvoicesResponse listInvoices(
| --- | --- | --- | --- |
| `startDate` | `String` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns invoices with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
| `endDate` | `String` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns invoices with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. |
| `status` | [`Status`](../../doc/models/status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided |
| `status` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided |
| `subscriptionId` | `Integer` | Query, Optional | The subscription's ID. |
| `subscriptionGroupUid` | `String` | Query, Optional | The UID of the subscription group you want to fetch consolidated invoices for. This will return a paginated list of consolidated invoices for the specified group. |
| `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`.<br>**Default**: `1`<br>**Constraints**: `>= 1` |
Expand Down Expand Up @@ -2913,9 +2913,9 @@ try {
"subscription_id": 12801726,
"number": "dolore et ut",
"sequence_number": -84210096,
"issue_date": "in e",
"due_date": "magna elit tempor occaecat amet",
"paid_date": "consectetur elit culpa magna sint",
"issue_date": "2017-01-01",
"due_date": "2017-01-30",
"paid_date": "2017-01-28",
"status": "open",
"collection_method": "Excepteur",
"payment_instructions": "enim officia",
Expand Down
2 changes: 1 addition & 1 deletion doc/controllers/proforma-invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ List<ProformaInvoice> listProformaInvoices(
| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription |
| `startDate` | `String` | Query, Optional | The beginning date range for the invoice's Due Date, in the YYYY-MM-DD format. |
| `endDate` | `String` | Query, Optional | The ending date range for the invoice's Due Date, in the YYYY-MM-DD format. |
| `status` | [`Status`](../../doc/models/status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided |
| `status` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Query, Optional | The current status of the invoice. Allowed Values: draft, open, paid, pending, voided |
| `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`.<br>**Default**: `1`<br>**Constraints**: `>= 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`.<br>**Default**: `20`<br>**Constraints**: `<= 200` |
| `direction` | [`Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned invoices.<br>**Default**: `Direction.DESC` |
Expand Down
2 changes: 1 addition & 1 deletion doc/models/create-invoice-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
```json
{
"invoice": {
"issue_date": "2024-01-01",
"status": "draft",
"line_items": [
{
Expand All @@ -40,7 +41,6 @@
"tax_code": "tax_code6"
}
],
"issue_date": "issue_date8",
"net_terms": 144,
"payment_instructions": "payment_instructions6",
"memo": "memo0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# Status 1
# Create Invoice Status

## Enumeration

`Status1`
`CreateInvoiceStatus`

## Fields

Expand Down
6 changes: 3 additions & 3 deletions doc/models/create-invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `LineItems` | [`List<CreateInvoiceItem>`](../../doc/models/create-invoice-item.md) | Optional | - | List<CreateInvoiceItem> getLineItems() | setLineItems(List<CreateInvoiceItem> lineItems) |
| `IssueDate` | `String` | Optional | - | String getIssueDate() | setIssueDate(String issueDate) |
| `IssueDate` | `LocalDate` | Optional | - | LocalDate getIssueDate() | setIssueDate(LocalDate issueDate) |
| `NetTerms` | `Integer` | Optional | By default, invoices will be created with a due date matching the date of invoice creation. If a different due date is desired, the net_terms parameter can be sent indicating the number of days in advance the due date should be. | Integer getNetTerms() | setNetTerms(Integer netTerms) |
| `PaymentInstructions` | `String` | Optional | - | String getPaymentInstructions() | setPaymentInstructions(String paymentInstructions) |
| `Memo` | `String` | Optional | A custom memo can be sent to override the site's default. | String getMemo() | setMemo(String memo) |
| `SellerAddress` | [`CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the defaults for the site | CreateInvoiceAddress getSellerAddress() | setSellerAddress(CreateInvoiceAddress sellerAddress) |
| `BillingAddress` | [`CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer | CreateInvoiceAddress getBillingAddress() | setBillingAddress(CreateInvoiceAddress billingAddress) |
| `ShippingAddress` | [`CreateInvoiceAddress`](../../doc/models/create-invoice-address.md) | Optional | Overrides the default for the customer | CreateInvoiceAddress getShippingAddress() | setShippingAddress(CreateInvoiceAddress shippingAddress) |
| `Coupons` | [`List<CreateInvoiceCoupon>`](../../doc/models/create-invoice-coupon.md) | Optional | - | List<CreateInvoiceCoupon> getCoupons() | setCoupons(List<CreateInvoiceCoupon> coupons) |
| `Status` | [`Status1`](../../doc/models/status-1.md) | Optional | **Default**: `Status1.OPEN` | Status1 getStatus() | setStatus(Status1 status) |
| `Status` | [`CreateInvoiceStatus`](../../doc/models/create-invoice-status.md) | Optional | **Default**: `CreateInvoiceStatus.OPEN` | CreateInvoiceStatus getStatus() | setStatus(CreateInvoiceStatus status) |

## Example (as JSON)

```json
{
"issue_date": "2024-01-01",
"status": "draft",
"line_items": [
{
Expand All @@ -34,7 +35,6 @@
"tax_code": "tax_code6"
}
],
"issue_date": "issue_date2",
"net_terms": 18,
"payment_instructions": "payment_instructions0",
"memo": "memo6"
Expand Down
4 changes: 2 additions & 2 deletions doc/models/invoice-event-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ The event data is the data that, when combined with the command, results in the
| `FromCollectionMethod` | `String` | Optional | The previous collection method of the invoice. | String getFromCollectionMethod() | setFromCollectionMethod(String fromCollectionMethod) |
| `ToCollectionMethod` | `String` | Optional | The new collection method of the invoice. | String getToCollectionMethod() | setToCollectionMethod(String toCollectionMethod) |
| `ConsolidationLevel` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:<br><br>* "none": A normal invoice with no consolidation.<br>* "child": An invoice segment which has been combined into a consolidated invoice.<br>* "parent": A consolidated invoice, whose contents are composed of invoice segments.<br><br>"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.<br><br>See also the [invoice consolidation documentation](https://chargify.zendesk.com/hc/en-us/articles/4407746391835). | InvoiceConsolidationLevel getConsolidationLevel() | setConsolidationLevel(InvoiceConsolidationLevel consolidationLevel) |
| `FromStatus` | [`Status`](../../doc/models/status.md) | Optional | The status of the invoice before event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | Status getFromStatus() | setFromStatus(Status fromStatus) |
| `ToStatus` | [`Status`](../../doc/models/status.md) | Optional | The status of the invoice after event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | Status getToStatus() | setToStatus(Status toStatus) |
| `FromStatus` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The status of the invoice before event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | InvoiceStatus getFromStatus() | setFromStatus(InvoiceStatus fromStatus) |
| `ToStatus` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The status of the invoice after event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | InvoiceStatus getToStatus() | setToStatus(InvoiceStatus toStatus) |
| `DueAmount` | `String` | Optional | Amount due on the invoice, which is `total_amount - credit_amount - paid_amount`. | String getDueAmount() | setDueAmount(String dueAmount) |
| `TotalAmount` | `String` | Optional | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.' | String getTotalAmount() | setTotalAmount(String totalAmount) |
| `ApplyCredit` | `Boolean` | Optional | If true, credit was created and applied it to the invoice. | Boolean getApplyCredit() | setApplyCredit(Boolean applyCredit) |
Expand Down
3 changes: 3 additions & 0 deletions doc/models/invoice-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
```json
{
"invoice": {
"issue_date": "2024-01-01",
"due_date": "2024-01-01",
"paid_date": "2024-01-01",
"id": 166,
"uid": "uid6",
"site_id": 92,
Expand Down
4 changes: 2 additions & 2 deletions doc/models/status.md → doc/models/invoice-status.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

# Status
# Invoice Status

The current status of the invoice. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more.

## Enumeration

`Status`
`InvoiceStatus`

## Fields

Expand Down
11 changes: 7 additions & 4 deletions doc/models/invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
| `TransactionTime` | `ZonedDateTime` | Optional | - | ZonedDateTime getTransactionTime() | setTransactionTime(ZonedDateTime transactionTime) |
| `CreatedAt` | `ZonedDateTime` | Optional | - | ZonedDateTime getCreatedAt() | setCreatedAt(ZonedDateTime createdAt) |
| `UpdatedAt` | `ZonedDateTime` | Optional | - | ZonedDateTime getUpdatedAt() | setUpdatedAt(ZonedDateTime updatedAt) |
| `IssueDate` | `String` | Optional | Date the invoice was issued to the customer. This is the date that the invoice was made available for payment.<br><br>The format is `"YYYY-MM-DD"`. | String getIssueDate() | setIssueDate(String issueDate) |
| `DueDate` | `String` | Optional | Date the invoice is due.<br><br>The format is `"YYYY-MM-DD"`. | String getDueDate() | setDueDate(String dueDate) |
| `PaidDate` | `String` | Optional | Date the invoice became fully paid.<br><br>If partial payments are applied to the invoice, this date will not be present until payment has been made in full.<br><br>The format is `"YYYY-MM-DD"`. | String getPaidDate() | setPaidDate(String paidDate) |
| `Status` | [`Status`](../../doc/models/status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | Status getStatus() | setStatus(Status status) |
| `IssueDate` | `LocalDate` | Optional | Date the invoice was issued to the customer. This is the date that the invoice was made available for payment.<br><br>The format is `"YYYY-MM-DD"`. | LocalDate getIssueDate() | setIssueDate(LocalDate issueDate) |
| `DueDate` | `LocalDate` | Optional | Date the invoice is due.<br><br>The format is `"YYYY-MM-DD"`. | LocalDate getDueDate() | setDueDate(LocalDate dueDate) |
| `PaidDate` | `LocalDate` | Optional | Date the invoice became fully paid.<br><br>If partial payments are applied to the invoice, this date will not be present until payment has been made in full.<br><br>The format is `"YYYY-MM-DD"`. | LocalDate getPaidDate() | setPaidDate(LocalDate paidDate) |
| `Status` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | InvoiceStatus getStatus() | setStatus(InvoiceStatus status) |
| `Role` | `String` | Optional | - | String getRole() | setRole(String role) |
| `ParentInvoiceId` | `Integer` | Optional | - | Integer getParentInvoiceId() | setParentInvoiceId(Integer parentInvoiceId) |
| `CollectionMethod` | `String` | Optional | The collection method of the invoice, which is either "automatic" (tried and retried on an existing payment method by Chargify) or "remittance" (payment must be remitted by the customer or keyed in by the merchant). | String getCollectionMethod() | setCollectionMethod(String collectionMethod) |
Expand Down Expand Up @@ -66,6 +66,9 @@

```json
{
"issue_date": "2024-01-01",
"due_date": "2024-01-01",
"paid_date": "2024-01-01",
"id": 252,
"uid": "uid0",
"site_id": 178,
Expand Down
4 changes: 2 additions & 2 deletions doc/models/issue-invoice-event-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Example schema for an `issue_invoice` event
| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `ConsolidationLevel` | [`InvoiceConsolidationLevel`](../../doc/models/invoice-consolidation-level.md) | Optional | Consolidation level of the invoice, which is applicable to invoice consolidation. It will hold one of the following values:<br><br>* "none": A normal invoice with no consolidation.<br>* "child": An invoice segment which has been combined into a consolidated invoice.<br>* "parent": A consolidated invoice, whose contents are composed of invoice segments.<br><br>"Parent" invoices do not have lines of their own, but they have subtotals and totals which aggregate the member invoice segments.<br><br>See also the [invoice consolidation documentation](https://chargify.zendesk.com/hc/en-us/articles/4407746391835). | InvoiceConsolidationLevel getConsolidationLevel() | setConsolidationLevel(InvoiceConsolidationLevel consolidationLevel) |
| `FromStatus` | [`Status`](../../doc/models/status.md) | Optional | The status of the invoice before event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | Status getFromStatus() | setFromStatus(Status fromStatus) |
| `ToStatus` | [`Status`](../../doc/models/status.md) | Optional | The status of the invoice after event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | Status getToStatus() | setToStatus(Status toStatus) |
| `FromStatus` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The status of the invoice before event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | InvoiceStatus getFromStatus() | setFromStatus(InvoiceStatus fromStatus) |
| `ToStatus` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The status of the invoice after event occurence. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | InvoiceStatus getToStatus() | setToStatus(InvoiceStatus toStatus) |
| `DueAmount` | `String` | Optional | Amount due on the invoice, which is `total_amount - credit_amount - paid_amount`. | String getDueAmount() | setDueAmount(String dueAmount) |
| `TotalAmount` | `String` | Optional | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.' | String getTotalAmount() | setTotalAmount(String totalAmount) |

Expand Down
3 changes: 3 additions & 0 deletions doc/models/list-invoices-response.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
{
"invoices": [
{
"issue_date": "2024-01-01",
"due_date": "2024-01-01",
"paid_date": "2024-01-01",
"id": 196,
"uid": "uid6",
"site_id": 122,
Expand Down
2 changes: 1 addition & 1 deletion doc/models/payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `InvoiceUid` | `String` | Optional | The uid of the paid invoice | String getInvoiceUid() | setInvoiceUid(String invoiceUid) |
| `Status` | [`Status`](../../doc/models/status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | Status getStatus() | setStatus(Status status) |
| `Status` | [`InvoiceStatus`](../../doc/models/invoice-status.md) | Optional | The current status of the invoice. See [Invoice Statuses](https://chargify.zendesk.com/hc/en-us/articles/4407737494171#line-item-breakdowns) for more. | InvoiceStatus getStatus() | setStatus(InvoiceStatus status) |
| `DueAmount` | `String` | Optional | The remaining due amount on the invoice | String getDueAmount() | setDueAmount(String dueAmount) |
| `PaidAmount` | `String` | Optional | The total amount paid on this invoice (including any prior payments) | String getPaidAmount() | setPaidAmount(String paidAmount) |

Expand Down
Loading

0 comments on commit 39f2185

Please sign in to comment.