Details
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PhasePriceOverrideJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PhasePriceOverrideJson.java
index 6a0bbb8..379536e 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PhasePriceOverrideJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/PhasePriceOverrideJson.java
@@ -156,7 +156,7 @@ public class PhasePriceOverrideJson {
if (recurringPrice != null ? recurringPrice.compareTo(that.recurringPrice) != 0 : that.recurringPrice != null) {
return false;
}
- if (usagePriceOverrides != null ? usagePriceOverrides.equals(that.usagePriceOverrides) : that.usagePriceOverrides != null) {
+ if (usagePriceOverrides != null ? !usagePriceOverrides.equals(that.usagePriceOverrides) : that.usagePriceOverrides != null) {
return false;
}
return true;
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/TierPriceOverrideJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/TierPriceOverrideJson.java
index 59fcdcb..c60c499 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/TierPriceOverrideJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/TierPriceOverrideJson.java
@@ -26,12 +26,44 @@ public class TierPriceOverrideJson {
private final List<BlockPriceOverrideJson> blockPriceOverrides;
+ @JsonCreator
+ public TierPriceOverrideJson(@JsonProperty("blockPriceOverrides") final List<BlockPriceOverrideJson> blockPriceOverrides) {
+ this.blockPriceOverrides = blockPriceOverrides;
+ }
+
public List<BlockPriceOverrideJson> getBlockPriceOverrides() {
return blockPriceOverrides;
}
- @JsonCreator
- public TierPriceOverrideJson(@JsonProperty("blockPriceOverrides") final List<BlockPriceOverrideJson> blockPriceOverrides) {
- this.blockPriceOverrides = blockPriceOverrides;
+ @Override
+ public String toString() {
+ return "TierPriceOverrideJson{" +
+ "blockPriceOverrides='" + blockPriceOverrides + '\'' +
+ '}';
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof TierPriceOverrideJson)) {
+ return false;
+ }
+
+ final TierPriceOverrideJson that = (TierPriceOverrideJson) o;
+
+ if (blockPriceOverrides != null ? !blockPriceOverrides.equals(that.blockPriceOverrides) : that.blockPriceOverrides != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = blockPriceOverrides != null ? blockPriceOverrides.hashCode() : 0;
+ result = 31 * result + (blockPriceOverrides != null ? blockPriceOverrides.hashCode() : 0);
+ return result;
}
}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/UsagePriceOverrideJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/UsagePriceOverrideJson.java
index 4d9e773..c101f63 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/UsagePriceOverrideJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/UsagePriceOverrideJson.java
@@ -37,6 +37,17 @@ public class UsagePriceOverrideJson {
private final List<TierPriceOverrideJson> tierPriceOverrides;
+ @JsonCreator
+ public UsagePriceOverrideJson(@JsonProperty("usageName") final String usageName,
+ @Nullable @JsonProperty("usageType") final UsageType usageType,
+ @Nullable @JsonProperty("billingMode") final BillingMode billingMode,
+ @Nullable @JsonProperty("tierPriceOverrides") final List<TierPriceOverrideJson> tierPriceOverrides ) {
+ this.usageName = usageName;
+ this.usageType = usageType;
+ this.billingMode = billingMode;
+ this.tierPriceOverrides = tierPriceOverrides;
+ }
+
public String getUsageName() {
return usageName;
}
@@ -53,14 +64,49 @@ public class UsagePriceOverrideJson {
return tierPriceOverrides;
}
- @JsonCreator
- public UsagePriceOverrideJson(@JsonProperty("usageName") final String usageName,
- @Nullable @JsonProperty("usageType") final UsageType usageType,
- @Nullable @JsonProperty("billingMode") final BillingMode billingMode,
- @Nullable @JsonProperty("tierPriceOverrides") final List<TierPriceOverrideJson> tierPriceOverrides ) {
- this.usageName = usageName;
- this.usageType = usageType;
- this.billingMode = billingMode;
- this.tierPriceOverrides = tierPriceOverrides;
+ @Override
+ public String toString() {
+ return "UsagePriceOverrideJson{" +
+ "usageName='" + usageName + '\'' +
+ "usageType='" + usageType + '\'' +
+ ", billingMode=" + billingMode +
+ ", tierPriceOverrides=" + tierPriceOverrides +
+ '}';
}
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (!(o instanceof UsagePriceOverrideJson)) {
+ return false;
+ }
+
+ final UsagePriceOverrideJson that = (UsagePriceOverrideJson) o;
+
+ if (usageName != null ? !usageName.equals(that.usageName) : that.usageName != null) {
+ return false;
+ }
+ if (usageType != null ? !usageType.equals(that.usageType) : that.usageType != null) {
+ return false;
+ }
+ if (billingMode != null ? !billingMode.equals(that.billingMode) : that.billingMode != null) {
+ return false;
+ }
+ if (tierPriceOverrides != null ? !tierPriceOverrides.equals(that.tierPriceOverrides) : that.tierPriceOverrides != null) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = usageName != null ? usageName.hashCode() : 0;
+ result = 31 * result + (usageType != null ? usageType.hashCode() : 0);
+ result = 31 * result + (billingMode != null ? billingMode.hashCode() : 0);
+ result = 31 * result + (tierPriceOverrides != null ? tierPriceOverrides.hashCode() : 0);
+ return result;
+ }
+
}
diff --git a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java
index a298dc3..e24a91f 100644
--- a/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java
+++ b/profiles/killbill/src/test/java/org/killbill/billing/jaxrs/TestEntitlement.java
@@ -223,7 +223,7 @@ public class TestEntitlement extends TestJaxrsBase {
input.setBillingPeriod(BillingPeriod.MONTHLY);
input.setPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
final List<PhasePriceOverride> overrides = new ArrayList<PhasePriceOverride>();
- overrides.add(new PhasePriceOverride(null, PhaseType.TRIAL.toString(), BigDecimal.TEN, null));
+ overrides.add(new PhasePriceOverride(null, PhaseType.TRIAL.toString(), BigDecimal.TEN, null, null));
input.setPriceOverrides(overrides);
final Subscription subscription = killBillClient.createSubscription(input, null, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, basicRequestOptions());