Skip to content

Commit

Permalink
[DE-736] Add enums for proforma invoice and invoice (#114)
Browse files Browse the repository at this point in the history
- Add enums for proforma invoices and invoices properties:
  - Invoice Discount Source Type
  - Invoice Discount Type
  - Proforma Invoice Discount Source Type
  - Proforma Invoice Role
  - Proforma Invoice Status
  - Tax Source Type
- Remove `ProformaTaxBreakout`, use `InvoiceTaxBreakout` instead
- Make Proforma Invoice reuse `InvoiceConsolidationLevel` and `CollectionMethod` enums instead of strings
  • Loading branch information
maciej-nedza authored Feb 26, 2024
1 parent 50f34e6 commit 68b7d87
Show file tree
Hide file tree
Showing 35 changed files with 915 additions and 324 deletions.
2 changes: 1 addition & 1 deletion doc/controllers/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -3012,7 +3012,7 @@ try {
],
"taxes": [
{
"source_type": "enim",
"source_type": "Tax",
"line_item_breakouts": [
{
"uid": "in ipsum",
Expand Down
15 changes: 15 additions & 0 deletions doc/models/invoice-discount-source-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Invoice Discount Source Type

## Enumeration

`InvoiceDiscountSourceType`

## Fields

| Name |
| --- |
| `Coupon` |
| `Referral` |
| `EnumAdHocCoupon` |

15 changes: 15 additions & 0 deletions doc/models/invoice-discount-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Invoice Discount Type

## Enumeration

`InvoiceDiscountType`

## Fields

| Name |
| --- |
| `Percentage` |
| `FlatAmount` |
| `Rollover` |

6 changes: 3 additions & 3 deletions doc/models/invoice-discount.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
| `Title` | `String` | Optional | - | String getTitle() | setTitle(String title) |
| `Description` | `String` | Optional | - | String getDescription() | setDescription(String description) |
| `Code` | `String` | Optional | - | String getCode() | setCode(String code) |
| `SourceType` | `String` | Optional | - | String getSourceType() | setSourceType(String sourceType) |
| `SourceType` | [`InvoiceDiscountSourceType`](../../doc/models/invoice-discount-source-type.md) | Optional | - | InvoiceDiscountSourceType getSourceType() | setSourceType(InvoiceDiscountSourceType sourceType) |
| `SourceId` | `Integer` | Optional | - | Integer getSourceId() | setSourceId(Integer sourceId) |
| `DiscountType` | `String` | Optional | - | String getDiscountType() | setDiscountType(String discountType) |
| `DiscountType` | [`InvoiceDiscountType`](../../doc/models/invoice-discount-type.md) | Optional | - | InvoiceDiscountType getDiscountType() | setDiscountType(InvoiceDiscountType discountType) |
| `Percentage` | `String` | Optional | - | String getPercentage() | setPercentage(String percentage) |
| `EligibleAmount` | `String` | Optional | - | String getEligibleAmount() | setEligibleAmount(String eligibleAmount) |
| `DiscountAmount` | `String` | Optional | - | String getDiscountAmount() | setDiscountAmount(String discountAmount) |
Expand All @@ -30,7 +30,7 @@
"title": "title4",
"description": "description0",
"code": "code8",
"source_type": "source_type0"
"source_type": "Coupon"
}
```

4 changes: 3 additions & 1 deletion doc/models/invoice-tax-breakout.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
| `Uid` | `String` | Optional | - | String getUid() | setUid(String uid) |
| `TaxableAmount` | `String` | Optional | - | String getTaxableAmount() | setTaxableAmount(String taxableAmount) |
| `TaxAmount` | `String` | Optional | - | String getTaxAmount() | setTaxAmount(String taxAmount) |
| `TaxExemptAmount` | `String` | Optional | - | String getTaxExemptAmount() | setTaxExemptAmount(String taxExemptAmount) |

## Example (as JSON)

```json
{
"uid": "uid2",
"taxable_amount": "taxable_amount6",
"tax_amount": "tax_amount6"
"tax_amount": "tax_amount6",
"tax_exempt_amount": "tax_exempt_amount2"
}
```

4 changes: 2 additions & 2 deletions doc/models/invoice-tax.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| `Uid` | `String` | Optional | - | String getUid() | setUid(String uid) |
| `Title` | `String` | Optional | - | String getTitle() | setTitle(String title) |
| `Description` | `String` | Optional | - | String getDescription() | setDescription(String description) |
| `SourceType` | `String` | Optional | - | String getSourceType() | setSourceType(String sourceType) |
| `SourceType` | [`ProformaInvoiceTaxSourceType`](../../doc/models/proforma-invoice-tax-source-type.md) | Optional | - | ProformaInvoiceTaxSourceType getSourceType() | setSourceType(ProformaInvoiceTaxSourceType sourceType) |
| `SourceId` | `Integer` | Optional | - | Integer getSourceId() | setSourceId(Integer sourceId) |
| `Percentage` | `String` | Optional | - | String getPercentage() | setPercentage(String percentage) |
| `TaxableAmount` | `String` | Optional | - | String getTaxableAmount() | setTaxableAmount(String taxableAmount) |
Expand All @@ -28,7 +28,7 @@
"uid": "uid8",
"title": "title6",
"description": "description2",
"source_type": "source_type8",
"source_type": "Tax",
"source_id": 164
}
```
Expand Down
14 changes: 14 additions & 0 deletions doc/models/proforma-invoice-discount-source-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Proforma Invoice Discount Source Type

## Enumeration

`ProformaInvoiceDiscountSourceType`

## Fields

| Name |
| --- |
| `Coupon` |
| `Referral` |

8 changes: 4 additions & 4 deletions doc/models/proforma-invoice-discount.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
| `Uid` | `String` | Optional | - | String getUid() | setUid(String uid) |
| `Title` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getTitle() | setTitle(String title) |
| `Code` | `String` | Optional | - | String getCode() | setCode(String code) |
| `SourceType` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getSourceType() | setSourceType(String sourceType) |
| `DiscountType` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getDiscountType() | setDiscountType(String discountType) |
| `SourceType` | [`ProformaInvoiceDiscountSourceType`](../../doc/models/proforma-invoice-discount-source-type.md) | Optional | - | ProformaInvoiceDiscountSourceType getSourceType() | setSourceType(ProformaInvoiceDiscountSourceType sourceType) |
| `DiscountType` | [`InvoiceDiscountType`](../../doc/models/invoice-discount-type.md) | Optional | - | InvoiceDiscountType getDiscountType() | setDiscountType(InvoiceDiscountType discountType) |
| `EligibleAmount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getEligibleAmount() | setEligibleAmount(String eligibleAmount) |
| `DiscountAmount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getDiscountAmount() | setDiscountAmount(String discountAmount) |
| `LineItemBreakouts` | [`List<InvoiceDiscountBreakout>`](../../doc/models/invoice-discount-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | List<InvoiceDiscountBreakout> getLineItemBreakouts() | setLineItemBreakouts(List<InvoiceDiscountBreakout> lineItemBreakouts) |
Expand All @@ -25,8 +25,8 @@
"uid": "uid2",
"title": "title8",
"code": "code0",
"source_type": "source_type2",
"discount_type": "discount_type0"
"source_type": "Coupon",
"discount_type": "percentage"
}
```

18 changes: 18 additions & 0 deletions doc/models/proforma-invoice-role.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

# Proforma Invoice Role

'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic

## Enumeration

`ProformaInvoiceRole`

## Fields

| Name |
| --- |
| `Unset` |
| `Proforma` |
| `ProformaAdhoc` |
| `ProformaAutomatic` |

15 changes: 15 additions & 0 deletions doc/models/proforma-invoice-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# Proforma Invoice Status

## Enumeration

`ProformaInvoiceStatus`

## Fields

| Name |
| --- |
| `Draft` |
| `Voided` |
| `Archived` |

23 changes: 0 additions & 23 deletions doc/models/proforma-invoice-tax-breakout.md

This file was deleted.

14 changes: 14 additions & 0 deletions doc/models/proforma-invoice-tax-source-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Proforma Invoice Tax Source Type

## Enumeration

`ProformaInvoiceTaxSourceType`

## Fields

| Name |
| --- |
| `Tax` |
| `Avalara` |

6 changes: 3 additions & 3 deletions doc/models/proforma-invoice-tax.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
| --- | --- | --- | --- | --- | --- |
| `Uid` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getUid() | setUid(String uid) |
| `Title` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getTitle() | setTitle(String title) |
| `SourceType` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getSourceType() | setSourceType(String sourceType) |
| `SourceType` | [`ProformaInvoiceTaxSourceType`](../../doc/models/proforma-invoice-tax-source-type.md) | Optional | - | ProformaInvoiceTaxSourceType getSourceType() | setSourceType(ProformaInvoiceTaxSourceType sourceType) |
| `Percentage` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getPercentage() | setPercentage(String percentage) |
| `TaxableAmount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getTaxableAmount() | setTaxableAmount(String taxableAmount) |
| `TaxAmount` | `String` | Optional | **Constraints**: *Minimum Length*: `1` | String getTaxAmount() | setTaxAmount(String taxAmount) |
| `LineItemBreakouts` | [`List<ProformaInvoiceTaxBreakout>`](../../doc/models/proforma-invoice-tax-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | List<ProformaInvoiceTaxBreakout> getLineItemBreakouts() | setLineItemBreakouts(List<ProformaInvoiceTaxBreakout> lineItemBreakouts) |
| `LineItemBreakouts` | [`List<InvoiceTaxBreakout>`](../../doc/models/invoice-tax-breakout.md) | Optional | **Constraints**: *Minimum Items*: `1`, *Unique Items Required* | List<InvoiceTaxBreakout> getLineItemBreakouts() | setLineItemBreakouts(List<InvoiceTaxBreakout> lineItemBreakouts) |

## Example (as JSON)

```json
{
"uid": "uid8",
"title": "title4",
"source_type": "source_type8",
"source_type": "Tax",
"percentage": "percentage6",
"taxable_amount": "taxable_amount2"
}
Expand Down
9 changes: 5 additions & 4 deletions doc/models/proforma-invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
| `SequenceNumber` | `Integer` | Optional | - | Integer getSequenceNumber() | setSequenceNumber(Integer sequenceNumber) |
| `CreatedAt` | `ZonedDateTime` | Optional | - | ZonedDateTime getCreatedAt() | setCreatedAt(ZonedDateTime createdAt) |
| `DeliveryDate` | `LocalDate` | Optional | - | LocalDate getDeliveryDate() | setDeliveryDate(LocalDate deliveryDate) |
| `Status` | `String` | Optional | - | String getStatus() | setStatus(String status) |
| `CollectionMethod` | `String` | Optional | - | String getCollectionMethod() | setCollectionMethod(String collectionMethod) |
| `Status` | [`ProformaInvoiceStatus`](../../doc/models/proforma-invoice-status.md) | Optional | - | ProformaInvoiceStatus getStatus() | setStatus(ProformaInvoiceStatus status) |
| `CollectionMethod` | [`CollectionMethod`](../../doc/models/collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.<br>**Default**: `CollectionMethod.AUTOMATIC` | CollectionMethod getCollectionMethod() | setCollectionMethod(CollectionMethod collectionMethod) |
| `PaymentInstructions` | `String` | Optional | - | String getPaymentInstructions() | setPaymentInstructions(String paymentInstructions) |
| `Currency` | `String` | Optional | - | String getCurrency() | setCurrency(String currency) |
| `ConsolidationLevel` | `String` | Optional | - | String getConsolidationLevel() | setConsolidationLevel(String consolidationLevel) |
| `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) |
| `ProductName` | `String` | Optional | - | String getProductName() | setProductName(String productName) |
| `ProductFamilyName` | `String` | Optional | - | String getProductFamilyName() | setProductFamilyName(String productFamilyName) |
| `Role` | `String` | Optional | - | String getRole() | setRole(String role) |
| `Role` | [`ProformaInvoiceRole`](../../doc/models/proforma-invoice-role.md) | Optional | 'proforma' value is deprecated in favor of proforma_adhoc and proforma_automatic | ProformaInvoiceRole getRole() | setRole(ProformaInvoiceRole role) |
| `Seller` | [`InvoiceSeller`](../../doc/models/invoice-seller.md) | Optional | Information about the seller (merchant) listed on the masthead of the invoice. | InvoiceSeller getSeller() | setSeller(InvoiceSeller seller) |
| `Customer` | [`InvoiceCustomer`](../../doc/models/invoice-customer.md) | Optional | Information about the customer who is owner or recipient the invoiced subscription. | InvoiceCustomer getCustomer() | setCustomer(InvoiceCustomer customer) |
| `Memo` | `String` | Optional | - | String getMemo() | setMemo(String memo) |
Expand All @@ -50,6 +50,7 @@

```json
{
"collection_method": "automatic",
"uid": "uid6",
"site_id": 196,
"customer_id": 52,
Expand Down
Loading

0 comments on commit 68b7d87

Please sign in to comment.