diff --git a/doc/controllers/components.md b/doc/controllers/components.md index 726da764..db19468a 100644 --- a/doc/controllers/components.md +++ b/doc/controllers/components.md @@ -409,7 +409,7 @@ try { { "id": 25407138, "name": "cillum aute", - "pricing_scheme": "in incididu", + "pricing_scheme": "stairstep", "unit_name": "nulla in", "unit_price": "Excepteur veniam", "product_family_id": -56705047, @@ -912,7 +912,7 @@ CreateComponentPricePointRequest body = new CreateComponentPricePointRequest.Bui CreateComponentPricePointRequestPricePoint.fromCreateComponentPricePoint( new CreateComponentPricePoint.Builder( "Wholesale", - "stairstep", + PricingScheme.STAIRSTEP, Arrays.asList( new Price.Builder( PriceStartingQuantity.fromString( @@ -1083,7 +1083,7 @@ CreateComponentPricePointsRequest body = new CreateComponentPricePointsRequest.B CreateComponentPricePointsRequestPricePoints.fromCreateComponentPricePoint( new CreateComponentPricePoint.Builder( "Wholesale", - "per_unit", + PricingScheme.PER_UNIT, Arrays.asList( new Price.Builder( PriceStartingQuantity.fromNumber( @@ -1102,7 +1102,7 @@ CreateComponentPricePointsRequest body = new CreateComponentPricePointsRequest.B CreateComponentPricePointsRequestPricePoints.fromCreateComponentPricePoint( new CreateComponentPricePoint.Builder( "MSRP", - "per_unit", + PricingScheme.PER_UNIT, Arrays.asList( new Price.Builder( PriceStartingQuantity.fromNumber( @@ -1121,7 +1121,7 @@ CreateComponentPricePointsRequest body = new CreateComponentPricePointsRequest.B CreateComponentPricePointsRequestPricePoints.fromCreateComponentPricePoint( new CreateComponentPricePoint.Builder( "Special Pricing", - "per_unit", + PricingScheme.PER_UNIT, Arrays.asList( new Price.Builder( PriceStartingQuantity.fromNumber( diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md index d878621f..bd4ac9eb 100644 --- a/doc/controllers/events-based-billing-segments.md +++ b/doc/controllers/events-based-billing-segments.md @@ -50,7 +50,7 @@ String componentId = "component_id8"; String pricePointId = "price_point_id8"; CreateSegmentRequest body = new CreateSegmentRequest.Builder( new CreateSegment.Builder( - "volume" + PricingScheme.VOLUME ) .segmentProperty1Value(CreateSegmentSegmentProperty1Value.fromString( "France" diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md index 700af552..a7c30da8 100644 --- a/doc/controllers/invoices.md +++ b/doc/controllers/invoices.md @@ -608,6 +608,7 @@ Exposed event types are: + failed_payment + apply_debit_note + create_debit_note ++ change_chargeback_status Invoice events are returned in ascending order. diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md index 3a95e3d6..0aedd4a9 100644 --- a/doc/controllers/subscription-components.md +++ b/doc/controllers/subscription-components.md @@ -163,7 +163,7 @@ try { "component_id": 0, "subscription_id": 0, "allocated_quantity": 0, - "pricing_scheme": "string", + "pricing_scheme": "per_unit", "name": "string", "kind": "string", "unit_name": "string", diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md index 03484e5d..7567d079 100644 --- a/doc/controllers/subscription-status.md +++ b/doc/controllers/subscription-status.md @@ -1439,7 +1439,9 @@ try { "taxable_amount_in_cents": 0, "product_id": 1, "product_handle": "gold-product", - "product_name": "Gold Product" + "product_name": "Gold Product", + "period_range_start": "01/10/2024", + "period_range_end": "02/10/2024" }, { "transaction_type": "charge", @@ -1450,10 +1452,18 @@ try { "taxable_amount_in_cents": 0, "component_id": 104, "component_handle": "quantity-component", - "component_name": "Quantity Component" + "component_name": "Quantity Component", + "period_range_start": "01/10/2024", + "period_range_end": "02/10/2024" } ] } } ``` +## Errors + +| HTTP Status Code | Error Description | Exception Class | +| --- | --- | --- | +| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) | + diff --git a/doc/models/bulk-create-segments.md b/doc/models/bulk-create-segments.md index 3a9ba565..820d0d36 100644 --- a/doc/models/bulk-create-segments.md +++ b/doc/models/bulk-create-segments.md @@ -21,7 +21,7 @@ "segment_property_2_value": "String5", "segment_property_3_value": "String3", "segment_property_4_value": "String7", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 64, diff --git a/doc/models/bulk-update-segments-item.md b/doc/models/bulk-update-segments-item.md index 63f723e1..d23dd317 100644 --- a/doc/models/bulk-update-segments-item.md +++ b/doc/models/bulk-update-segments-item.md @@ -10,7 +10,7 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | | `Id` | `int` | Required | The ID of the segment you want to update. | int getId() | setId(int id) | -| `PricingScheme` | `String` | Required | The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. See [Price Bracket Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an overview of pricing schemes. | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/create-or-update-segment-price.md) | Required | - | List getPrices() | setPrices(List prices) | ## Example (as JSON) @@ -18,7 +18,7 @@ ```json { "id": 180, - "pricing_scheme": "pricing_scheme0", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 64, diff --git a/doc/models/bulk-update-segments.md b/doc/models/bulk-update-segments.md index d6f69b56..1d0cbaa2 100644 --- a/doc/models/bulk-update-segments.md +++ b/doc/models/bulk-update-segments.md @@ -18,7 +18,7 @@ "segments": [ { "id": 50, - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 64, @@ -39,7 +39,7 @@ }, { "id": 50, - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 64, diff --git a/doc/models/component-custom-price.md b/doc/models/component-custom-price.md index c1585402..96accaf9 100644 --- a/doc/models/component-custom-price.md +++ b/doc/models/component-custom-price.md @@ -11,7 +11,7 @@ Create or update custom pricing unique to the subscription. Used in place of `pr | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `PricingScheme` | [`PricingScheme1`](../../doc/models/pricing-scheme-1.md) | Optional | Omit for On/Off components | PricingScheme1 getPricingScheme() | setPricingScheme(PricingScheme1 pricingScheme) | +| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | Omit for On/Off components | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Optional | On/off components only need one price bracket starting at 1 | List getPrices() | setPrices(List prices) | ## Example (as JSON) diff --git a/doc/models/component-price-point-item.md b/doc/models/component-price-point-item.md index fca29e87..028a15df 100644 --- a/doc/models/component-price-point-item.md +++ b/doc/models/component-price-point-item.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `Name` | `String` | Optional | - | String getName() | setName(String name) | | `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) | -| `PricingScheme` | `String` | Optional | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`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. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Optional | - | List getPrices() | setPrices(List prices) | ## Example (as JSON) @@ -20,7 +20,7 @@ { "name": "name6", "handle": "handle2", - "pricing_scheme": "pricing_scheme2", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/component-price-point-response.md b/doc/models/component-price-point-response.md index 4c9e2e6d..eb31dbe5 100644 --- a/doc/models/component-price-point-response.md +++ b/doc/models/component-price-point-response.md @@ -21,7 +21,7 @@ "type": "default", "default": false, "name": "name0", - "pricing_scheme": "pricing_scheme8" + "pricing_scheme": "per_unit" } } ``` diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md index 17411373..e94684ce 100644 --- a/doc/models/component-price-point.md +++ b/doc/models/component-price-point.md @@ -13,7 +13,7 @@ | `Type` | [`PricePointType`](../../doc/models/price-point-type.md) | Optional | Price point type. We expose the following types:

1. **default**: a price point that is marked as a default price for a certain product.
2. **custom**: a custom price point.
3. **catalog**: a price point that is **not** marked as a default price for a certain product and is **not** a custom one. | PricePointType getType() | setType(PricePointType type) | | `Default` | `Boolean` | Optional | Note: Refer to type attribute instead | Boolean getDefault() | setDefault(Boolean mDefault) | | `Name` | `String` | Optional | - | String getName() | setName(String name) | -| `PricingScheme` | `String` | Optional | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`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. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `ComponentId` | `Integer` | Optional | - | Integer getComponentId() | setComponentId(Integer componentId) | | `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) | | `ArchivedAt` | `String` | Optional | - | String getArchivedAt() | setArchivedAt(String archivedAt) | @@ -33,7 +33,7 @@ "type": "custom", "default": false, "name": "name2", - "pricing_scheme": "pricing_scheme6" + "pricing_scheme": "stairstep" } ``` diff --git a/doc/models/component-price-points-response.md b/doc/models/component-price-points-response.md index 0b835da9..5a0f9768 100644 --- a/doc/models/component-price-points-response.md +++ b/doc/models/component-price-points-response.md @@ -21,14 +21,14 @@ "type": "default", "default": false, "name": "name2", - "pricing_scheme": "pricing_scheme4" + "pricing_scheme": "per_unit" }, { "id": 40, "type": "default", "default": false, "name": "name2", - "pricing_scheme": "pricing_scheme4" + "pricing_scheme": "per_unit" } ] } diff --git a/doc/models/component-response.md b/doc/models/component-response.md index a8fb2d8f..a6e4eee6 100644 --- a/doc/models/component-response.md +++ b/doc/models/component-response.md @@ -20,7 +20,7 @@ "id": 80, "name": "name8", "handle": "handle4", - "pricing_scheme": "pricing_scheme0", + "pricing_scheme": "tiered", "unit_name": "unit_name0" } } diff --git a/doc/models/component.md b/doc/models/component.md index 896adee5..2736dc70 100644 --- a/doc/models/component.md +++ b/doc/models/component.md @@ -12,7 +12,7 @@ | `Id` | `Integer` | Optional | The unique ID assigned to the component by Chargify. This ID can be used to fetch the component from the API. | Integer getId() | setId(Integer id) | | `Name` | `String` | Optional | The name of the Component, suitable for display on statements. i.e. Text Messages. | String getName() | setName(String name) | | `Handle` | `String` | Optional | The component API handle | String getHandle() | setHandle(String handle) | -| `PricingScheme` | `String` | Optional | The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. See [Price Bracket Rules](https://chargify.zendesk.com/hc/en-us/articles/4407755865883#price-bracket-rules) for an overview of pricing schemes. | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`ComponentPricingScheme`](../../doc/models/containers/component-pricing-scheme.md) | Optional | This is a container for one-of cases. | ComponentPricingScheme getPricingScheme() | setPricingScheme(ComponentPricingScheme pricingScheme) | | `UnitName` | `String` | Optional | The name of the unit that the component’s usage is measured in. i.e. message | String getUnitName() | setUnitName(String unitName) | | `UnitPrice` | `String` | Optional | The amount the customer will be charged per unit. This field is only populated for ‘per_unit’ pricing schemes, otherwise it may be null. | String getUnitPrice() | setUnitPrice(String unitPrice) | | `ProductFamilyId` | `Integer` | Optional | The id of the Product Family to which the Component belongs | Integer getProductFamilyId() | setProductFamilyId(Integer productFamilyId) | @@ -49,7 +49,7 @@ "id": 24, "name": "name2", "handle": "handle8", - "pricing_scheme": "pricing_scheme6", + "pricing_scheme": "tiered", "unit_name": "unit_name4" } ``` diff --git a/doc/models/containers/component-pricing-scheme.md b/doc/models/containers/component-pricing-scheme.md new file mode 100644 index 00000000..cb94f1e4 --- /dev/null +++ b/doc/models/containers/component-pricing-scheme.md @@ -0,0 +1,13 @@ + +# Component Pricing Scheme + +## Class Name + +`ComponentPricingScheme` + +## Cases + +| Type | Factory Method | +| --- | --- | +| [`PricingScheme`](../../../doc/models/pricing-scheme.md) | ComponentPricingScheme.fromPricingScheme(PricingScheme pricingScheme) | + diff --git a/doc/models/containers/subscription-component-pricing-scheme.md b/doc/models/containers/subscription-component-pricing-scheme.md new file mode 100644 index 00000000..a285ca18 --- /dev/null +++ b/doc/models/containers/subscription-component-pricing-scheme.md @@ -0,0 +1,13 @@ + +# Subscription Component Pricing Scheme + +## Class Name + +`SubscriptionComponentPricingScheme` + +## Cases + +| Type | Factory Method | +| --- | --- | +| [`PricingScheme`](../../../doc/models/pricing-scheme.md) | SubscriptionComponentPricingScheme.fromPricingScheme(PricingScheme pricingScheme) | + diff --git a/doc/models/create-component-price-point-request.md b/doc/models/create-component-price-point-request.md index e0c86b80..2ff7938e 100644 --- a/doc/models/create-component-price-point-request.md +++ b/doc/models/create-component-price-point-request.md @@ -17,7 +17,7 @@ { "price_point": { "name": "name0", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/create-component-price-point.md b/doc/models/create-component-price-point.md index 73ac0b67..b819c4df 100644 --- a/doc/models/create-component-price-point.md +++ b/doc/models/create-component-price-point.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `Name` | `String` | Required | - | String getName() | setName(String name) | | `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) | -| `PricingScheme` | `String` | Required | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Required | - | List getPrices() | setPrices(List prices) | | `UseSiteExchangeRate` | `Boolean` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
**Default**: `true` | Boolean getUseSiteExchangeRate() | setUseSiteExchangeRate(Boolean useSiteExchangeRate) | @@ -20,7 +20,7 @@ ```json { "name": "name0", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/create-component-price-points-request.md b/doc/models/create-component-price-points-request.md index 3fce8ce1..9e50e786 100644 --- a/doc/models/create-component-price-points-request.md +++ b/doc/models/create-component-price-points-request.md @@ -19,7 +19,7 @@ { "name": "name0", "handle": "handle6", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, @@ -42,7 +42,7 @@ { "name": "name0", "handle": "handle6", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/create-on-off-component.md b/doc/models/create-on-off-component.md index ab55fb35..fa00b1de 100644 --- a/doc/models/create-on-off-component.md +++ b/doc/models/create-on-off-component.md @@ -21,7 +21,6 @@ "description": "description6", "handle": "handle2", "taxable": false, - "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/create-prepaid-usage-component-price-point.md b/doc/models/create-prepaid-usage-component-price-point.md index 6838185f..2d632370 100644 --- a/doc/models/create-prepaid-usage-component-price-point.md +++ b/doc/models/create-prepaid-usage-component-price-point.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `Name` | `String` | Required | - | String getName() | setName(String name) | | `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) | -| `PricingScheme` | `String` | Required | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Required | - | List getPrices() | setPrices(List prices) | | `OveragePricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Required | - | OveragePricing getOveragePricing() | setOveragePricing(OveragePricing overagePricing) | | `UseSiteExchangeRate` | `Boolean` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
**Default**: `true` | Boolean getUseSiteExchangeRate() | setUseSiteExchangeRate(Boolean useSiteExchangeRate) | @@ -25,7 +25,7 @@ ```json { "name": "name0", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/create-segment-request.md b/doc/models/create-segment-request.md index 26633db1..955686ae 100644 --- a/doc/models/create-segment-request.md +++ b/doc/models/create-segment-request.md @@ -20,7 +20,7 @@ "segment_property_2_value": "String3", "segment_property_3_value": "String1", "segment_property_4_value": "String5", - "pricing_scheme": "pricing_scheme4", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 64, diff --git a/doc/models/create-segment.md b/doc/models/create-segment.md index 66c6f616..ca1aa4a6 100644 --- a/doc/models/create-segment.md +++ b/doc/models/create-segment.md @@ -13,7 +13,7 @@ | `SegmentProperty2Value` | [`CreateSegmentSegmentProperty2Value`](../../doc/models/containers/create-segment-segment-property-2-value.md) | Optional | This is a container for one-of cases. | CreateSegmentSegmentProperty2Value getSegmentProperty2Value() | setSegmentProperty2Value(CreateSegmentSegmentProperty2Value segmentProperty2Value) | | `SegmentProperty3Value` | [`CreateSegmentSegmentProperty3Value`](../../doc/models/containers/create-segment-segment-property-3-value.md) | Optional | This is a container for one-of cases. | CreateSegmentSegmentProperty3Value getSegmentProperty3Value() | setSegmentProperty3Value(CreateSegmentSegmentProperty3Value segmentProperty3Value) | | `SegmentProperty4Value` | [`CreateSegmentSegmentProperty4Value`](../../doc/models/containers/create-segment-segment-property-4-value.md) | Optional | This is a container for one-of cases. | CreateSegmentSegmentProperty4Value getSegmentProperty4Value() | setSegmentProperty4Value(CreateSegmentSegmentProperty4Value segmentProperty4Value) | -| `PricingScheme` | `String` | Required | The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. See [Price Bracket Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an overview of pricing schemes. | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/create-or-update-segment-price.md) | Optional | - | List getPrices() | setPrices(List prices) | ## Example (as JSON) @@ -24,7 +24,7 @@ "segment_property_2_value": "String1", "segment_property_3_value": "String3", "segment_property_4_value": "String3", - "pricing_scheme": "pricing_scheme6", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 64, diff --git a/doc/models/invoice-event-type.md b/doc/models/invoice-event-type.md index b6396855..9fcef242 100644 --- a/doc/models/invoice-event-type.md +++ b/doc/models/invoice-event-type.md @@ -24,4 +24,5 @@ Invoice Event Type | `ChangeInvoiceCollectionMethod` | | `RemovePayment` | | `FailedPayment` | +| `ChangeChargebackStatus` | diff --git a/doc/models/invoice-event.md b/doc/models/invoice-event.md index 043a6d26..0ccfd6bb 100644 --- a/doc/models/invoice-event.md +++ b/doc/models/invoice-event.md @@ -20,7 +20,7 @@ ```json { "id": 78, - "event_type": "apply_payment", + "event_type": "void_invoice", "event_data": { "uid": "uid2", "credit_note_number": "credit_note_number4", diff --git a/doc/models/list-components-price-points-response.md b/doc/models/list-components-price-points-response.md index cfc86253..80262943 100644 --- a/doc/models/list-components-price-points-response.md +++ b/doc/models/list-components-price-points-response.md @@ -22,7 +22,7 @@ "type": "default", "default": false, "name": "name2", - "pricing_scheme": "pricing_scheme4" + "pricing_scheme": "per_unit" } ] } diff --git a/doc/models/list-invoice-events-response.md b/doc/models/list-invoice-events-response.md index f3bd69ce..00ab1146 100644 --- a/doc/models/list-invoice-events-response.md +++ b/doc/models/list-invoice-events-response.md @@ -21,7 +21,7 @@ "events": [ { "id": 68, - "event_type": "void_remainder", + "event_type": "void_invoice", "event_data": { "uid": "uid2", "credit_note_number": "credit_note_number4", diff --git a/doc/models/list-segments-response.md b/doc/models/list-segments-response.md index 0327d6cb..83e0886f 100644 --- a/doc/models/list-segments-response.md +++ b/doc/models/list-segments-response.md @@ -21,7 +21,7 @@ "component_id": 160, "price_point_id": 184, "event_based_billing_metric_id": 244, - "pricing_scheme": "pricing_scheme8" + "pricing_scheme": "stairstep" } ] } diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md index c754fc54..1aae2f11 100644 --- a/doc/models/on-off-component.md +++ b/doc/models/on-off-component.md @@ -14,7 +14,6 @@ | `Description` | `String` | Optional | A description for the component that will be displayed to the user on the hosted signup page. | String getDescription() | setDescription(String description) | | `Handle` | `String` | Optional | A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.
**Constraints**: *Pattern*: `^[a-z0-9][a-z0-9\-_:.]*$` | String getHandle() | setHandle(String handle) | | `Taxable` | `Boolean` | Optional | Boolean flag describing whether a component is taxable or not. | Boolean getTaxable() | setTaxable(Boolean taxable) | -| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://chargify.zendesk.com/hc/en-us/articles/4407755865883#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. | List getPrices() | setPrices(List prices) | | `UpgradeCharge` | [`CreditType`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | CreditType getUpgradeCharge() | setUpgradeCharge(CreditType upgradeCharge) | | `DowngradeCredit` | [`CreditType`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. | CreditType getDowngradeCredit() | setDowngradeCredit(CreditType downgradeCredit) | @@ -36,7 +35,6 @@ "description": "description2", "handle": "handle8", "taxable": false, - "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/prepaid-component-price-point.md b/doc/models/prepaid-component-price-point.md index de8d9676..48a9e68e 100644 --- a/doc/models/prepaid-component-price-point.md +++ b/doc/models/prepaid-component-price-point.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `Name` | `String` | Optional | - | String getName() | setName(String name) | | `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) | -| `PricingScheme` | `String` | Optional | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`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. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Optional | - | List getPrices() | setPrices(List prices) | | `OveragePricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Optional | - | OveragePricing getOveragePricing() | setOveragePricing(OveragePricing overagePricing) | @@ -21,7 +21,7 @@ { "name": "name8", "handle": "handle4", - "pricing_scheme": "pricing_scheme0", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/price-point.md b/doc/models/price-point.md index 154a72f4..6614fbe5 100644 --- a/doc/models/price-point.md +++ b/doc/models/price-point.md @@ -11,7 +11,7 @@ | --- | --- | --- | --- | --- | --- | | `Name` | `String` | Optional | - | String getName() | setName(String name) | | `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) | -| `PricingScheme` | `String` | Optional | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`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. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/price.md) | Optional | - | List getPrices() | setPrices(List prices) | | `UseSiteExchangeRate` | `Boolean` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
**Default**: `true` | Boolean getUseSiteExchangeRate() | setUseSiteExchangeRate(Boolean useSiteExchangeRate) | | `OveragePricing` | [`OveragePricing`](../../doc/models/overage-pricing.md) | Optional | - | OveragePricing getOveragePricing() | setOveragePricing(OveragePricing overagePricing) | @@ -27,7 +27,7 @@ "use_site_exchange_rate": true, "name": "name0", "handle": "handle6", - "pricing_scheme": "pricing_scheme8", + "pricing_scheme": "per_unit", "prices": [ { "starting_quantity": 242, diff --git a/doc/models/pricing-scheme-1.md b/doc/models/pricing-scheme-1.md deleted file mode 100644 index a9a27828..00000000 --- a/doc/models/pricing-scheme-1.md +++ /dev/null @@ -1,18 +0,0 @@ - -# Pricing Scheme 1 - -Omit for On/Off components - -## Enumeration - -`PricingScheme1` - -## Fields - -| Name | -| --- | -| `Stairstep` | -| `Volume` | -| `PerUnit` | -| `Tiered` | - diff --git a/doc/models/renewal-preview-line-item.md b/doc/models/renewal-preview-line-item.md index 17f00058..3b281af7 100644 --- a/doc/models/renewal-preview-line-item.md +++ b/doc/models/renewal-preview-line-item.md @@ -21,6 +21,8 @@ | `ComponentHandle` | `String` | Optional | - | String getComponentHandle() | setComponentHandle(String componentHandle) | | `ComponentName` | `String` | Optional | - | String getComponentName() | setComponentName(String componentName) | | `ProductHandle` | `String` | Optional | - | String getProductHandle() | setProductHandle(String productHandle) | +| `PeriodRangeStart` | `String` | Optional | - | String getPeriodRangeStart() | setPeriodRangeStart(String periodRangeStart) | +| `PeriodRangeEnd` | `String` | Optional | - | String getPeriodRangeEnd() | setPeriodRangeEnd(String periodRangeEnd) | ## Example (as JSON) diff --git a/doc/models/segment-response.md b/doc/models/segment-response.md index 104efb74..def21f41 100644 --- a/doc/models/segment-response.md +++ b/doc/models/segment-response.md @@ -20,7 +20,7 @@ "component_id": 228, "price_point_id": 4, "event_based_billing_metric_id": 56, - "pricing_scheme": "pricing_scheme4" + "pricing_scheme": "stairstep" } } ``` diff --git a/doc/models/segment.md b/doc/models/segment.md index 5827b1eb..d11b45f0 100644 --- a/doc/models/segment.md +++ b/doc/models/segment.md @@ -13,7 +13,7 @@ | `ComponentId` | `Integer` | Optional | - | Integer getComponentId() | setComponentId(Integer componentId) | | `PricePointId` | `Integer` | Optional | - | Integer getPricePointId() | setPricePointId(Integer pricePointId) | | `EventBasedBillingMetricId` | `Integer` | Optional | - | Integer getEventBasedBillingMetricId() | setEventBasedBillingMetricId(Integer eventBasedBillingMetricId) | -| `PricingScheme` | `String` | Optional | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`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. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `SegmentProperty1Value` | [`SegmentSegmentProperty1Value`](../../doc/models/containers/segment-segment-property-1-value.md) | Optional | This is a container for one-of cases. | SegmentSegmentProperty1Value getSegmentProperty1Value() | setSegmentProperty1Value(SegmentSegmentProperty1Value segmentProperty1Value) | | `SegmentProperty2Value` | [`SegmentSegmentProperty2Value`](../../doc/models/containers/segment-segment-property-2-value.md) | Optional | This is a container for one-of cases. | SegmentSegmentProperty2Value getSegmentProperty2Value() | setSegmentProperty2Value(SegmentSegmentProperty2Value segmentProperty2Value) | | `SegmentProperty3Value` | [`SegmentSegmentProperty3Value`](../../doc/models/containers/segment-segment-property-3-value.md) | Optional | This is a container for one-of cases. | SegmentSegmentProperty3Value getSegmentProperty3Value() | setSegmentProperty3Value(SegmentSegmentProperty3Value segmentProperty3Value) | @@ -30,7 +30,7 @@ "component_id": 116, "price_point_id": 140, "event_based_billing_metric_id": 200, - "pricing_scheme": "pricing_scheme0" + "pricing_scheme": "stairstep" } ``` diff --git a/doc/models/subscription-component.md b/doc/models/subscription-component.md index ba7430c5..b99772ca 100644 --- a/doc/models/subscription-component.md +++ b/doc/models/subscription-component.md @@ -17,7 +17,7 @@ | `UnitBalance` | `Integer` | Optional | - | Integer getUnitBalance() | setUnitBalance(Integer unitBalance) | | `Currency` | `String` | Optional | - | String getCurrency() | setCurrency(String currency) | | `AllocatedQuantity` | `Integer` | Optional | For Quantity-based components: The current allocation for the component on the given subscription. For On/Off components: Use 1 for on. Use 0 for off. | Integer getAllocatedQuantity() | setAllocatedQuantity(Integer allocatedQuantity) | -| `PricingScheme` | `String` | Optional | - | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`SubscriptionComponentPricingScheme`](../../doc/models/containers/subscription-component-pricing-scheme.md) | Optional | This is a container for one-of cases. | SubscriptionComponentPricingScheme getPricingScheme() | setPricingScheme(SubscriptionComponentPricingScheme pricingScheme) | | `ComponentId` | `Integer` | Optional | - | Integer getComponentId() | setComponentId(Integer componentId) | | `ComponentHandle` | `String` | Optional | - | String getComponentHandle() | setComponentHandle(String componentHandle) | | `SubscriptionId` | `Integer` | Optional | - | Integer getSubscriptionId() | setSubscriptionId(Integer subscriptionId) | diff --git a/doc/models/update-segment-request.md b/doc/models/update-segment-request.md index 041cf22c..cb769e74 100644 --- a/doc/models/update-segment-request.md +++ b/doc/models/update-segment-request.md @@ -16,7 +16,7 @@ ```json { "segment": { - "pricing_scheme": "pricing_scheme4", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 64, diff --git a/doc/models/update-segment.md b/doc/models/update-segment.md index 610197e1..44810967 100644 --- a/doc/models/update-segment.md +++ b/doc/models/update-segment.md @@ -9,14 +9,14 @@ | Name | Type | Tags | Description | Getter | Setter | | --- | --- | --- | --- | --- | --- | -| `PricingScheme` | `String` | Required | The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. See [Price Bracket Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an overview of pricing schemes. | String getPricingScheme() | setPricingScheme(String pricingScheme) | +| `PricingScheme` | [`PricingScheme`](../../doc/models/pricing-scheme.md) | Required | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. | PricingScheme getPricingScheme() | setPricingScheme(PricingScheme pricingScheme) | | `Prices` | [`List`](../../doc/models/create-or-update-segment-price.md) | Optional | - | List getPrices() | setPrices(List prices) | ## Example (as JSON) ```json { - "pricing_scheme": "pricing_scheme6", + "pricing_scheme": "stairstep", "prices": [ { "starting_quantity": 64, diff --git a/src/main/java/com/maxio/advancedbilling/controllers/InvoicesController.java b/src/main/java/com/maxio/advancedbilling/controllers/InvoicesController.java index ab7d6ebf..122ec9b1 100644 --- a/src/main/java/com/maxio/advancedbilling/controllers/InvoicesController.java +++ b/src/main/java/com/maxio/advancedbilling/controllers/InvoicesController.java @@ -229,9 +229,10 @@ private ApiCall prepareReadInvoiceRequest( * Exposed event types are: + issue_invoice + apply_credit_note + apply_payment + refund_invoice * + void_invoice + void_remainder + backport_invoice + change_invoice_status + * change_invoice_collection_method + remove_payment + failed_payment + apply_debit_note + - * create_debit_note Invoice events are returned in ascending order. If both a `since_date` and - * `since_id` are provided in request parameters, the `since_date` will be used. Note - invoice - * events that occurred prior to 09/05/2018 __will not__ contain an `invoice` snapshot. + * create_debit_note + change_chargeback_status Invoice events are returned in ascending order. + * If both a `since_date` and `since_id` are provided in request parameters, the `since_date` + * will be used. Note - invoice events that occurred prior to 09/05/2018 __will not__ contain an + * `invoice` snapshot. * @param input ListInvoiceEventsInput object containing request parameters * @return Returns the ListInvoiceEventsResponse response from the API call * @throws ApiException Represents error response from the server. diff --git a/src/main/java/com/maxio/advancedbilling/controllers/SubscriptionStatusController.java b/src/main/java/com/maxio/advancedbilling/controllers/SubscriptionStatusController.java index 3589128e..b0a4ad94 100644 --- a/src/main/java/com/maxio/advancedbilling/controllers/SubscriptionStatusController.java +++ b/src/main/java/com/maxio/advancedbilling/controllers/SubscriptionStatusController.java @@ -585,6 +585,9 @@ private ApiCall preparePreviewRenewalReque .deserializer( response -> ApiHelper.deserialize(response, RenewalPreviewResponse.class)) .nullify404(false) + .localErrorCase("422", + ErrorCase.setReason("Unprocessable Entity (WebDAV)", + (reason, context) -> new ErrorListResponseException(reason, context))) .globalErrorCase(GLOBAL_ERROR_CASES)) .endpointConfiguration(param -> param .arraySerializationFormat(ArraySerializationFormat.CSV)) diff --git a/src/main/java/com/maxio/advancedbilling/models/BulkUpdateSegmentsItem.java b/src/main/java/com/maxio/advancedbilling/models/BulkUpdateSegmentsItem.java index 6d8831ff..ca0e9a20 100644 --- a/src/main/java/com/maxio/advancedbilling/models/BulkUpdateSegmentsItem.java +++ b/src/main/java/com/maxio/advancedbilling/models/BulkUpdateSegmentsItem.java @@ -15,7 +15,7 @@ */ public class BulkUpdateSegmentsItem { private int id; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -27,12 +27,12 @@ public BulkUpdateSegmentsItem() { /** * Initialization constructor. * @param id int value for id. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of CreateOrUpdateSegmentPrice value for prices. */ public BulkUpdateSegmentsItem( int id, - String pricingScheme, + PricingScheme pricingScheme, List prices) { this.id = id; this.pricingScheme = pricingScheme; @@ -61,27 +61,25 @@ public void setId(int id) { /** * Getter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an - * overview of pricing schemes. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an - * overview of pricing schemes. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -128,7 +126,7 @@ public Builder toBuilder() { */ public static class Builder { private int id; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -140,10 +138,11 @@ public Builder() { /** * Initialization constructor. * @param id int value for id. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of CreateOrUpdateSegmentPrice value for prices. */ - public Builder(int id, String pricingScheme, List prices) { + public Builder(int id, PricingScheme pricingScheme, + List prices) { this.id = id; this.pricingScheme = pricingScheme; this.prices = prices; @@ -161,10 +160,10 @@ public Builder id(int id) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/Component.java b/src/main/java/com/maxio/advancedbilling/models/Component.java index 95344344..4188994d 100644 --- a/src/main/java/com/maxio/advancedbilling/models/Component.java +++ b/src/main/java/com/maxio/advancedbilling/models/Component.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.maxio.advancedbilling.models.containers.ComponentPricingScheme; import io.apimatic.core.types.OptionalNullable; import java.util.List; @@ -20,7 +21,7 @@ public class Component { private Integer id; private String name; private OptionalNullable handle; - private OptionalNullable pricingScheme; + private OptionalNullable pricingScheme; private String unitName; private OptionalNullable unitPrice; private Integer productFamilyId; @@ -60,7 +61,7 @@ public Component() { * @param id Integer value for id. * @param name String value for name. * @param handle String value for handle. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme ComponentPricingScheme value for pricingScheme. * @param unitName String value for unitName. * @param unitPrice String value for unitPrice. * @param productFamilyId Integer value for productFamilyId. @@ -93,7 +94,7 @@ public Component( Integer id, String name, String handle, - String pricingScheme, + ComponentPricingScheme pricingScheme, String unitName, String unitPrice, Integer productFamilyId, @@ -159,7 +160,7 @@ public Component( * @param id Integer value for id. * @param name String value for name. * @param handle String value for handle. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme ComponentPricingScheme value for pricingScheme. * @param unitName String value for unitName. * @param unitPrice String value for unitPrice. * @param productFamilyId Integer value for productFamilyId. @@ -190,7 +191,7 @@ public Component( */ protected Component(Integer id, String name, OptionalNullable handle, - OptionalNullable pricingScheme, String unitName, + OptionalNullable pricingScheme, String unitName, OptionalNullable unitPrice, Integer productFamilyId, String productFamilyName, OptionalNullable pricePerUnitInCents, ComponentKind kind, Boolean archived, Boolean taxable, OptionalNullable description, Integer defaultPricePointId, @@ -320,50 +321,34 @@ public void unsetHandle() { /** * Internal Getter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://chargify.zendesk.com/hc/en-us/articles/4407755865883#price-bracket-rules) for - * an overview of pricing schemes. - * @return Returns the Internal String + * @return Returns the Internal ComponentPricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPricingScheme() { + protected OptionalNullable internalGetPricingScheme() { return this.pricingScheme; } /** * Getter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://chargify.zendesk.com/hc/en-us/articles/4407755865883#price-bracket-rules) for - * an overview of pricing schemes. - * @return Returns the String + * @return Returns the ComponentPricingScheme */ - public String getPricingScheme() { + public ComponentPricingScheme getPricingScheme() { return OptionalNullable.getFrom(pricingScheme); } /** * Setter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://chargify.zendesk.com/hc/en-us/articles/4407755865883#price-bracket-rules) for - * an overview of pricing schemes. - * @param pricingScheme Value for String + * @param pricingScheme Value for ComponentPricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(ComponentPricingScheme pricingScheme) { this.pricingScheme = OptionalNullable.of(pricingScheme); } /** * UnSetter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://chargify.zendesk.com/hc/en-us/articles/4407755865883#price-bracket-rules) for - * an overview of pricing schemes. */ public void unsetPricingScheme() { pricingScheme = null; @@ -1226,7 +1211,7 @@ public static class Builder { private Integer id; private String name; private OptionalNullable handle; - private OptionalNullable pricingScheme; + private OptionalNullable pricingScheme; private String unitName; private OptionalNullable unitPrice; private Integer productFamilyId; @@ -1298,10 +1283,10 @@ public Builder unsetHandle() { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme ComponentPricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(ComponentPricingScheme pricingScheme) { this.pricingScheme = OptionalNullable.of(pricingScheme); return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/ComponentCustomPrice.java b/src/main/java/com/maxio/advancedbilling/models/ComponentCustomPrice.java index f0c0d441..a860535f 100644 --- a/src/main/java/com/maxio/advancedbilling/models/ComponentCustomPrice.java +++ b/src/main/java/com/maxio/advancedbilling/models/ComponentCustomPrice.java @@ -15,7 +15,7 @@ * This is a model class for ComponentCustomPrice type. */ public class ComponentCustomPrice { - private PricingScheme1 pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -26,11 +26,11 @@ public ComponentCustomPrice() { /** * Initialization constructor. - * @param pricingScheme PricingScheme1 value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. */ public ComponentCustomPrice( - PricingScheme1 pricingScheme, + PricingScheme pricingScheme, List prices) { this.pricingScheme = pricingScheme; this.prices = prices; @@ -39,21 +39,21 @@ public ComponentCustomPrice( /** * Getter for PricingScheme. * Omit for On/Off components - * @return Returns the PricingScheme1 + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) - public PricingScheme1 getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. * Omit for On/Off components - * @param pricingScheme Value for PricingScheme1 + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(PricingScheme1 pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -104,17 +104,17 @@ public Builder toBuilder() { * Class to build instances of {@link ComponentCustomPrice}. */ public static class Builder { - private PricingScheme1 pricingScheme; + private PricingScheme pricingScheme; private List prices; /** * Setter for pricingScheme. - * @param pricingScheme PricingScheme1 value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(PricingScheme1 pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/ComponentPricePoint.java b/src/main/java/com/maxio/advancedbilling/models/ComponentPricePoint.java index 2aab79be..05b16af6 100644 --- a/src/main/java/com/maxio/advancedbilling/models/ComponentPricePoint.java +++ b/src/main/java/com/maxio/advancedbilling/models/ComponentPricePoint.java @@ -21,7 +21,7 @@ public class ComponentPricePoint { private PricePointType type; private Boolean mDefault; private String name; - private String pricingScheme; + private PricingScheme pricingScheme; private Integer componentId; private String handle; private OptionalNullable archivedAt; @@ -45,7 +45,7 @@ public ComponentPricePoint() { * @param type PricePointType value for type. * @param mDefault Boolean value for mDefault. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param componentId Integer value for componentId. * @param handle String value for handle. * @param archivedAt String value for archivedAt. @@ -61,7 +61,7 @@ public ComponentPricePoint( PricePointType type, Boolean mDefault, String name, - String pricingScheme, + PricingScheme pricingScheme, Integer componentId, String handle, String archivedAt, @@ -93,7 +93,7 @@ public ComponentPricePoint( * @param type PricePointType value for type. * @param mDefault Boolean value for mDefault. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param componentId Integer value for componentId. * @param handle String value for handle. * @param archivedAt String value for archivedAt. @@ -106,7 +106,7 @@ public ComponentPricePoint( */ protected ComponentPricePoint(Integer id, PricePointType type, Boolean mDefault, String name, - String pricingScheme, Integer componentId, String handle, + PricingScheme pricingScheme, Integer componentId, String handle, OptionalNullable archivedAt, String createdAt, String updatedAt, List prices, Boolean useSiteExchangeRate, Integer subscriptionId, Boolean taxIncluded) { @@ -214,20 +214,26 @@ public void setName(String name) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -472,7 +478,7 @@ public static class Builder { private PricePointType type; private Boolean mDefault; private String name; - private String pricingScheme; + private PricingScheme pricingScheme; private Integer componentId; private String handle; private OptionalNullable archivedAt; @@ -527,10 +533,10 @@ public Builder name(String name) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/ComponentPricePointItem.java b/src/main/java/com/maxio/advancedbilling/models/ComponentPricePointItem.java index 5210b098..2683827d 100644 --- a/src/main/java/com/maxio/advancedbilling/models/ComponentPricePointItem.java +++ b/src/main/java/com/maxio/advancedbilling/models/ComponentPricePointItem.java @@ -17,7 +17,7 @@ public class ComponentPricePointItem { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -30,13 +30,13 @@ public ComponentPricePointItem() { * Initialization constructor. * @param name String value for name. * @param handle String value for handle. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. */ public ComponentPricePointItem( String name, String handle, - String pricingScheme, + PricingScheme pricingScheme, List prices) { this.name = name; this.handle = handle; @@ -84,20 +84,26 @@ public void setHandle(String handle) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -150,7 +156,7 @@ public Builder toBuilder() { public static class Builder { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; @@ -177,10 +183,10 @@ public Builder handle(String handle) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/CreateComponentPricePoint.java b/src/main/java/com/maxio/advancedbilling/models/CreateComponentPricePoint.java index 7a6f5629..75d56067 100644 --- a/src/main/java/com/maxio/advancedbilling/models/CreateComponentPricePoint.java +++ b/src/main/java/com/maxio/advancedbilling/models/CreateComponentPricePoint.java @@ -19,7 +19,7 @@ public class CreateComponentPricePoint { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private Boolean useSiteExchangeRate; @@ -33,14 +33,14 @@ public CreateComponentPricePoint() { /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. * @param handle String value for handle. * @param useSiteExchangeRate Boolean value for useSiteExchangeRate. */ public CreateComponentPricePoint( String name, - String pricingScheme, + PricingScheme pricingScheme, List prices, String handle, Boolean useSiteExchangeRate) { @@ -54,13 +54,13 @@ public CreateComponentPricePoint( /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. */ @JsonCreator protected CreateComponentPricePoint( @JsonProperty("name") String name, - @JsonProperty("pricing_scheme") String pricingScheme, + @JsonProperty("pricing_scheme") PricingScheme pricingScheme, @JsonProperty("prices") List prices) { this(name, pricingScheme, prices, null, null); } @@ -104,19 +104,25 @@ public void setHandle(String handle) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -189,7 +195,7 @@ public Builder toBuilder() { */ public static class Builder { private String name; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private String handle; private Boolean useSiteExchangeRate = true; @@ -203,10 +209,10 @@ public Builder() { /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. */ - public Builder(String name, String pricingScheme, List prices) { + public Builder(String name, PricingScheme pricingScheme, List prices) { this.name = name; this.pricingScheme = pricingScheme; this.prices = prices; @@ -224,10 +230,10 @@ public Builder name(String name) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/CreatePrepaidUsageComponentPricePoint.java b/src/main/java/com/maxio/advancedbilling/models/CreatePrepaidUsageComponentPricePoint.java index e59ccf8c..9d6a41ea 100644 --- a/src/main/java/com/maxio/advancedbilling/models/CreatePrepaidUsageComponentPricePoint.java +++ b/src/main/java/com/maxio/advancedbilling/models/CreatePrepaidUsageComponentPricePoint.java @@ -19,7 +19,7 @@ public class CreatePrepaidUsageComponentPricePoint { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private OveragePricing overagePricing; private Boolean useSiteExchangeRate; @@ -38,7 +38,7 @@ public CreatePrepaidUsageComponentPricePoint() { /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. * @param overagePricing OveragePricing value for overagePricing. * @param handle String value for handle. @@ -50,7 +50,7 @@ public CreatePrepaidUsageComponentPricePoint() { */ public CreatePrepaidUsageComponentPricePoint( String name, - String pricingScheme, + PricingScheme pricingScheme, List prices, OveragePricing overagePricing, String handle, @@ -74,14 +74,14 @@ public CreatePrepaidUsageComponentPricePoint( /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. * @param overagePricing OveragePricing value for overagePricing. */ @JsonCreator protected CreatePrepaidUsageComponentPricePoint( @JsonProperty("name") String name, - @JsonProperty("pricing_scheme") String pricingScheme, + @JsonProperty("pricing_scheme") PricingScheme pricingScheme, @JsonProperty("prices") List prices, @JsonProperty("overage_pricing") OveragePricing overagePricing) { this(name, pricingScheme, prices, overagePricing, null, null, null, null, null, null); @@ -126,19 +126,25 @@ public void setHandle(String handle) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -324,7 +330,7 @@ public Builder toBuilder() { */ public static class Builder { private String name; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private OveragePricing overagePricing; private String handle; @@ -343,11 +349,11 @@ public Builder() { /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. * @param overagePricing OveragePricing value for overagePricing. */ - public Builder(String name, String pricingScheme, List prices, + public Builder(String name, PricingScheme pricingScheme, List prices, OveragePricing overagePricing) { this.name = name; this.pricingScheme = pricingScheme; @@ -367,10 +373,10 @@ public Builder name(String name) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/CreateSegment.java b/src/main/java/com/maxio/advancedbilling/models/CreateSegment.java index 2cc87299..bc225b2d 100644 --- a/src/main/java/com/maxio/advancedbilling/models/CreateSegment.java +++ b/src/main/java/com/maxio/advancedbilling/models/CreateSegment.java @@ -23,7 +23,7 @@ public class CreateSegment { private CreateSegmentSegmentProperty2Value segmentProperty2Value; private CreateSegmentSegmentProperty3Value segmentProperty3Value; private CreateSegmentSegmentProperty4Value segmentProperty4Value; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -34,7 +34,7 @@ public CreateSegment() { /** * Initialization constructor. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param segmentProperty1Value CreateSegmentSegmentProperty1Value value for * segmentProperty1Value. * @param segmentProperty2Value CreateSegmentSegmentProperty2Value value for @@ -46,7 +46,7 @@ public CreateSegment() { * @param prices List of CreateOrUpdateSegmentPrice value for prices. */ public CreateSegment( - String pricingScheme, + PricingScheme pricingScheme, CreateSegmentSegmentProperty1Value segmentProperty1Value, CreateSegmentSegmentProperty2Value segmentProperty2Value, CreateSegmentSegmentProperty3Value segmentProperty3Value, @@ -154,27 +154,25 @@ public void setSegmentProperty4Value(CreateSegmentSegmentProperty4Value segmentP /** * Getter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an - * overview of pricing schemes. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an - * overview of pricing schemes. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -228,7 +226,7 @@ public Builder toBuilder() { * Class to build instances of {@link CreateSegment}. */ public static class Builder { - private String pricingScheme; + private PricingScheme pricingScheme; private CreateSegmentSegmentProperty1Value segmentProperty1Value; private CreateSegmentSegmentProperty2Value segmentProperty2Value; private CreateSegmentSegmentProperty3Value segmentProperty3Value; @@ -243,18 +241,18 @@ public Builder() { /** * Initialization constructor. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. */ - public Builder(String pricingScheme) { + public Builder(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/InvoiceEventType.java b/src/main/java/com/maxio/advancedbilling/models/InvoiceEventType.java index cff5eb6b..de215f5b 100644 --- a/src/main/java/com/maxio/advancedbilling/models/InvoiceEventType.java +++ b/src/main/java/com/maxio/advancedbilling/models/InvoiceEventType.java @@ -41,7 +41,9 @@ public enum InvoiceEventType { REMOVE_PAYMENT, - FAILED_PAYMENT; + FAILED_PAYMENT, + + CHANGE_CHARGEBACK_STATUS; private static TreeMap valueMap = new TreeMap<>(); @@ -61,6 +63,7 @@ public enum InvoiceEventType { CHANGE_INVOICE_COLLECTION_METHOD.value = "change_invoice_collection_method"; REMOVE_PAYMENT.value = "remove_payment"; FAILED_PAYMENT.value = "failed_payment"; + CHANGE_CHARGEBACK_STATUS.value = "change_chargeback_status"; valueMap.put("issue_invoice", ISSUE_INVOICE); valueMap.put("apply_credit_note", APPLY_CREDIT_NOTE); @@ -75,6 +78,7 @@ public enum InvoiceEventType { valueMap.put("change_invoice_collection_method", CHANGE_INVOICE_COLLECTION_METHOD); valueMap.put("remove_payment", REMOVE_PAYMENT); valueMap.put("failed_payment", FAILED_PAYMENT); + valueMap.put("change_chargeback_status", CHANGE_CHARGEBACK_STATUS); } /** diff --git a/src/main/java/com/maxio/advancedbilling/models/OnOffComponent.java b/src/main/java/com/maxio/advancedbilling/models/OnOffComponent.java index df92eaff..e51cc08d 100644 --- a/src/main/java/com/maxio/advancedbilling/models/OnOffComponent.java +++ b/src/main/java/com/maxio/advancedbilling/models/OnOffComponent.java @@ -23,7 +23,6 @@ public class OnOffComponent { private String description; private String handle; private Boolean taxable; - private PricingScheme pricingScheme; private List prices; private OptionalNullable upgradeCharge; private OptionalNullable downgradeCredit; @@ -45,7 +44,6 @@ public OnOffComponent() { /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme PricingScheme value for pricingScheme. * @param unitName String value for unitName. * @param description String value for description. * @param handle String value for handle. @@ -64,7 +62,6 @@ public OnOffComponent() { */ public OnOffComponent( String name, - PricingScheme pricingScheme, String unitName, String description, String handle, @@ -85,7 +82,6 @@ public OnOffComponent( this.description = description; this.handle = handle; this.taxable = taxable; - this.pricingScheme = pricingScheme; this.prices = prices; this.upgradeCharge = OptionalNullable.of(upgradeCharge); this.downgradeCredit = OptionalNullable.of(downgradeCredit); @@ -102,7 +98,6 @@ public OnOffComponent( /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme PricingScheme value for pricingScheme. * @param unitName String value for unitName. * @param description String value for description. * @param handle String value for handle. @@ -120,9 +115,8 @@ public OnOffComponent( * @param publicSignupPageIds List of Integer value for publicSignupPageIds. */ - protected OnOffComponent(String name, PricingScheme pricingScheme, String unitName, - String description, String handle, Boolean taxable, List prices, - OptionalNullable upgradeCharge, + protected OnOffComponent(String name, String unitName, String description, String handle, + Boolean taxable, List prices, OptionalNullable upgradeCharge, OptionalNullable downgradeCredit, List pricePoints, OnOffComponentUnitPrice unitPrice, String taxCode, Boolean hideDateRangeOnInvoice, String priceInCents, Boolean displayOnHostedPage, Boolean allowFractionalQuantities, @@ -132,7 +126,6 @@ protected OnOffComponent(String name, PricingScheme pricingScheme, String unitNa this.description = description; this.handle = handle; this.taxable = taxable; - this.pricingScheme = pricingScheme; this.prices = prices; this.upgradeCharge = upgradeCharge; this.downgradeCredit = downgradeCredit; @@ -260,30 +253,6 @@ public void setTaxable(Boolean taxable) { this.taxable = taxable; } - /** - * Getter for PricingScheme. - * The identifier for the pricing scheme. See [Product - * Components](https://help.chargify.com/products/product-components.html) for an overview of - * pricing schemes. - * @return Returns the PricingScheme - */ - @JsonGetter("pricing_scheme") - public PricingScheme getPricingScheme() { - return pricingScheme; - } - - /** - * Setter for PricingScheme. - * The identifier for the pricing scheme. See [Product - * Components](https://help.chargify.com/products/product-components.html) for an overview of - * pricing schemes. - * @param pricingScheme Value for PricingScheme - */ - @JsonSetter("pricing_scheme") - public void setPricingScheme(PricingScheme pricingScheme) { - this.pricingScheme = pricingScheme; - } - /** * Getter for Prices. * (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket @@ -573,14 +542,14 @@ public void setPublicSignupPageIds(List publicSignupPageIds) { */ @Override public String toString() { - return "OnOffComponent [" + "name=" + name + ", pricingScheme=" + pricingScheme - + ", unitName=" + unitName + ", description=" + description + ", handle=" + handle - + ", taxable=" + taxable + ", prices=" + prices + ", upgradeCharge=" + upgradeCharge - + ", downgradeCredit=" + downgradeCredit + ", pricePoints=" + pricePoints - + ", unitPrice=" + unitPrice + ", taxCode=" + taxCode + ", hideDateRangeOnInvoice=" - + hideDateRangeOnInvoice + ", priceInCents=" + priceInCents - + ", displayOnHostedPage=" + displayOnHostedPage + ", allowFractionalQuantities=" - + allowFractionalQuantities + ", publicSignupPageIds=" + publicSignupPageIds + "]"; + return "OnOffComponent [" + "name=" + name + ", unitName=" + unitName + ", description=" + + description + ", handle=" + handle + ", taxable=" + taxable + ", prices=" + prices + + ", upgradeCharge=" + upgradeCharge + ", downgradeCredit=" + downgradeCredit + + ", pricePoints=" + pricePoints + ", unitPrice=" + unitPrice + ", taxCode=" + + taxCode + ", hideDateRangeOnInvoice=" + hideDateRangeOnInvoice + ", priceInCents=" + + priceInCents + ", displayOnHostedPage=" + displayOnHostedPage + + ", allowFractionalQuantities=" + allowFractionalQuantities + + ", publicSignupPageIds=" + publicSignupPageIds + "]"; } /** @@ -589,7 +558,7 @@ public String toString() { * @return a new {@link OnOffComponent.Builder} object */ public Builder toBuilder() { - Builder builder = new Builder(name, pricingScheme) + Builder builder = new Builder(name) .unitName(getUnitName()) .description(getDescription()) .handle(getHandle()) @@ -613,7 +582,6 @@ public Builder toBuilder() { */ public static class Builder { private String name; - private PricingScheme pricingScheme; private String unitName; private String description; private String handle; @@ -639,11 +607,9 @@ public Builder() { /** * Initialization constructor. * @param name String value for name. - * @param pricingScheme PricingScheme value for pricingScheme. */ - public Builder(String name, PricingScheme pricingScheme) { + public Builder(String name) { this.name = name; - this.pricingScheme = pricingScheme; } /** @@ -656,16 +622,6 @@ public Builder name(String name) { return this; } - /** - * Setter for pricingScheme. - * @param pricingScheme PricingScheme value for pricingScheme. - * @return Builder - */ - public Builder pricingScheme(PricingScheme pricingScheme) { - this.pricingScheme = pricingScheme; - return this; - } - /** * Setter for unitName. * @param unitName String value for unitName. @@ -839,8 +795,8 @@ public Builder publicSignupPageIds(List publicSignupPageIds) { * @return {@link OnOffComponent} */ public OnOffComponent build() { - return new OnOffComponent(name, pricingScheme, unitName, description, handle, taxable, - prices, upgradeCharge, downgradeCredit, pricePoints, unitPrice, taxCode, + return new OnOffComponent(name, unitName, description, handle, taxable, prices, + upgradeCharge, downgradeCredit, pricePoints, unitPrice, taxCode, hideDateRangeOnInvoice, priceInCents, displayOnHostedPage, allowFractionalQuantities, publicSignupPageIds); } diff --git a/src/main/java/com/maxio/advancedbilling/models/PrepaidComponentPricePoint.java b/src/main/java/com/maxio/advancedbilling/models/PrepaidComponentPricePoint.java index 063fc15a..d4735ffe 100644 --- a/src/main/java/com/maxio/advancedbilling/models/PrepaidComponentPricePoint.java +++ b/src/main/java/com/maxio/advancedbilling/models/PrepaidComponentPricePoint.java @@ -17,7 +17,7 @@ public class PrepaidComponentPricePoint { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private OveragePricing overagePricing; @@ -31,14 +31,14 @@ public PrepaidComponentPricePoint() { * Initialization constructor. * @param name String value for name. * @param handle String value for handle. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. * @param overagePricing OveragePricing value for overagePricing. */ public PrepaidComponentPricePoint( String name, String handle, - String pricingScheme, + PricingScheme pricingScheme, List prices, OveragePricing overagePricing) { this.name = name; @@ -88,20 +88,26 @@ public void setHandle(String handle) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -175,7 +181,7 @@ public Builder toBuilder() { public static class Builder { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private OveragePricing overagePricing; @@ -203,10 +209,10 @@ public Builder handle(String handle) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/PricePoint.java b/src/main/java/com/maxio/advancedbilling/models/PricePoint.java index 89dcb631..a3d8e1fd 100644 --- a/src/main/java/com/maxio/advancedbilling/models/PricePoint.java +++ b/src/main/java/com/maxio/advancedbilling/models/PricePoint.java @@ -17,7 +17,7 @@ public class PricePoint { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private Boolean useSiteExchangeRate; private OveragePricing overagePricing; @@ -37,7 +37,7 @@ public PricePoint() { * Initialization constructor. * @param name String value for name. * @param handle String value for handle. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of Price value for prices. * @param useSiteExchangeRate Boolean value for useSiteExchangeRate. * @param overagePricing OveragePricing value for overagePricing. @@ -49,7 +49,7 @@ public PricePoint() { public PricePoint( String name, String handle, - String pricingScheme, + PricingScheme pricingScheme, List prices, Boolean useSiteExchangeRate, OveragePricing overagePricing, @@ -109,20 +109,26 @@ public void setHandle(String handle) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -315,7 +321,7 @@ public Builder toBuilder() { public static class Builder { private String name; private String handle; - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; private Boolean useSiteExchangeRate = true; private OveragePricing overagePricing; @@ -348,10 +354,10 @@ public Builder handle(String handle) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/PricingScheme1.java b/src/main/java/com/maxio/advancedbilling/models/PricingScheme1.java deleted file mode 100644 index 722e8d6c..00000000 --- a/src/main/java/com/maxio/advancedbilling/models/PricingScheme1.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * AdvancedBilling - * - * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). - */ - -package com.maxio.advancedbilling.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.TreeMap; - - -/** - * PricingScheme1 to be used. - */ -public enum PricingScheme1 { - STAIRSTEP, - - VOLUME, - - PER_UNIT, - - TIERED; - - - private static TreeMap valueMap = new TreeMap<>(); - private String value; - - static { - STAIRSTEP.value = "stairstep"; - VOLUME.value = "volume"; - PER_UNIT.value = "per_unit"; - TIERED.value = "tiered"; - - valueMap.put("stairstep", STAIRSTEP); - valueMap.put("volume", VOLUME); - valueMap.put("per_unit", PER_UNIT); - valueMap.put("tiered", TIERED); - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - * @throws IOException when provided value is not mapped to any enum member. - */ - @JsonCreator - public static PricingScheme1 constructFromString(String toConvert) throws IOException { - PricingScheme1 enumValue = fromString(toConvert); - if (enumValue == null) - { - throw new IOException("Unable to create enum instance with value: " + toConvert); - } - return enumValue; - } - - /** - * Returns the enum member associated with the given string value. - * @param toConvert String value to get enum member. - * @return The enum member against the given string value. - */ - public static PricingScheme1 fromString(String toConvert) { - return valueMap.get(toConvert); - } - - /** - * Returns the string value associated with the enum member. - * @return The string value against enum member. - */ - @JsonValue - public String value() { - return value; - } - - /** - * Get string representation of this enum. - */ - @Override - public String toString() { - return value.toString(); - } - - /** - * Convert list of PricingScheme1 values to list of string values. - * @param toConvert The list of PricingScheme1 values to convert. - * @return List of representative string values. - */ - public static List toValue(List toConvert) { - if (toConvert == null) { - return null; - } - List convertedValues = new ArrayList<>(); - for (PricingScheme1 enumValue : toConvert) { - convertedValues.add(enumValue.value); - } - return convertedValues; - } -} \ No newline at end of file diff --git a/src/main/java/com/maxio/advancedbilling/models/RenewalPreviewLineItem.java b/src/main/java/com/maxio/advancedbilling/models/RenewalPreviewLineItem.java index cf8fddab..4948ec3b 100644 --- a/src/main/java/com/maxio/advancedbilling/models/RenewalPreviewLineItem.java +++ b/src/main/java/com/maxio/advancedbilling/models/RenewalPreviewLineItem.java @@ -26,6 +26,8 @@ public class RenewalPreviewLineItem { private String componentHandle; private String componentName; private String productHandle; + private String periodRangeStart; + private String periodRangeEnd; /** * Default constructor. @@ -47,6 +49,8 @@ public RenewalPreviewLineItem() { * @param componentHandle String value for componentHandle. * @param componentName String value for componentName. * @param productHandle String value for productHandle. + * @param periodRangeStart String value for periodRangeStart. + * @param periodRangeEnd String value for periodRangeEnd. */ public RenewalPreviewLineItem( String transactionType, @@ -60,7 +64,9 @@ public RenewalPreviewLineItem( Integer componentId, String componentHandle, String componentName, - String productHandle) { + String productHandle, + String periodRangeStart, + String periodRangeEnd) { this.transactionType = transactionType; this.kind = kind; this.amountInCents = amountInCents; @@ -73,6 +79,8 @@ public RenewalPreviewLineItem( this.componentHandle = componentHandle; this.componentName = componentName; this.productHandle = productHandle; + this.periodRangeStart = periodRangeStart; + this.periodRangeEnd = periodRangeEnd; } /** @@ -303,6 +311,44 @@ public void setProductHandle(String productHandle) { this.productHandle = productHandle; } + /** + * Getter for PeriodRangeStart. + * @return Returns the String + */ + @JsonGetter("period_range_start") + @JsonInclude(JsonInclude.Include.NON_NULL) + public String getPeriodRangeStart() { + return periodRangeStart; + } + + /** + * Setter for PeriodRangeStart. + * @param periodRangeStart Value for String + */ + @JsonSetter("period_range_start") + public void setPeriodRangeStart(String periodRangeStart) { + this.periodRangeStart = periodRangeStart; + } + + /** + * Getter for PeriodRangeEnd. + * @return Returns the String + */ + @JsonGetter("period_range_end") + @JsonInclude(JsonInclude.Include.NON_NULL) + public String getPeriodRangeEnd() { + return periodRangeEnd; + } + + /** + * Setter for PeriodRangeEnd. + * @param periodRangeEnd Value for String + */ + @JsonSetter("period_range_end") + public void setPeriodRangeEnd(String periodRangeEnd) { + this.periodRangeEnd = periodRangeEnd; + } + /** * Converts this RenewalPreviewLineItem into string format. * @return String representation of this class @@ -314,7 +360,8 @@ public String toString() { + discountAmountInCents + ", taxableAmountInCents=" + taxableAmountInCents + ", productId=" + productId + ", productName=" + productName + ", componentId=" + componentId + ", componentHandle=" + componentHandle + ", componentName=" - + componentName + ", productHandle=" + productHandle + "]"; + + componentName + ", productHandle=" + productHandle + ", periodRangeStart=" + + periodRangeStart + ", periodRangeEnd=" + periodRangeEnd + "]"; } /** @@ -335,7 +382,9 @@ public Builder toBuilder() { .componentId(getComponentId()) .componentHandle(getComponentHandle()) .componentName(getComponentName()) - .productHandle(getProductHandle()); + .productHandle(getProductHandle()) + .periodRangeStart(getPeriodRangeStart()) + .periodRangeEnd(getPeriodRangeEnd()); return builder; } @@ -355,6 +404,8 @@ public static class Builder { private String componentHandle; private String componentName; private String productHandle; + private String periodRangeStart; + private String periodRangeEnd; @@ -478,6 +529,26 @@ public Builder productHandle(String productHandle) { return this; } + /** + * Setter for periodRangeStart. + * @param periodRangeStart String value for periodRangeStart. + * @return Builder + */ + public Builder periodRangeStart(String periodRangeStart) { + this.periodRangeStart = periodRangeStart; + return this; + } + + /** + * Setter for periodRangeEnd. + * @param periodRangeEnd String value for periodRangeEnd. + * @return Builder + */ + public Builder periodRangeEnd(String periodRangeEnd) { + this.periodRangeEnd = periodRangeEnd; + return this; + } + /** * Builds a new {@link RenewalPreviewLineItem} object using the set fields. * @return {@link RenewalPreviewLineItem} @@ -485,7 +556,8 @@ public Builder productHandle(String productHandle) { public RenewalPreviewLineItem build() { return new RenewalPreviewLineItem(transactionType, kind, amountInCents, memo, discountAmountInCents, taxableAmountInCents, productId, productName, - componentId, componentHandle, componentName, productHandle); + componentId, componentHandle, componentName, productHandle, periodRangeStart, + periodRangeEnd); } } } diff --git a/src/main/java/com/maxio/advancedbilling/models/Segment.java b/src/main/java/com/maxio/advancedbilling/models/Segment.java index e548a8b8..c1d5f1ac 100644 --- a/src/main/java/com/maxio/advancedbilling/models/Segment.java +++ b/src/main/java/com/maxio/advancedbilling/models/Segment.java @@ -23,7 +23,7 @@ public class Segment { private Integer componentId; private Integer pricePointId; private Integer eventBasedBillingMetricId; - private String pricingScheme; + private PricingScheme pricingScheme; private SegmentSegmentProperty1Value segmentProperty1Value; private SegmentSegmentProperty2Value segmentProperty2Value; private SegmentSegmentProperty3Value segmentProperty3Value; @@ -44,7 +44,7 @@ public Segment() { * @param componentId Integer value for componentId. * @param pricePointId Integer value for pricePointId. * @param eventBasedBillingMetricId Integer value for eventBasedBillingMetricId. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param segmentProperty1Value SegmentSegmentProperty1Value value for segmentProperty1Value. * @param segmentProperty2Value SegmentSegmentProperty2Value value for segmentProperty2Value. * @param segmentProperty3Value SegmentSegmentProperty3Value value for segmentProperty3Value. @@ -58,7 +58,7 @@ public Segment( Integer componentId, Integer pricePointId, Integer eventBasedBillingMetricId, - String pricingScheme, + PricingScheme pricingScheme, SegmentSegmentProperty1Value segmentProperty1Value, SegmentSegmentProperty2Value segmentProperty2Value, SegmentSegmentProperty3Value segmentProperty3Value, @@ -158,20 +158,26 @@ public void setEventBasedBillingMetricId(Integer eventBasedBillingMetricId) { /** * Getter for PricingScheme. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -353,7 +359,7 @@ public static class Builder { private Integer componentId; private Integer pricePointId; private Integer eventBasedBillingMetricId; - private String pricingScheme; + private PricingScheme pricingScheme; private SegmentSegmentProperty1Value segmentProperty1Value; private SegmentSegmentProperty2Value segmentProperty2Value; private SegmentSegmentProperty3Value segmentProperty3Value; @@ -406,10 +412,10 @@ public Builder eventBasedBillingMetricId(Integer eventBasedBillingMetricId) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/SubscriptionComponent.java b/src/main/java/com/maxio/advancedbilling/models/SubscriptionComponent.java index 253af0bb..8c028ffe 100644 --- a/src/main/java/com/maxio/advancedbilling/models/SubscriptionComponent.java +++ b/src/main/java/com/maxio/advancedbilling/models/SubscriptionComponent.java @@ -11,6 +11,7 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.maxio.advancedbilling.models.containers.SubscriptionComponentPricePointType; +import com.maxio.advancedbilling.models.containers.SubscriptionComponentPricingScheme; import io.apimatic.core.types.OptionalNullable; /** @@ -25,7 +26,7 @@ public class SubscriptionComponent { private Integer unitBalance; private String currency; private Integer allocatedQuantity; - private OptionalNullable pricingScheme; + private OptionalNullable pricingScheme; private Integer componentId; private OptionalNullable componentHandle; private Integer subscriptionId; @@ -63,7 +64,7 @@ public SubscriptionComponent() { * @param unitBalance Integer value for unitBalance. * @param currency String value for currency. * @param allocatedQuantity Integer value for allocatedQuantity. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme SubscriptionComponentPricingScheme value for pricingScheme. * @param componentId Integer value for componentId. * @param componentHandle String value for componentHandle. * @param subscriptionId Integer value for subscriptionId. @@ -94,7 +95,7 @@ public SubscriptionComponent( Integer unitBalance, String currency, Integer allocatedQuantity, - String pricingScheme, + SubscriptionComponentPricingScheme pricingScheme, Integer componentId, String componentHandle, Integer subscriptionId, @@ -156,7 +157,7 @@ public SubscriptionComponent( * @param unitBalance Integer value for unitBalance. * @param currency String value for currency. * @param allocatedQuantity Integer value for allocatedQuantity. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme SubscriptionComponentPricingScheme value for pricingScheme. * @param componentId Integer value for componentId. * @param componentHandle String value for componentHandle. * @param subscriptionId Integer value for subscriptionId. @@ -181,7 +182,7 @@ public SubscriptionComponent( protected SubscriptionComponent(Integer id, String name, String kind, String unitName, Boolean enabled, Integer unitBalance, String currency, Integer allocatedQuantity, - OptionalNullable pricingScheme, Integer componentId, + OptionalNullable pricingScheme, Integer componentId, OptionalNullable componentHandle, Integer subscriptionId, Boolean recurring, OptionalNullable upgradeCharge, OptionalNullable downgradeCredit, OptionalNullable archivedAt, @@ -383,29 +384,29 @@ public void setAllocatedQuantity(Integer allocatedQuantity) { /** * Internal Getter for PricingScheme. - * @return Returns the Internal String + * @return Returns the Internal SubscriptionComponentPricingScheme */ @JsonGetter("pricing_scheme") @JsonInclude(JsonInclude.Include.NON_NULL) @JsonSerialize(using = OptionalNullable.Serializer.class) - protected OptionalNullable internalGetPricingScheme() { + protected OptionalNullable internalGetPricingScheme() { return this.pricingScheme; } /** * Getter for PricingScheme. - * @return Returns the String + * @return Returns the SubscriptionComponentPricingScheme */ - public String getPricingScheme() { + public SubscriptionComponentPricingScheme getPricingScheme() { return OptionalNullable.getFrom(pricingScheme); } /** * Setter for PricingScheme. - * @param pricingScheme Value for String + * @param pricingScheme Value for SubscriptionComponentPricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(SubscriptionComponentPricingScheme pricingScheme) { this.pricingScheme = OptionalNullable.of(pricingScheme); } @@ -1031,7 +1032,7 @@ public static class Builder { private Integer unitBalance; private String currency; private Integer allocatedQuantity; - private OptionalNullable pricingScheme; + private OptionalNullable pricingScheme; private Integer componentId; private OptionalNullable componentHandle; private Integer subscriptionId; @@ -1137,10 +1138,10 @@ public Builder allocatedQuantity(Integer allocatedQuantity) { /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme SubscriptionComponentPricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(SubscriptionComponentPricingScheme pricingScheme) { this.pricingScheme = OptionalNullable.of(pricingScheme); return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/UpdateSegment.java b/src/main/java/com/maxio/advancedbilling/models/UpdateSegment.java index 2b542ec0..2cfa48c5 100644 --- a/src/main/java/com/maxio/advancedbilling/models/UpdateSegment.java +++ b/src/main/java/com/maxio/advancedbilling/models/UpdateSegment.java @@ -15,7 +15,7 @@ * This is a model class for UpdateSegment type. */ public class UpdateSegment { - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -26,11 +26,11 @@ public UpdateSegment() { /** * Initialization constructor. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @param prices List of CreateOrUpdateSegmentPrice value for prices. */ public UpdateSegment( - String pricingScheme, + PricingScheme pricingScheme, List prices) { this.pricingScheme = pricingScheme; this.prices = prices; @@ -38,27 +38,25 @@ public UpdateSegment( /** * Getter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an - * overview of pricing schemes. - * @return Returns the String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @return Returns the PricingScheme */ @JsonGetter("pricing_scheme") - public String getPricingScheme() { + public PricingScheme getPricingScheme() { return pricingScheme; } /** * Setter for PricingScheme. - * The handle for the pricing scheme. Available options: per_unit, volume, tiered, stairstep. - * See [Price Bracket - * Rules](https://help.chargify.com/products/product-components.html#price-bracket-rules) for an - * overview of pricing schemes. - * @param pricingScheme Value for String + * The identifier for the pricing scheme. See [Product + * Components](https://help.chargify.com/products/product-components.html) for an overview of + * pricing schemes. + * @param pricingScheme Value for PricingScheme */ @JsonSetter("pricing_scheme") - public void setPricingScheme(String pricingScheme) { + public void setPricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } @@ -105,7 +103,7 @@ public Builder toBuilder() { * Class to build instances of {@link UpdateSegment}. */ public static class Builder { - private String pricingScheme; + private PricingScheme pricingScheme; private List prices; /** @@ -116,18 +114,18 @@ public Builder() { /** * Initialization constructor. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. */ - public Builder(String pricingScheme) { + public Builder(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; } /** * Setter for pricingScheme. - * @param pricingScheme String value for pricingScheme. + * @param pricingScheme PricingScheme value for pricingScheme. * @return Builder */ - public Builder pricingScheme(String pricingScheme) { + public Builder pricingScheme(PricingScheme pricingScheme) { this.pricingScheme = pricingScheme; return this; } diff --git a/src/main/java/com/maxio/advancedbilling/models/containers/ComponentPricingScheme.java b/src/main/java/com/maxio/advancedbilling/models/containers/ComponentPricingScheme.java new file mode 100644 index 00000000..c0b616b6 --- /dev/null +++ b/src/main/java/com/maxio/advancedbilling/models/containers/ComponentPricingScheme.java @@ -0,0 +1,104 @@ +/* + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +package com.maxio.advancedbilling.models.containers; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.maxio.advancedbilling.ApiHelper; +import com.maxio.advancedbilling.models.PricingScheme; +import io.apimatic.core.annotations.TypeCombinator.TypeCombinatorCase; +import java.io.IOException; +import java.util.Arrays; + +/** + * This is a container class for one-of types. + */ +@JsonDeserialize(using = ComponentPricingScheme.ComponentPricingSchemeDeserializer.class) +public abstract class ComponentPricingScheme { + + /** + * This is Pricing Scheme case. + * @param pricingScheme PricingScheme value for pricingScheme. + * @return The PricingSchemeCase object. + */ + public static ComponentPricingScheme fromPricingScheme(PricingScheme pricingScheme) { + return pricingScheme == null ? null : new PricingSchemeCase(pricingScheme); + } + + /** + * Method to match from the provided one-of cases. + * @param The type to return after applying callback. + * @param cases The one-of type cases callback. + * @return The one-of matched case. + */ + public abstract R match(Cases cases); + + /** + * This is interface for one-of cases. + * @param The type to return after applying callback. + */ + public interface Cases { + R pricingScheme(PricingScheme pricingScheme); + } + + /** + * This is a implementation class for PricingSchemeCase. + */ + @JsonDeserialize(using = JsonDeserializer.None.class) + @TypeCombinatorCase(type = "PricingScheme") + private static class PricingSchemeCase extends ComponentPricingScheme { + + @JsonValue + private PricingScheme pricingScheme; + + PricingSchemeCase(PricingScheme pricingScheme) { + this.pricingScheme = pricingScheme; + } + + @Override + public R match(Cases cases) { + return cases.pricingScheme(this.pricingScheme); + } + + @JsonCreator + private PricingSchemeCase(JsonNode jsonNode) throws IOException { + this.pricingScheme = + PricingScheme.fromString(ApiHelper.deserialize(jsonNode, String.class)); + if (this.pricingScheme == null) { + throw new IllegalArgumentException(); + } + } + + @Override + public String toString() { + return pricingScheme.toString(); + } + } + + /** + * This is a custom deserializer class for ComponentPricingScheme. + */ + protected static class ComponentPricingSchemeDeserializer + extends JsonDeserializer { + + @Override + public ComponentPricingScheme deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + ObjectCodec oc = jp.getCodec(); + JsonNode node = oc.readTree(jp); + return ApiHelper.deserialize(node, Arrays.asList(PricingSchemeCase.class), true); + } + } + +} diff --git a/src/main/java/com/maxio/advancedbilling/models/containers/SubscriptionComponentPricingScheme.java b/src/main/java/com/maxio/advancedbilling/models/containers/SubscriptionComponentPricingScheme.java new file mode 100644 index 00000000..d629f339 --- /dev/null +++ b/src/main/java/com/maxio/advancedbilling/models/containers/SubscriptionComponentPricingScheme.java @@ -0,0 +1,105 @@ +/* + * AdvancedBilling + * + * This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ). + */ + +package com.maxio.advancedbilling.models.containers; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.ObjectCodec; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.maxio.advancedbilling.ApiHelper; +import com.maxio.advancedbilling.models.PricingScheme; +import io.apimatic.core.annotations.TypeCombinator.TypeCombinatorCase; +import java.io.IOException; +import java.util.Arrays; + +/** + * This is a container class for one-of types. + */ +@JsonDeserialize(using = SubscriptionComponentPricingScheme.SubscriptionComponentPricingSchemeDeserializer.class) +public abstract class SubscriptionComponentPricingScheme { + + /** + * This is Pricing Scheme case. + * @param pricingScheme PricingScheme value for pricingScheme. + * @return The PricingSchemeCase object. + */ + public static SubscriptionComponentPricingScheme fromPricingScheme( + PricingScheme pricingScheme) { + return pricingScheme == null ? null : new PricingSchemeCase(pricingScheme); + } + + /** + * Method to match from the provided one-of cases. + * @param The type to return after applying callback. + * @param cases The one-of type cases callback. + * @return The one-of matched case. + */ + public abstract R match(Cases cases); + + /** + * This is interface for one-of cases. + * @param The type to return after applying callback. + */ + public interface Cases { + R pricingScheme(PricingScheme pricingScheme); + } + + /** + * This is a implementation class for PricingSchemeCase. + */ + @JsonDeserialize(using = JsonDeserializer.None.class) + @TypeCombinatorCase(type = "PricingScheme") + private static class PricingSchemeCase extends SubscriptionComponentPricingScheme { + + @JsonValue + private PricingScheme pricingScheme; + + PricingSchemeCase(PricingScheme pricingScheme) { + this.pricingScheme = pricingScheme; + } + + @Override + public R match(Cases cases) { + return cases.pricingScheme(this.pricingScheme); + } + + @JsonCreator + private PricingSchemeCase(JsonNode jsonNode) throws IOException { + this.pricingScheme = + PricingScheme.fromString(ApiHelper.deserialize(jsonNode, String.class)); + if (this.pricingScheme == null) { + throw new IllegalArgumentException(); + } + } + + @Override + public String toString() { + return pricingScheme.toString(); + } + } + + /** + * This is a custom deserializer class for SubscriptionComponentPricingScheme. + */ + protected static class SubscriptionComponentPricingSchemeDeserializer + extends JsonDeserializer { + + @Override + public SubscriptionComponentPricingScheme deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + ObjectCodec oc = jp.getCodec(); + JsonNode node = oc.readTree(jp); + return ApiHelper.deserialize(node, Arrays.asList(PricingSchemeCase.class), true); + } + } + +} diff --git a/tests/src/test/java/com/maxio/advancedbilling/controllers/components/ComponentsControllerPromotePricePointToDefaultTest.java b/tests/src/test/java/com/maxio/advancedbilling/controllers/components/ComponentsControllerPromotePricePointToDefaultTest.java index 80a8426b..d39fa9dd 100644 --- a/tests/src/test/java/com/maxio/advancedbilling/controllers/components/ComponentsControllerPromotePricePointToDefaultTest.java +++ b/tests/src/test/java/com/maxio/advancedbilling/controllers/components/ComponentsControllerPromotePricePointToDefaultTest.java @@ -7,6 +7,7 @@ import com.maxio.advancedbilling.models.CreateComponentPricePoint; import com.maxio.advancedbilling.models.CreateComponentPricePointRequest; import com.maxio.advancedbilling.models.Price; +import com.maxio.advancedbilling.models.PricingScheme; import com.maxio.advancedbilling.models.containers.CreateComponentPricePointRequestPricePoint; import com.maxio.advancedbilling.models.containers.PriceEndingQuantity; import com.maxio.advancedbilling.models.containers.PriceStartingQuantity; @@ -42,7 +43,8 @@ void shouldPromoteComponentPricePointToDefault() throws IOException, ApiExceptio "defaultPricePointName", "pricePointCount", "unitPrice") .isEqualTo(component); assertThat(componentWithUpdatedPricePoint.getDefaultPricePointId()).isEqualTo(catalogPricePoint.getId()); - assertThat(componentWithUpdatedPricePoint.getPricingScheme()).isEqualTo(catalogPricePoint.getPricingScheme()); + assertThat(componentWithUpdatedPricePoint.getPricingScheme().match(p -> p).value()) + .isEqualTo(catalogPricePoint.getPricingScheme().value()); assertThat(componentWithUpdatedPricePoint.getPrices()).usingRecursiveComparison() .isEqualTo(catalogPricePoint.getPrices()); assertThat(componentWithUpdatedPricePoint.getDefaultPricePointName()).isEqualTo(catalogPricePoint.getName()); @@ -79,7 +81,7 @@ private ComponentPricePoint createCatalogPricePoint(int componentId) throws IOEx CreateComponentPricePoint createComponentPricePoint = new CreateComponentPricePoint.Builder() .name("New price point") .handle("new-price-point-" + randomNumeric(5)) - .pricingScheme("stairstep") + .pricingScheme(PricingScheme.STAIRSTEP) .prices( List.of( new Price.Builder() diff --git a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptions/SubscriptionsControllerCreateTest.java b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptions/SubscriptionsControllerCreateTest.java index c1bcadf8..0e4bbd95 100644 --- a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptions/SubscriptionsControllerCreateTest.java +++ b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptions/SubscriptionsControllerCreateTest.java @@ -753,7 +753,8 @@ private void assertSubscriptionComponent(Component component1, SubscriptionCompo assertThat(subscriptionComponent1.getKind()).isEqualTo(component1.getKind().toString()); assertThat(subscriptionComponent1.getName()).isEqualTo(component1.getName()); assertThat(subscriptionComponent1.getUnitName()).isEqualTo(component1.getUnitName()); - assertThat(subscriptionComponent1.getPricingScheme()).isEqualTo(component1.getPricingScheme()); + assertThat(subscriptionComponent1.getPricingScheme().match(p -> p).value()) + .isEqualTo(component1.getPricingScheme().match(p -> p).value()); assertThat(subscriptionComponent1.getComponentHandle()).isEqualTo(component1.getHandle()); assertThat(subscriptionComponent1.getSubscriptionId()).isEqualTo(subscription.getId()); assertThat(subscriptionComponent1.getRecurring()).isFalse(); diff --git a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerPreviewRenewalTest.java b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerPreviewRenewalTest.java new file mode 100644 index 00000000..5fbc2f4c --- /dev/null +++ b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerPreviewRenewalTest.java @@ -0,0 +1,161 @@ +package com.maxio.advancedbilling.controllers.subscriptionstatus; + +import com.maxio.advancedbilling.TestClient; +import com.maxio.advancedbilling.exceptions.ApiException; +import com.maxio.advancedbilling.models.Component; +import com.maxio.advancedbilling.models.ComponentPricePoint; +import com.maxio.advancedbilling.models.RenewalPreview; +import com.maxio.advancedbilling.models.RenewalPreviewComponent; +import com.maxio.advancedbilling.models.RenewalPreviewLineItem; +import com.maxio.advancedbilling.models.RenewalPreviewRequest; +import com.maxio.advancedbilling.models.Subscription; +import com.maxio.advancedbilling.models.containers.RenewalPreviewComponentComponentId; +import com.maxio.advancedbilling.models.containers.RenewalPreviewComponentPricePointId; +import com.maxio.advancedbilling.utils.TestSetup; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.util.List; + +import static com.maxio.advancedbilling.utils.assertions.CommonAssertions.assertNotFound; +import static com.maxio.advancedbilling.utils.assertions.CommonAssertions.assertThatErrorListResponse; +import static com.maxio.advancedbilling.utils.assertions.CommonAssertions.assertUnauthorized; +import static org.assertj.core.api.Assertions.assertThat; + +public class SubscriptionStatusControllerPreviewRenewalTest extends SubscriptionStatusControllerTestBase { + + @Test + void shouldPreviewRenewal() throws IOException, ApiException { + // given + Subscription subscription = createSubscription(); + + TestSetup testSetup = new TestSetup(); + Component component1 = testSetup.createQuantityBasedComponent(productFamilyId); + Component component2 = testSetup.createQuantityBasedComponent(productFamilyId); + ComponentPricePoint component2CatalogPricePoint = testSetup + .createPricePointForComponent(component2.getId(), 5.0); + + Component component3 = testSetup.createQuantityBasedComponent(productFamilyId); + ComponentPricePoint component3CatalogPricePoint = testSetup + .createPricePointForComponent(component3.getId(), 8.0); + + // when + RenewalPreview renewalPreview = subscriptionStatusController.previewRenewal(subscription.getId(), + new RenewalPreviewRequest( + List.of( + new RenewalPreviewComponent( + RenewalPreviewComponentComponentId.fromNumber(component1.getId()), + 10000, + null + ), + new RenewalPreviewComponent( + RenewalPreviewComponentComponentId.fromString("handle:" + component2.getHandle()), + 10000, + RenewalPreviewComponentPricePointId.fromNumber(component2CatalogPricePoint.getId()) + ), + new RenewalPreviewComponent( + RenewalPreviewComponentComponentId.fromNumber(component3.getId()), + 100, + RenewalPreviewComponentPricePointId.fromString("handle:" + component3CatalogPricePoint.getHandle()) + ) + ) + )).getRenewalPreview(); + long expectedProductPrice = product.getPriceInCents(); + long expectedComponent1Price = 10000 * 100; + long expectedComponent2Price = 5 * 10000 * 100; + long expectedComponent3Price = 8 * 100 * 100; + long expectedTotalPrice = expectedProductPrice + expectedComponent1Price + expectedComponent2Price + expectedComponent3Price; + + // then + assertThat(renewalPreview.getNextAssessmentAt()).isNotNull(); + assertThat(renewalPreview.getTotalTaxInCents()).isZero(); + assertThat(renewalPreview.getTotalDiscountInCents()).isZero(); + assertThat(renewalPreview.getExistingBalanceInCents()).isZero(); + assertThat(renewalPreview.getTotalInCents()).isEqualTo(expectedTotalPrice); + assertThat(renewalPreview.getTotalAmountDueInCents()).isEqualTo(expectedTotalPrice); + assertThat(renewalPreview.getSubtotalInCents()).isEqualTo(expectedTotalPrice); + assertThat(renewalPreview.getUncalculatedTaxes()).isFalse(); + assertThat(renewalPreview.getLineItems()) + .usingRecursiveFieldByFieldElementComparatorIgnoringFields("memo", "periodRangeStart", "periodRangeEnd") + .containsExactlyInAnyOrder( + new RenewalPreviewLineItem.Builder() + .transactionType("charge") + .kind("baseline") + .amountInCents(product.getPriceInCents()) + .discountAmountInCents(0L) + .taxableAmountInCents(0L) + .productId(product.getId()) + .productName(product.getName()) + .productHandle(product.getHandle()) + .build(), + new RenewalPreviewLineItem.Builder() + .transactionType("charge") + .kind("quantity_based_component") + .amountInCents(expectedComponent1Price) + .discountAmountInCents(0L) + .taxableAmountInCents(0L) + .componentId(component1.getId()) + .componentName(component1.getName()) + .componentHandle(component1.getHandle()) + .build(), + new RenewalPreviewLineItem.Builder() + .transactionType("charge") + .kind("quantity_based_component") + .amountInCents(expectedComponent2Price) + .discountAmountInCents(0L) + .taxableAmountInCents(0L) + .componentId(component2.getId()) + .componentName(component2.getName()) + .componentHandle(component2.getHandle()) + .build(), + new RenewalPreviewLineItem.Builder() + .transactionType("charge") + .kind("quantity_based_component") + .amountInCents(expectedComponent3Price) + .discountAmountInCents(0L) + .taxableAmountInCents(0L) + .componentId(component3.getId()) + .componentName(component3.getName()) + .componentHandle(component3.getHandle()) + .build() + ); + } + + @Test + void shouldNotPreviewRenewalForNonExistentSubscription() { + assertNotFound(() -> subscriptionStatusController.previewRenewal(5, new RenewalPreviewRequest())); + } + + @Test + void shouldNotPreviewRenewalWhenComponentDoesNotExist() throws IOException, ApiException { + // given + Subscription subscription = createSubscription(); + new TestSetup().createQuantityBasedComponent(productFamilyId); + RenewalPreviewRequest request = new RenewalPreviewRequest( + List.of( + new RenewalPreviewComponent( + RenewalPreviewComponentComponentId.fromNumber(12), + 10000, + null + ) + )); + + // when-then + assertThatErrorListResponse(() -> subscriptionStatusController.previewRenewal(subscription.getId(), request)) + .hasErrorCode(422) + .hasUnprocessableEntityMessage() + .hasErrors("Couldn't find Component by 12"); + } + + @Test + void shouldNotPreviewRenewalWhenProvidingInvalidCredentials() throws IOException, ApiException { + // given + Subscription subscription = createSubscription(); + + // when-then + assertUnauthorized(() -> TestClient.createInvalidCredentialsClient().getSubscriptionStatusController() + .previewRenewal(subscription.getId(), + new RenewalPreviewRequest())); + } + +} diff --git a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerReactivateSubscriptionTest.java b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerReactivateSubscriptionTest.java new file mode 100644 index 00000000..21277c5d --- /dev/null +++ b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerReactivateSubscriptionTest.java @@ -0,0 +1,80 @@ +package com.maxio.advancedbilling.controllers.subscriptionstatus; + +import com.maxio.advancedbilling.TestClient; +import com.maxio.advancedbilling.exceptions.ApiException; +import com.maxio.advancedbilling.models.CancellationOptions; +import com.maxio.advancedbilling.models.CancellationRequest; +import com.maxio.advancedbilling.models.ReactivateSubscriptionRequest; +import com.maxio.advancedbilling.models.ReactivationBilling; +import com.maxio.advancedbilling.models.ReactivationCharge; +import com.maxio.advancedbilling.models.Subscription; +import com.maxio.advancedbilling.models.containers.ReactivateSubscriptionRequestResume; +import org.junit.jupiter.api.Test; + +import java.io.IOException; + +import static com.maxio.advancedbilling.models.SubscriptionState.CANCELED; +import static com.maxio.advancedbilling.utils.assertions.CommonAssertions.assertNotFound; +import static com.maxio.advancedbilling.utils.assertions.CommonAssertions.assertThatErrorListResponse; +import static com.maxio.advancedbilling.utils.assertions.CommonAssertions.assertUnauthorized; +import static org.assertj.core.api.Assertions.assertThat; + +public class SubscriptionStatusControllerReactivateSubscriptionTest extends SubscriptionStatusControllerTestBase { + + @Test + void shouldReactivateSubscription() throws IOException, ApiException { + // given + Subscription subscription = createSubscription(); + subscriptionStatusController.cancelSubscription(subscription.getId(), new CancellationRequest( + new CancellationOptions() + )); + + // when + Subscription reactivatedSubscription = subscriptionStatusController.reactivateSubscription(subscription.getId(), + new ReactivateSubscriptionRequest.Builder() + .calendarBilling(new ReactivationBilling(ReactivationCharge.PRORATED)) + .includeTrial(true) + .preserveBalance(true) + .couponCode("ff") + .useCreditsAndPrepayments(true) + .resume(ReactivateSubscriptionRequestResume.fromBoolean(true)) + .build()) + .getSubscription(); + + // then + assertThat(reactivatedSubscription).usingRecursiveComparison() + .ignoringFields("updatedAt", "cancelAtEndOfPeriod", "previousState", "productPricePointType") + .isEqualTo(subscription); + assertThat(reactivatedSubscription.getPreviousState()).isEqualTo(CANCELED); + } + + @Test + void shouldNotReactivateActiveSubscription() throws IOException, ApiException { + // given + Subscription subscription = createSubscription(); + + // when-then + assertThatErrorListResponse(() -> subscriptionStatusController.reactivateSubscription(subscription.getId(), + new ReactivateSubscriptionRequest())) + .hasErrorCode(422) + .hasUnprocessableEntityMessage() + .hasErrors("Cannot reactivate a subscription that is not marked \"Canceled\" or \"Trial Ended\"."); + } + + @Test + void shouldNotReactivateNonExistentSubscription() { + assertNotFound(() -> subscriptionStatusController.reactivateSubscription(5, new ReactivateSubscriptionRequest())); + } + + @Test + void shouldNotReactivateSubscriptionWhenProvidingInvalidCredentials() throws IOException, ApiException { + // given + Subscription subscription = createSubscription(); + + // when-then + assertUnauthorized(() -> TestClient.createInvalidCredentialsClient().getSubscriptionStatusController() + .reactivateSubscription(subscription.getId(), + new ReactivateSubscriptionRequest())); + } + +} diff --git a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusResumeSubscriptionTest.java b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerResumeSubscriptionTest.java similarity index 95% rename from tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusResumeSubscriptionTest.java rename to tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerResumeSubscriptionTest.java index 72e128ab..e3bb7082 100644 --- a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusResumeSubscriptionTest.java +++ b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerResumeSubscriptionTest.java @@ -15,7 +15,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; -public class SubscriptionStatusResumeSubscriptionTest extends SubscriptionStatusControllerTestBase { +public class SubscriptionStatusControllerResumeSubscriptionTest extends SubscriptionStatusControllerTestBase { @Test void shouldResumePausedSubscription() throws IOException, ApiException { diff --git a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerTestBase.java b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerTestBase.java index 8c41cc33..6d030e79 100644 --- a/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerTestBase.java +++ b/tests/src/test/java/com/maxio/advancedbilling/controllers/subscriptionstatus/SubscriptionStatusControllerTestBase.java @@ -17,6 +17,7 @@ import com.maxio.advancedbilling.models.Customer; import com.maxio.advancedbilling.models.IntervalUnit; import com.maxio.advancedbilling.models.PaymentProfileAttributes; +import com.maxio.advancedbilling.models.Product; import com.maxio.advancedbilling.models.ProductFamily; import com.maxio.advancedbilling.models.Subscription; import com.maxio.advancedbilling.models.containers.PaymentProfileAttributesExpirationMonth; @@ -32,8 +33,9 @@ abstract class SubscriptionStatusControllerTestBase { protected static final SubscriptionsController subscriptionsController = TestClient.createClient().getSubscriptionsController(); protected static final SubscriptionStatusController subscriptionStatusController = TestClient.createClient().getSubscriptionStatusController(); - + protected static int productFamilyId; protected static int productId; + protected static Product product; protected static Customer customer; protected static Subscription subscription; @@ -46,8 +48,9 @@ static void setup() throws IOException, ApiException { ProductFamily productFamily = productFamiliesController.createProductFamily(new CreateProductFamilyRequest( new CreateProductFamily("Test Product Family " + seed, null))) .getProductFamily(); + productFamilyId = productFamily.getId(); - productId = productsController + product = productsController .createProduct(productFamily.getId(), new CreateOrUpdateProductRequest( new CreateOrUpdateProduct.Builder() .name("Initial Sample product-" + RandomStringUtils.randomAlphanumeric(5)) @@ -57,7 +60,8 @@ static void setup() throws IOException, ApiException { .intervalUnit(IntervalUnit.MONTH) .build() )) - .getProduct().getId(); + .getProduct(); + productId = product.getId(); customer = TestClient.createClient().getCustomersController() .createCustomer(new CreateCustomerRequest(new CreateCustomer.Builder() diff --git a/tests/src/test/java/com/maxio/advancedbilling/utils/TestSetup.java b/tests/src/test/java/com/maxio/advancedbilling/utils/TestSetup.java index 86a655fc..1938209f 100644 --- a/tests/src/test/java/com/maxio/advancedbilling/utils/TestSetup.java +++ b/tests/src/test/java/com/maxio/advancedbilling/utils/TestSetup.java @@ -5,7 +5,10 @@ import com.maxio.advancedbilling.exceptions.ApiException; import com.maxio.advancedbilling.models.Component; import com.maxio.advancedbilling.models.ComponentKindPath; +import com.maxio.advancedbilling.models.ComponentPricePoint; import com.maxio.advancedbilling.models.Coupon; +import com.maxio.advancedbilling.models.CreateComponentPricePoint; +import com.maxio.advancedbilling.models.CreateComponentPricePointRequest; import com.maxio.advancedbilling.models.CreateCustomer; import com.maxio.advancedbilling.models.CreateCustomerRequest; import com.maxio.advancedbilling.models.CreateMeteredComponent; @@ -19,18 +22,24 @@ import com.maxio.advancedbilling.models.Customer; import com.maxio.advancedbilling.models.IntervalUnit; import com.maxio.advancedbilling.models.MeteredComponent; +import com.maxio.advancedbilling.models.Price; import com.maxio.advancedbilling.models.PricingScheme; import com.maxio.advancedbilling.models.Product; import com.maxio.advancedbilling.models.ProductFamily; import com.maxio.advancedbilling.models.QuantityBasedComponent; import com.maxio.advancedbilling.models.containers.CreateComponentBody; +import com.maxio.advancedbilling.models.containers.CreateComponentPricePointRequestPricePoint; import com.maxio.advancedbilling.models.containers.CreateOrUpdateCouponCoupon; import com.maxio.advancedbilling.models.containers.CreateOrUpdatePercentageCouponPercentage; import com.maxio.advancedbilling.models.containers.MeteredComponentUnitPrice; +import com.maxio.advancedbilling.models.containers.PriceEndingQuantity; +import com.maxio.advancedbilling.models.containers.PriceStartingQuantity; +import com.maxio.advancedbilling.models.containers.PriceUnitPrice; import com.maxio.advancedbilling.models.containers.QuantityBasedComponentUnitPrice; import org.apache.commons.lang3.RandomStringUtils; import java.io.IOException; +import java.util.List; import static org.apache.commons.lang3.RandomStringUtils.randomNumeric; @@ -145,4 +154,32 @@ public Coupon createPercentageCoupon(ProductFamily productFamily, String percent .build()) .getCoupon(); } + + public ComponentPricePoint createPricePointForComponent(int componentId, double unitPrice) throws IOException, ApiException { + String name = "Price Point " + randomNumeric(5); + String handle = name.toLowerCase().replace(" ", "-"); + CreateComponentPricePoint createComponentPricePoint = new CreateComponentPricePoint.Builder() + .name(name) + .handle(handle) + .pricingScheme(PricingScheme.PER_UNIT) + .prices( + List.of( + new Price.Builder() + .unitPrice(PriceUnitPrice.fromPrecision(unitPrice)) + .startingQuantity(PriceStartingQuantity.fromNumber(1)) + .build() + ) + ) + .build(); + + return advancedBillingClient.getComponentsController() + .createComponentPricePoint(componentId, + new CreateComponentPricePointRequest( + CreateComponentPricePointRequestPricePoint + .fromCreateComponentPricePoint( + createComponentPricePoint + ) + )).getPricePoint(); + } + }