Skip to content

Commit

Permalink
Expose decimals in subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
malteo committed Oct 20, 2020
1 parent e46badb commit 7a9a008
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@

import io.swagger.annotations.ApiModelProperty;

import java.math.BigDecimal;
import java.util.Objects;

import static com.liberologico.cloudesire.common.MathConfiguration.COMPUTATION_PRECISION;
import static com.liberologico.cloudesire.common.MathConfiguration.ROUNDING_MODE;

public class SubscriptionBillingItemDTO extends DTO
{
private UrlEntityDTO billingItem;

@ApiModelProperty( "The chosen value for this billing item" )
private Integer value;
@ApiModelProperty( "The current value for this billing item" )
private BigDecimal value;

@ApiModelProperty( "Whether the billing item has been already bought for the Subscription" )
private Boolean bought;
Expand All @@ -25,7 +29,7 @@ public class SubscriptionBillingItemDTO extends DTO
public SubscriptionBillingItemDTO( UrlEntityDTO billingItem, Integer value, boolean bought )
{
this.billingItem = billingItem;
this.value = value;
this.value = new BigDecimal( value ).setScale( COMPUTATION_PRECISION, ROUNDING_MODE );
this.bought = bought;
}

Expand All @@ -48,12 +52,12 @@ public void setBillingItem( UrlEntityDTO billingItem )
this.billingItem = billingItem;
}

public Integer getValue()
public BigDecimal getValue()
{
return value;
}

public void setValue( Integer value )
public void setValue( BigDecimal value )
{
this.value = value;
}
Expand Down

0 comments on commit 7a9a008

Please sign in to comment.