killbill-memoizeit
Changes
pom.xml 2(+1 -1)
Details
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/InvoiceDryRunJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/InvoiceDryRunJson.java
index 7b21259..313e4d7 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/InvoiceDryRunJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/InvoiceDryRunJson.java
@@ -48,7 +48,7 @@ public class InvoiceDryRunJson {
private final UUID subscriptionId;
private final UUID bundleId;
private final BillingActionPolicy billingPolicy;
- private final List<PhasePriceOverrideJson> priceOverrides;
+ private final List<PhasePriceJson> priceOverrides;
@JsonCreator
public InvoiceDryRunJson(@JsonProperty("dryRunType") @Nullable final DryRunType dryRunType,
@@ -62,7 +62,7 @@ public class InvoiceDryRunJson {
@JsonProperty("bundleId") @Nullable final UUID bundleId,
@JsonProperty("effectiveDate") @Nullable final LocalDate effectiveDate,
@JsonProperty("billingPolicy") @Nullable final BillingActionPolicy billingPolicy,
- @JsonProperty("priceOverrides") @Nullable final List<PhasePriceOverrideJson> priceOverrides) {
+ @JsonProperty("priceOverrides") @Nullable final List<PhasePriceJson> priceOverrides) {
this.dryRunType = dryRunType;
this.dryRunAction = dryRunAction;
this.phaseType = phaseType;
@@ -121,7 +121,7 @@ public class InvoiceDryRunJson {
return billingPolicy;
}
- public List<PhasePriceOverrideJson> getPriceOverrides() {
+ public List<PhasePriceJson> getPriceOverrides() {
return priceOverrides;
}
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/SubscriptionJson.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/SubscriptionJson.java
index ffda798..a679f69 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/SubscriptionJson.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/json/SubscriptionJson.java
@@ -76,7 +76,8 @@ public class SubscriptionJson extends JsonBase {
private final LocalDate billingEndDate;
private final Integer billCycleDayLocal;
private final List<EventSubscriptionJson> events;
- private final List<PhasePriceOverrideJson> priceOverrides;
+ private final List<PhasePriceJson> prices;
+ private final List<PhasePriceJson> priceOverrides;
@ApiModel(value="EventSubscription", parent = JsonBase.class)
public static class EventSubscriptionJson extends JsonBase {
@@ -315,7 +316,8 @@ public class SubscriptionJson extends JsonBase {
@JsonProperty("billingEndDate") @Nullable final LocalDate billingEndDate,
@JsonProperty("billCycleDayLocal") @Nullable final Integer billCycleDayLocal,
@JsonProperty("events") @Nullable final List<EventSubscriptionJson> events,
- @JsonProperty("priceOverrides") final List<PhasePriceOverrideJson> priceOverrides,
+ @JsonProperty("priceOverrides") final List<PhasePriceJson> priceOverrides,
+ @JsonProperty("prices") final List<PhasePriceJson> prices,
@JsonProperty("auditLogs") @Nullable final List<AuditLogJson> auditLogs) {
super(auditLogs);
this.startDate = startDate;
@@ -338,6 +340,7 @@ public class SubscriptionJson extends JsonBase {
this.externalKey = externalKey;
this.events = events;
this.priceOverrides = priceOverrides;
+ this.prices = prices;
}
public SubscriptionJson(final Subscription subscription, @Nullable final Currency currency, @Nullable final AccountAuditLogs accountAuditLogs) throws CatalogApiException {
@@ -392,7 +395,7 @@ public class SubscriptionJson extends JsonBase {
this.externalKey = subscription.getExternalKey();
this.events = new LinkedList<EventSubscriptionJson>();
// We fill the catalog info every time we get the currency from the account (even if this is not overridden Plan)
- this.priceOverrides = new ArrayList<PhasePriceOverrideJson>();
+ this.prices = new ArrayList<PhasePriceJson>();
String currentPhaseName = null;
String currentPlanName = null;
@@ -413,10 +416,11 @@ public class SubscriptionJson extends JsonBase {
final BigDecimal fixedPrice = curPlanPhase.getFixed() != null ? curPlanPhase.getFixed().getPrice().getPrice(currency) : null;
final BigDecimal recurringPrice = curPlanPhase.getRecurring() != null ? curPlanPhase.getRecurring().getRecurringPrice().getPrice(currency) : null;
- final PhasePriceOverrideJson phase = new PhasePriceOverrideJson(currentPlanName, curPlanPhase.getName(), curPlanPhase.getPhaseType().toString(), fixedPrice, recurringPrice, curPlanPhase.getUsages(), currency);
- priceOverrides.add(phase);
+ final PhasePriceJson phase = new PhasePriceJson(currentPlanName, curPlanPhase.getName(), curPlanPhase.getPhaseType().toString(), fixedPrice, recurringPrice, curPlanPhase.getUsages(), currency);
+ prices.add(phase);
}
}
+ this.priceOverrides = null;
}
public UUID getAccountId() {
@@ -495,10 +499,14 @@ public class SubscriptionJson extends JsonBase {
return events;
}
- public List<PhasePriceOverrideJson> getPriceOverrides() {
+ public List<PhasePriceJson> getPriceOverrides() {
return priceOverrides;
}
+ public List<PhasePriceJson> getPrices() {
+ return prices;
+ }
+
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("SubscriptionJson{");
@@ -521,6 +529,7 @@ public class SubscriptionJson extends JsonBase {
sb.append(", billingEndDate=").append(billingEndDate);
sb.append(", billCycleDayLocal=").append(billCycleDayLocal);
sb.append(", events=").append(events);
+ sb.append(", prices=").append(prices);
sb.append(", priceOverrides=").append(priceOverrides);
sb.append('}');
return sb.toString();
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java
index efd5afd..dd443c8 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/AccountResource.java
@@ -724,7 +724,7 @@ public class AccountResource extends JaxRsResourceBase {
final TenantContext tenantContext = context.createTenantContextWithAccountId(accountId, request);
- final LocalDate startDate = LOCAL_DATE_FORMATTER.parseLocalDate(startDateStr);
+ final LocalDate startDate = startDateStr != null ? LOCAL_DATE_FORMATTER.parseLocalDate(startDateStr) : null;
// Verify the account exists
accountUserApi.getAccountById(accountId, tenantContext);
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java
index 8855f0f..b5b1deb 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/InvoiceResource.java
@@ -77,7 +77,7 @@ import org.killbill.billing.jaxrs.json.InvoiceDryRunJson;
import org.killbill.billing.jaxrs.json.InvoiceItemJson;
import org.killbill.billing.jaxrs.json.InvoiceJson;
import org.killbill.billing.jaxrs.json.InvoicePaymentJson;
-import org.killbill.billing.jaxrs.json.PhasePriceOverrideJson;
+import org.killbill.billing.jaxrs.json.PhasePriceJson;
import org.killbill.billing.jaxrs.json.TagJson;
import org.killbill.billing.jaxrs.util.Context;
import org.killbill.billing.jaxrs.util.JaxrsUriBuilder;
@@ -1103,10 +1103,10 @@ public class InvoiceResource extends JaxRsResourceBase {
input.getPhaseType() != null ? input.getPhaseType() : null) :
null;
final List<PlanPhasePriceOverride> overrides = input.getPriceOverrides() != null ?
- ImmutableList.copyOf(Iterables.transform(input.getPriceOverrides(), new Function<PhasePriceOverrideJson, PlanPhasePriceOverride>() {
+ ImmutableList.copyOf(Iterables.transform(input.getPriceOverrides(), new Function<PhasePriceJson, PlanPhasePriceOverride>() {
@Nullable
@Override
- public PlanPhasePriceOverride apply(@Nullable final PhasePriceOverrideJson input) {
+ public PlanPhasePriceOverride apply(@Nullable final PhasePriceJson input) {
if (input.getPhaseName() != null) {
return new DefaultPlanPhasePriceOverride(input.getPhaseName(), account.getCurrency(), input.getFixedPrice(), input.getRecurringPrice(), null);
diff --git a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java
index 432eafd..b17197c 100644
--- a/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java
+++ b/jaxrs/src/main/java/org/killbill/billing/jaxrs/resources/SubscriptionResource.java
@@ -81,7 +81,7 @@ import org.killbill.billing.jaxrs.json.BlockingStateJson;
import org.killbill.billing.jaxrs.json.BulkSubscriptionsBundleJson;
import org.killbill.billing.jaxrs.json.BundleJson;
import org.killbill.billing.jaxrs.json.CustomFieldJson;
-import org.killbill.billing.jaxrs.json.PhasePriceOverrideJson;
+import org.killbill.billing.jaxrs.json.PhasePriceJson;
import org.killbill.billing.jaxrs.json.SubscriptionJson;
import org.killbill.billing.jaxrs.json.TagJson;
import org.killbill.billing.jaxrs.util.Context;
@@ -370,9 +370,9 @@ public class SubscriptionResource extends JaxRsResourceBase {
subscriptionJson.getBillingPeriod(),
subscriptionJson.getPriceList(),
subscriptionJson.getPhaseType());
- final List<PlanPhasePriceOverride> overrides = PhasePriceOverrideJson.toPlanPhasePriceOverrides(subscriptionJson.getPriceOverrides(),
- planPhaseSpecifier,
- currency);
+ final List<PlanPhasePriceOverride> overrides = PhasePriceJson.toPlanPhasePriceOverrides(subscriptionJson.getPriceOverrides(),
+ planPhaseSpecifier,
+ currency);
final EntitlementSpecifier specifier = new EntitlementSpecifier() {
@Override
@@ -534,7 +534,7 @@ public class SubscriptionResource extends JaxRsResourceBase {
new PlanPhaseSpecifier(entitlement.getPlanName(), phaseType) :
new PlanPhaseSpecifier(entitlement.getProductName(),
entitlement.getBillingPeriod(), entitlement.getPriceList(), phaseType);
- final List<PlanPhasePriceOverride> overrides = PhasePriceOverrideJson.toPlanPhasePriceOverrides(entitlement.getPriceOverrides(), planSpec, account.getCurrency());
+ final List<PlanPhasePriceOverride> overrides = PhasePriceJson.toPlanPhasePriceOverrides(entitlement.getPriceOverrides(), planSpec, account.getCurrency());
if (requestedDate == null && billingPolicy == null) {
newEntitlement = current.changePlan(new DefaultEntitlementSpecifier(planSpec, null, overrides), pluginProperties, ctx);
diff --git a/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestBundleJsonWithSubscriptions.java b/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestBundleJsonWithSubscriptions.java
index 2d74cb8..e0e2ac4 100644
--- a/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestBundleJsonWithSubscriptions.java
+++ b/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestBundleJsonWithSubscriptions.java
@@ -61,7 +61,7 @@ public class TestBundleJsonWithSubscriptions extends JaxrsTestSuiteNoDB {
UUID.randomUUID().toString(),
null);
- final PhasePriceOverrideJson priceOverride = new PhasePriceOverrideJson(null, null, "somePhaseType", BigDecimal.ONE, null, null);
+ final PhasePriceJson priceOverride = new PhasePriceJson(null, null, "somePhaseType", BigDecimal.ONE, null, null);
final SubscriptionJson subscription = new SubscriptionJson(UUID.randomUUID(),
UUID.randomUUID(),
@@ -83,6 +83,7 @@ public class TestBundleJsonWithSubscriptions extends JaxrsTestSuiteNoDB {
null,
ImmutableList.<EventSubscriptionJson>of(event),
ImmutableList.of(priceOverride),
+ null,
auditLogs);
final BundleJson bundleJson = new BundleJson(someUUID, bundleId, externalKey, ImmutableList.<SubscriptionJson>of(subscription), null, auditLogs);
diff --git a/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestEntitlementJsonWithEvents.java b/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestEntitlementJsonWithEvents.java
index ca9b40f..3d1fd80 100644
--- a/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestEntitlementJsonWithEvents.java
+++ b/jaxrs/src/test/java/org/killbill/billing/jaxrs/json/TestEntitlementJsonWithEvents.java
@@ -19,7 +19,6 @@
package org.killbill.billing.jaxrs.json;
import java.math.BigDecimal;
-import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -34,7 +33,6 @@ import org.killbill.billing.entitlement.api.Entitlement.EntitlementState;
import org.killbill.billing.entitlement.api.SubscriptionEventType;
import org.killbill.billing.jaxrs.JaxrsTestSuiteNoDB;
import org.killbill.billing.jaxrs.json.SubscriptionJson.EventSubscriptionJson;
-import org.killbill.billing.subscription.api.SubscriptionBaseTransitionType;
import org.killbill.clock.DefaultClock;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -68,7 +66,7 @@ public class TestEntitlementJsonWithEvents extends JaxrsTestSuiteNoDB {
UUID.randomUUID().toString(),
auditLogs);
- final PhasePriceOverrideJson priceOverride = new PhasePriceOverrideJson("foo", "bar", null, BigDecimal.TEN, BigDecimal.ONE,null);
+ final PhasePriceJson priceOverride = new PhasePriceJson("foo", "bar", null, BigDecimal.TEN, BigDecimal.ONE, null);
final SubscriptionJson entitlementJsonWithEvents = new SubscriptionJson(UUID.randomUUID(),
UUID.randomUUID(),
@@ -90,6 +88,7 @@ public class TestEntitlementJsonWithEvents extends JaxrsTestSuiteNoDB {
null,
ImmutableList.<EventSubscriptionJson>of(newEvent),
ImmutableList.of(priceOverride),
+ null,
auditLogs);
final String asJson = mapper.writeValueAsString(entitlementJsonWithEvents);
pom.xml 2(+1 -1)
diff --git a/pom.xml b/pom.xml
index 5329355..f6e165d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
<parent>
<artifactId>killbill-oss-parent</artifactId>
<groupId>org.kill-bill.billing</groupId>
- <version>0.141.83</version>
+ <version>0.141.86</version>
</parent>
<artifactId>killbill</artifactId>
<version>0.19.17-SNAPSHOT</version>
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 59152da..86520aa 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
@@ -42,7 +42,7 @@ import org.killbill.billing.client.model.gen.Account;
import org.killbill.billing.client.model.gen.BulkSubscriptionsBundle;
import org.killbill.billing.client.model.gen.Bundle;
import org.killbill.billing.client.model.gen.Invoice;
-import org.killbill.billing.client.model.gen.PhasePriceOverride;
+import org.killbill.billing.client.model.gen.PhasePrice;
import org.killbill.billing.client.model.gen.Subscription;
import org.killbill.billing.entitlement.api.Entitlement.EntitlementActionPolicy;
import org.killbill.billing.entitlement.api.Entitlement.EntitlementState;
@@ -77,16 +77,13 @@ public class TestEntitlement extends TestJaxrsBase {
// Retrieves with GET
Subscription objFromJson = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions);
- Assert.assertEquals(objFromJson.getPriceOverrides().size(), 2);
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getFixedPrice(), BigDecimal.ZERO);
- Assert.assertNull(objFromJson.getPriceOverrides().get(0).getRecurringPrice());
+ Assert.assertEquals(objFromJson.getPrices().size(), 2);
+ Assert.assertEquals(objFromJson.getPrices().get(0).getFixedPrice(), BigDecimal.ZERO);
+ Assert.assertNull(objFromJson.getPrices().get(0).getRecurringPrice());
- Assert.assertNull(objFromJson.getPriceOverrides().get(1).getFixedPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getRecurringPrice(), new BigDecimal("249.95"));
+ Assert.assertNull(objFromJson.getPrices().get(1).getFixedPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getRecurringPrice(), new BigDecimal("249.95"));
- // Equality in java client is not correctly implemented so manually check PriceOverrides section and then reset before equality
- objFromJson.setPriceOverrides(null);
- entitlementJson.setPriceOverrides(null);
Assert.assertTrue(objFromJson.equals(entitlementJson));
// Change the clock otherwise the CREATE event might be replaced (instead of having a CHANGE event)
@@ -140,13 +137,13 @@ public class TestEntitlement extends TestJaxrsBase {
// Retrieves with GET
Subscription objFromJson = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions);
- Assert.assertEquals(objFromJson.getPriceOverrides().size(), 2);
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getPhaseName(), "shotgun-monthly-trial");
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getFixedPrice(), BigDecimal.ZERO);
- Assert.assertNull(objFromJson.getPriceOverrides().get(0).getRecurringPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getPhaseName(), "shotgun-monthly-evergreen");
- Assert.assertNull(objFromJson.getPriceOverrides().get(1).getFixedPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getRecurringPrice(), new BigDecimal("249.95"));
+ Assert.assertEquals(objFromJson.getPrices().size(), 2);
+ Assert.assertEquals(objFromJson.getPrices().get(0).getPhaseName(), "shotgun-monthly-trial");
+ Assert.assertEquals(objFromJson.getPrices().get(0).getFixedPrice(), BigDecimal.ZERO);
+ Assert.assertNull(objFromJson.getPrices().get(0).getRecurringPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getPhaseName(), "shotgun-monthly-evergreen");
+ Assert.assertNull(objFromJson.getPrices().get(1).getFixedPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getRecurringPrice(), new BigDecimal("249.95"));
// Equality in java client is not correctly implemented so manually check PriceOverrides section and then reset before equality
objFromJson.setPriceOverrides(null);
@@ -169,26 +166,26 @@ public class TestEntitlement extends TestJaxrsBase {
// Retrieves to check EndDate
objFromJson = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions);
assertNotNull(objFromJson.getCancelledDate());
- Assert.assertEquals(objFromJson.getPriceOverrides().size(), 2);
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getPhaseName(), "shotgun-monthly-trial");
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getFixedPrice(), BigDecimal.ZERO);
- Assert.assertNull(objFromJson.getPriceOverrides().get(0).getRecurringPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getPhaseName(), "shotgun-monthly-evergreen");
- Assert.assertNull(objFromJson.getPriceOverrides().get(1).getFixedPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getRecurringPrice(), new BigDecimal("249.95"));
+ Assert.assertEquals(objFromJson.getPrices().size(), 2);
+ Assert.assertEquals(objFromJson.getPrices().get(0).getPhaseName(), "shotgun-monthly-trial");
+ Assert.assertEquals(objFromJson.getPrices().get(0).getFixedPrice(), BigDecimal.ZERO);
+ Assert.assertNull(objFromJson.getPrices().get(0).getRecurringPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getPhaseName(), "shotgun-monthly-evergreen");
+ Assert.assertNull(objFromJson.getPrices().get(1).getFixedPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getRecurringPrice(), new BigDecimal("249.95"));
// Uncancel
subscriptionApi.uncancelSubscriptionPlan(entitlementJson.getSubscriptionId(), NULL_PLUGIN_PROPERTIES, requestOptions);
objFromJson = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions);
assertNull(objFromJson.getCancelledDate());
- Assert.assertEquals(objFromJson.getPriceOverrides().size(), 2);
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getPhaseName(), "shotgun-monthly-trial");
- Assert.assertEquals(objFromJson.getPriceOverrides().get(0).getFixedPrice(), BigDecimal.ZERO);
- Assert.assertNull(objFromJson.getPriceOverrides().get(0).getRecurringPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getPhaseName(), "shotgun-monthly-evergreen");
- Assert.assertNull(objFromJson.getPriceOverrides().get(1).getFixedPrice());
- Assert.assertEquals(objFromJson.getPriceOverrides().get(1).getRecurringPrice(), new BigDecimal("249.95"));
+ Assert.assertEquals(objFromJson.getPrices().size(), 2);
+ Assert.assertEquals(objFromJson.getPrices().get(0).getPhaseName(), "shotgun-monthly-trial");
+ Assert.assertEquals(objFromJson.getPrices().get(0).getFixedPrice(), BigDecimal.ZERO);
+ Assert.assertNull(objFromJson.getPrices().get(0).getRecurringPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getPhaseName(), "shotgun-monthly-evergreen");
+ Assert.assertNull(objFromJson.getPrices().get(1).getFixedPrice());
+ Assert.assertEquals(objFromJson.getPrices().get(1).getRecurringPrice(), new BigDecimal("249.95"));
}
@Test(groups = "slow", description = "Can handle non existent subscription")
@@ -262,8 +259,8 @@ public class TestEntitlement extends TestJaxrsBase {
input.setProductCategory(ProductCategory.BASE);
input.setBillingPeriod(BillingPeriod.MONTHLY);
input.setPriceList(PriceListSet.DEFAULT_PRICELIST_NAME);
- final List<PhasePriceOverride> overrides = new ArrayList<PhasePriceOverride>();
- overrides.add(new PhasePriceOverride(null, null, PhaseType.TRIAL.toString(), BigDecimal.TEN, null, null));
+ final List<PhasePrice> overrides = new ArrayList<PhasePrice>();
+ overrides.add(new PhasePrice(null, null, PhaseType.TRIAL.toString(), BigDecimal.TEN, null, null));
input.setPriceOverrides(overrides);
callbackServlet.pushExpectedEvents(ExtBusEventType.ACCOUNT_CHANGE,
@@ -275,7 +272,7 @@ public class TestEntitlement extends TestJaxrsBase {
ExtBusEventType.PAYMENT_SUCCESS);
final Subscription subscription = subscriptionApi.createSubscription(input, null, null, null, null, null, true, DEFAULT_WAIT_COMPLETION_TIMEOUT_SEC, NULL_PLUGIN_PROPERTIES, requestOptions);
callbackServlet.assertListenerStatus();
- Assert.assertEquals(subscription.getPriceOverrides().size(), 2);
+ Assert.assertEquals(subscription.getPrices().size(), 2);
Assert.assertEquals(subscription.getEvents().size(), 3);
Assert.assertEquals(subscription.getEvents().get(0).getEventType(), SubscriptionEventType.START_ENTITLEMENT);
@@ -650,13 +647,13 @@ public class TestEntitlement extends TestJaxrsBase {
// Retrieves with GET
final Subscription subscription = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions);
Assert.assertTrue(subscription.equals(entitlementJson));
- Assert.assertEquals(subscription.getPriceOverrides().size(), 2);
- Assert.assertEquals(subscription.getPriceOverrides().get(0).getPhaseName(), "shotgun-monthly-trial");
- Assert.assertEquals(subscription.getPriceOverrides().get(0).getFixedPrice(), BigDecimal.ZERO);
- Assert.assertNull(subscription.getPriceOverrides().get(0).getRecurringPrice());
- Assert.assertEquals(subscription.getPriceOverrides().get(1).getPhaseName(), "shotgun-monthly-evergreen");
- Assert.assertNull(subscription.getPriceOverrides().get(1).getFixedPrice());
- Assert.assertEquals(subscription.getPriceOverrides().get(1).getRecurringPrice(), new BigDecimal("249.95"));
+ Assert.assertEquals(subscription.getPrices().size(), 2);
+ Assert.assertEquals(subscription.getPrices().get(0).getPhaseName(), "shotgun-monthly-trial");
+ Assert.assertEquals(subscription.getPrices().get(0).getFixedPrice(), BigDecimal.ZERO);
+ Assert.assertNull(subscription.getPrices().get(0).getRecurringPrice());
+ Assert.assertEquals(subscription.getPrices().get(1).getPhaseName(), "shotgun-monthly-evergreen");
+ Assert.assertNull(subscription.getPrices().get(1).getFixedPrice());
+ Assert.assertEquals(subscription.getPrices().get(1).getRecurringPrice(), new BigDecimal("249.95"));
}
@Test(groups = "slow", description = "Can create an entitlement with an account with autoPayOff")
@@ -801,13 +798,13 @@ public class TestEntitlement extends TestJaxrsBase {
// Retrieves to check EndDate
refreshedSubscription = subscriptionApi.getSubscription(entitlementJson.getSubscriptionId(), requestOptions);
- Assert.assertEquals(refreshedSubscription.getPriceOverrides().size(), 2);
- Assert.assertEquals(refreshedSubscription.getPriceOverrides().get(0).getPhaseName(), "shotgun-monthly-trial");
- Assert.assertEquals(refreshedSubscription.getPriceOverrides().get(0).getFixedPrice(), BigDecimal.ZERO);
- Assert.assertNull(refreshedSubscription.getPriceOverrides().get(0).getRecurringPrice());
- Assert.assertEquals(refreshedSubscription.getPriceOverrides().get(1).getPhaseName(), "shotgun-monthly-evergreen");
- Assert.assertNull(refreshedSubscription.getPriceOverrides().get(1).getFixedPrice());
- Assert.assertEquals(refreshedSubscription.getPriceOverrides().get(1).getRecurringPrice(), new BigDecimal("249.95"));
+ Assert.assertEquals(refreshedSubscription.getPrices().size(), 2);
+ Assert.assertEquals(refreshedSubscription.getPrices().get(0).getPhaseName(), "shotgun-monthly-trial");
+ Assert.assertEquals(refreshedSubscription.getPrices().get(0).getFixedPrice(), BigDecimal.ZERO);
+ Assert.assertNull(refreshedSubscription.getPrices().get(0).getRecurringPrice());
+ Assert.assertEquals(refreshedSubscription.getPrices().get(1).getPhaseName(), "shotgun-monthly-evergreen");
+ Assert.assertNull(refreshedSubscription.getPrices().get(1).getFixedPrice());
+ Assert.assertEquals(refreshedSubscription.getPrices().get(1).getRecurringPrice(), new BigDecimal("249.95"));
}