Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DE-678] Fixes for update component price point #84

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions doc/controllers/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -1242,16 +1242,24 @@ UpdateComponentPricePointRequest body = new UpdateComponentPricePointRequest.Bui
.prices(Arrays.asList(
new UpdatePrice.Builder()
.id(1)
.endingQuantity(100)
.unitPrice(5)
.endingQuantity(UpdatePriceEndingQuantity.fromNumber(
100
))
.unitPrice(UpdatePriceUnitPrice.fromPrecision(
5D
))
.build(),
new UpdatePrice.Builder()
.id(2)
.destroy("true")
.destroy(true)
.build(),
new UpdatePrice.Builder()
.unitPrice(4)
.startingQuantity(101)
.unitPrice(UpdatePriceUnitPrice.fromPrecision(
4D
))
.startingQuantity(UpdatePriceStartingQuantity.fromNumber(
101
))
.build()
))
.build())
Expand Down
6 changes: 3 additions & 3 deletions doc/models/component-price-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
| `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) |
| `CreatedAt` | `String` | Optional | - | String getCreatedAt() | setCreatedAt(String createdAt) |
| `UpdatedAt` | `String` | Optional | - | String getUpdatedAt() | setUpdatedAt(String updatedAt) |
| `ArchivedAt` | `ZonedDateTime` | Optional | - | ZonedDateTime getArchivedAt() | setArchivedAt(ZonedDateTime archivedAt) |
| `CreatedAt` | `ZonedDateTime` | Optional | - | ZonedDateTime getCreatedAt() | setCreatedAt(ZonedDateTime createdAt) |
| `UpdatedAt` | `ZonedDateTime` | Optional | - | ZonedDateTime getUpdatedAt() | setUpdatedAt(ZonedDateTime updatedAt) |
| `Prices` | [`List<ComponentPricePointPrice>`](../../doc/models/component-price-point-price.md) | Optional | - | List<ComponentPricePointPrice> getPrices() | setPrices(List<ComponentPricePointPrice> 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.<br>**Default**: `true` | Boolean getUseSiteExchangeRate() | setUseSiteExchangeRate(Boolean useSiteExchangeRate) |
| `SubscriptionId` | `Integer` | Optional | (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the subscription that the custom price point is for. | Integer getSubscriptionId() | setSubscriptionId(Integer subscriptionId) |
Expand Down
14 changes: 14 additions & 0 deletions doc/models/containers/update-price-ending-quantity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Update Price Ending Quantity

## Class Name

`UpdatePriceEndingQuantity`

## Cases

| Type | Factory Method |
| --- | --- |
| `int` | UpdatePriceEndingQuantity.fromNumber(int number) |
| `String` | UpdatePriceEndingQuantity.fromString(String string) |

14 changes: 14 additions & 0 deletions doc/models/containers/update-price-starting-quantity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Update Price Starting Quantity

## Class Name

`UpdatePriceStartingQuantity`

## Cases

| Type | Factory Method |
| --- | --- |
| `int` | UpdatePriceStartingQuantity.fromNumber(int number) |
| `String` | UpdatePriceStartingQuantity.fromString(String string) |

14 changes: 14 additions & 0 deletions doc/models/containers/update-price-unit-price.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Update Price Unit Price

## Class Name

`UpdatePriceUnitPrice`

## Cases

| Type | Factory Method |
| --- | --- |
| `double` | UpdatePriceUnitPrice.fromPrecision(double precision) |
| `String` | UpdatePriceUnitPrice.fromString(String string) |

4 changes: 2 additions & 2 deletions doc/models/update-component-price-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| `Name` | `String` | Optional | - | String getName() | setName(String name) |
| `Handle` | `String` | Optional | - | String getHandle() | setHandle(String handle) |
| `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) |
| `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.<br>**Default**: `true` | Boolean getUseSiteExchangeRate() | setUseSiteExchangeRate(Boolean useSiteExchangeRate) |
| `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. | Boolean getUseSiteExchangeRate() | setUseSiteExchangeRate(Boolean useSiteExchangeRate) |
| `TaxIncluded` | `Boolean` | Optional | Whether or not the price point includes tax | Boolean getTaxIncluded() | setTaxIncluded(Boolean taxIncluded) |
| `Interval` | `Integer` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. | Integer getInterval() | setInterval(Integer interval) |
| `IntervalUnit` | [`IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. | IntervalUnit getIntervalUnit() | setIntervalUnit(IntervalUnit intervalUnit) |
Expand All @@ -22,10 +22,10 @@

```json
{
"use_site_exchange_rate": true,
"name": "name2",
"handle": "handle8",
"pricing_scheme": "per_unit",
"use_site_exchange_rate": false,
"tax_included": false
}
```
Expand Down
16 changes: 8 additions & 8 deletions doc/models/update-price.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `Id` | `Integer` | Optional | - | Integer getId() | setId(Integer id) |
| `EndingQuantity` | `Integer` | Optional | - | Integer getEndingQuantity() | setEndingQuantity(Integer endingQuantity) |
| `UnitPrice` | `Integer` | Optional | - | Integer getUnitPrice() | setUnitPrice(Integer unitPrice) |
| `Destroy` | `String` | Optional | - | String getDestroy() | setDestroy(String destroy) |
| `StartingQuantity` | `Integer` | Optional | - | Integer getStartingQuantity() | setStartingQuantity(Integer startingQuantity) |
| `EndingQuantity` | [`UpdatePriceEndingQuantity`](../../doc/models/containers/update-price-ending-quantity.md) | Optional | This is a container for one-of cases. | UpdatePriceEndingQuantity getEndingQuantity() | setEndingQuantity(UpdatePriceEndingQuantity endingQuantity) |
| `UnitPrice` | [`UpdatePriceUnitPrice`](../../doc/models/containers/update-price-unit-price.md) | Optional | This is a container for one-of cases. | UpdatePriceUnitPrice getUnitPrice() | setUnitPrice(UpdatePriceUnitPrice unitPrice) |
| `Destroy` | `Boolean` | Optional | - | Boolean getDestroy() | setDestroy(Boolean destroy) |
| `StartingQuantity` | [`UpdatePriceStartingQuantity`](../../doc/models/containers/update-price-starting-quantity.md) | Optional | This is a container for one-of cases. | UpdatePriceStartingQuantity getStartingQuantity() | setStartingQuantity(UpdatePriceStartingQuantity startingQuantity) |

## Example (as JSON)

```json
{
"id": 18,
"ending_quantity": 38,
"unit_price": 88,
"_destroy": "_destroy0",
"starting_quantity": 64
"ending_quantity": 216,
"unit_price": 166.62,
"_destroy": false,
"starting_quantity": 242
}
```

Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ private ApiCall<ComponentPricePointResponse, ApiException> prepareUpdateComponen
response -> ApiHelper.deserialize(response, ComponentPricePointResponse.class))
.nullify404(false)
.localErrorCase("422",
ErrorCase.setReason("Unprocessable Entity (WebDAV)",
ErrorCase.setTemplate("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.",
(reason, context) -> new ErrorArrayMapResponseException(reason, context)))
.globalErrorCase(GLOBAL_ERROR_CASES))
.endpointConfiguration(param -> param
Expand Down Expand Up @@ -757,7 +757,7 @@ private ApiCall<ComponentPricePointResponse, ApiException> prepareArchiveCompone
response -> ApiHelper.deserialize(response, ComponentPricePointResponse.class))
.nullify404(false)
.localErrorCase("422",
ErrorCase.setReason("Unprocessable Entity (WebDAV)",
ErrorCase.setTemplate("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.",
(reason, context) -> new ErrorListResponseException(reason, context)))
.globalErrorCase(GLOBAL_ERROR_CASES))
.endpointConfiguration(param -> param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private ApiCall<List<Metadata>, ApiException> prepareCreateMetadataRequest(
Metadata[].class))
.nullify404(false)
.localErrorCase("422",
ErrorCase.setReason("Unprocessable Entity (WebDAV)",
ErrorCase.setTemplate("HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.",
(reason, context) -> new SingleErrorResponseException(reason, context)))
.globalErrorCase(GLOBAL_ERROR_CASES))
.endpointConfiguration(param -> param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.maxio.advancedbilling.DateTimeHelper;
import com.maxio.advancedbilling.models.containers.ComponentPricePointIntervalUnit;
import io.apimatic.core.types.OptionalNullable;
import java.time.ZonedDateTime;
import java.util.List;

/**
Expand All @@ -25,9 +28,9 @@ public class ComponentPricePoint {
private PricingScheme pricingScheme;
private Integer componentId;
private String handle;
private OptionalNullable<String> archivedAt;
private String createdAt;
private String updatedAt;
private OptionalNullable<ZonedDateTime> archivedAt;
private ZonedDateTime createdAt;
private ZonedDateTime updatedAt;
private List<ComponentPricePointPrice> prices;
private Boolean useSiteExchangeRate;
private Integer subscriptionId;
Expand All @@ -52,9 +55,9 @@ public ComponentPricePoint() {
* @param pricingScheme PricingScheme value for pricingScheme.
* @param componentId Integer value for componentId.
* @param handle String value for handle.
* @param archivedAt String value for archivedAt.
* @param createdAt String value for createdAt.
* @param updatedAt String value for updatedAt.
* @param archivedAt ZonedDateTime value for archivedAt.
* @param createdAt ZonedDateTime value for createdAt.
* @param updatedAt ZonedDateTime value for updatedAt.
* @param prices List of ComponentPricePointPrice value for prices.
* @param useSiteExchangeRate Boolean value for useSiteExchangeRate.
* @param subscriptionId Integer value for subscriptionId.
Expand All @@ -71,9 +74,9 @@ public ComponentPricePoint(
PricingScheme pricingScheme,
Integer componentId,
String handle,
String archivedAt,
String createdAt,
String updatedAt,
ZonedDateTime archivedAt,
ZonedDateTime createdAt,
ZonedDateTime updatedAt,
List<ComponentPricePointPrice> prices,
Boolean useSiteExchangeRate,
Integer subscriptionId,
Expand Down Expand Up @@ -109,9 +112,9 @@ public ComponentPricePoint(
* @param pricingScheme PricingScheme value for pricingScheme.
* @param componentId Integer value for componentId.
* @param handle String value for handle.
* @param archivedAt String value for archivedAt.
* @param createdAt String value for createdAt.
* @param updatedAt String value for updatedAt.
* @param archivedAt ZonedDateTime value for archivedAt.
* @param createdAt ZonedDateTime value for createdAt.
* @param updatedAt ZonedDateTime value for updatedAt.
* @param prices List of ComponentPricePointPrice value for prices.
* @param useSiteExchangeRate Boolean value for useSiteExchangeRate.
* @param subscriptionId Integer value for subscriptionId.
Expand All @@ -123,9 +126,10 @@ public ComponentPricePoint(

protected ComponentPricePoint(Integer id, PricePointType type, Boolean mDefault, String name,
PricingScheme pricingScheme, Integer componentId, String handle,
OptionalNullable<String> archivedAt, String createdAt, String updatedAt,
List<ComponentPricePointPrice> prices, Boolean useSiteExchangeRate,
Integer subscriptionId, Boolean taxIncluded, OptionalNullable<Integer> interval,
OptionalNullable<ZonedDateTime> archivedAt, ZonedDateTime createdAt,
ZonedDateTime updatedAt, List<ComponentPricePointPrice> prices,
Boolean useSiteExchangeRate, Integer subscriptionId, Boolean taxIncluded,
OptionalNullable<Integer> interval,
OptionalNullable<ComponentPricePointIntervalUnit> intervalUnit,
List<ComponentCurrencyPrice> currencyPrices) {
this.id = id;
Expand Down Expand Up @@ -298,29 +302,30 @@ public void setHandle(String handle) {

/**
* Internal Getter for ArchivedAt.
* @return Returns the Internal String
* @return Returns the Internal ZonedDateTime
*/
@JsonGetter("archived_at")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonSerialize(using = OptionalNullable.Serializer.class)
protected OptionalNullable<String> internalGetArchivedAt() {
@JsonSerialize(using = OptionalNullable.ZonedRfc8601DateTimeSerializer.class)
protected OptionalNullable<ZonedDateTime> internalGetArchivedAt() {
return this.archivedAt;
}

/**
* Getter for ArchivedAt.
* @return Returns the String
* @return Returns the ZonedDateTime
*/
public String getArchivedAt() {
public ZonedDateTime getArchivedAt() {
return OptionalNullable.getFrom(archivedAt);
}

/**
* Setter for ArchivedAt.
* @param archivedAt Value for String
* @param archivedAt Value for ZonedDateTime
*/
@JsonSetter("archived_at")
public void setArchivedAt(String archivedAt) {
@JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class)
public void setArchivedAt(ZonedDateTime archivedAt) {
this.archivedAt = OptionalNullable.of(archivedAt);
}

Expand All @@ -333,39 +338,43 @@ public void unsetArchivedAt() {

/**
* Getter for CreatedAt.
* @return Returns the String
* @return Returns the ZonedDateTime
*/
@JsonGetter("created_at")
@JsonInclude(JsonInclude.Include.NON_NULL)
public String getCreatedAt() {
@JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class)
public ZonedDateTime getCreatedAt() {
return createdAt;
}

/**
* Setter for CreatedAt.
* @param createdAt Value for String
* @param createdAt Value for ZonedDateTime
*/
@JsonSetter("created_at")
public void setCreatedAt(String createdAt) {
@JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class)
public void setCreatedAt(ZonedDateTime createdAt) {
this.createdAt = createdAt;
}

/**
* Getter for UpdatedAt.
* @return Returns the String
* @return Returns the ZonedDateTime
*/
@JsonGetter("updated_at")
@JsonInclude(JsonInclude.Include.NON_NULL)
public String getUpdatedAt() {
@JsonSerialize(using = DateTimeHelper.Rfc8601DateTimeSerializer.class)
public ZonedDateTime getUpdatedAt() {
return updatedAt;
}

/**
* Setter for UpdatedAt.
* @param updatedAt Value for String
* @param updatedAt Value for ZonedDateTime
*/
@JsonSetter("updated_at")
public void setUpdatedAt(String updatedAt) {
@JsonDeserialize(using = DateTimeHelper.Rfc8601DateTimeDeserializer.class)
public void setUpdatedAt(ZonedDateTime updatedAt) {
this.updatedAt = updatedAt;
}

Expand Down Expand Up @@ -623,9 +632,9 @@ public static class Builder {
private PricingScheme pricingScheme;
private Integer componentId;
private String handle;
private OptionalNullable<String> archivedAt;
private String createdAt;
private String updatedAt;
private OptionalNullable<ZonedDateTime> archivedAt;
private ZonedDateTime createdAt;
private ZonedDateTime updatedAt;
private List<ComponentPricePointPrice> prices;
private Boolean useSiteExchangeRate = true;
private Integer subscriptionId;
Expand Down Expand Up @@ -708,10 +717,10 @@ public Builder handle(String handle) {

/**
* Setter for archivedAt.
* @param archivedAt String value for archivedAt.
* @param archivedAt ZonedDateTime value for archivedAt.
* @return Builder
*/
public Builder archivedAt(String archivedAt) {
public Builder archivedAt(ZonedDateTime archivedAt) {
this.archivedAt = OptionalNullable.of(archivedAt);
return this;
}
Expand All @@ -727,20 +736,20 @@ public Builder unsetArchivedAt() {

/**
* Setter for createdAt.
* @param createdAt String value for createdAt.
* @param createdAt ZonedDateTime value for createdAt.
* @return Builder
*/
public Builder createdAt(String createdAt) {
public Builder createdAt(ZonedDateTime createdAt) {
this.createdAt = createdAt;
return this;
}

/**
* Setter for updatedAt.
* @param updatedAt String value for updatedAt.
* @param updatedAt ZonedDateTime value for updatedAt.
* @return Builder
*/
public Builder updatedAt(String updatedAt) {
public Builder updatedAt(ZonedDateTime updatedAt) {
this.updatedAt = updatedAt;
return this;
}
Expand Down
Loading