Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public final class ApiVersion
{
public static final long V20201104 = 20201104;
public static final long V20201005 = 20201005;
public static final long V20200518 = 20200518;
public static final long V20200513 = 20200513;
Expand All @@ -26,7 +27,7 @@ public final class ApiVersion
public static final long V20180101 = 20180101;
public static final long NO_VERSION = 0;

public static final Long LATEST_API_VERSION = V20201005;
public static final Long LATEST_API_VERSION = V20201104;

private ApiVersion()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@

import com.cloudesire.platform.apiclient.dto.ApiVersion;
import com.cloudesire.platform.apiclient.dto.annotations.FieldAPI;
import com.cloudesire.platform.apiclient.dto.annotations.UnsupportedAPI;
import com.cloudesire.platform.apiclient.dto.model.enums.CustomCostRuleType;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

public class CustomResellingPriceDTO extends BaseResellingPriceDTO
import static java.util.Collections.singletonList;

public class CustomResellingPriceDTO extends BaseEntityDTO
{
@Valid
private UrlEntityDTO resellerPricing;

@FieldAPI( sinceVersion = ApiVersion.V20201104 )
@Valid
private List<VariableResellingPriceDTO> prices;

@UnsupportedAPI( sinceVersion = ApiVersion.V20201104 )
@Valid
private ResellingPriceDTO price;

@NotNull
@Size( min = 1, max = 125 )
private String identifier;
Expand All @@ -27,14 +43,52 @@ public CustomResellingPriceDTO( CustomCostRuleType ruleType, String identifier,
public CustomResellingPriceDTO( String identifier, BigDecimal sellout )
{
this.identifier = identifier;
this.price = new ResellingPriceDTO( null, sellout );
this.prices = singletonList( new VariableResellingPriceDTO( sellout ) );
this.rule = new CustomCostRuleDTO( CustomCostRuleType.EXACT, 0 );
}

public CustomResellingPriceDTO()
{
}

public UrlEntityDTO getResellerPricing()
{
return resellerPricing;
}

public void setResellerPricing( UrlEntityDTO resellerPricing )
{
this.resellerPricing = resellerPricing;
}

public List<VariableResellingPriceDTO> getPrices()
{
return prices;
}

public void setPrices( List<VariableResellingPriceDTO> prices )
{
this.prices = prices;
}

/**
* @deprecated by {@link #getPrices()}
*/
@Deprecated
public ResellingPriceDTO getPrice()
{
return price;
}

/**
* @deprecated by {@link #setPrices(List)}
*/
@Deprecated
public void setPrice( ResellingPriceDTO price )
{
this.price = price;
}

public String getIdentifier()
{
return identifier;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.cloudesire.platform.apiclient.dto.model.dto;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Objects;

public class VariableResellingPriceDTO extends NamedEntityDTO
{
@NotNull
private Integer duration;

private BigDecimal sellout;

// region Auto-generated code
public VariableResellingPriceDTO( String name, Integer duration, BigDecimal sellout )
{
super( name );
this.duration = duration;
this.sellout = sellout;
}

public VariableResellingPriceDTO( BigDecimal sellout )
{
this( "Default", 0, sellout );
}

public VariableResellingPriceDTO()
{
}

public Integer getDuration()
{
return duration;
}

public void setDuration( Integer duration )
{
this.duration = duration;
}

public BigDecimal getSellout()
{
return sellout;
}

public void setSellout( BigDecimal sellout )
{
this.sellout = sellout;
}

@Override
public boolean equals( Object o )
{
if ( this == o ) return true;
if ( o == null || getClass() != o.getClass() ) return false;
if ( ! super.equals( o ) ) return false;
VariableResellingPriceDTO that = (VariableResellingPriceDTO) o;
return Objects.equals( duration, that.duration ) && Objects.equals( sellout, that.sellout );
}

@Override
public int hashCode()
{
return Objects.hash( super.hashCode(), duration, sellout );
}
// endregion
}