Details
diff --git a/entitlement/src/main/java/com/ning/billing/entitlement/api/timeline/DefaultEntitlementTimelineApi.java b/entitlement/src/main/java/com/ning/billing/entitlement/api/timeline/DefaultEntitlementTimelineApi.java
index ab01dff..1af87e8 100644
--- a/entitlement/src/main/java/com/ning/billing/entitlement/api/timeline/DefaultEntitlementTimelineApi.java
+++ b/entitlement/src/main/java/com/ning/billing/entitlement/api/timeline/DefaultEntitlementTimelineApi.java
@@ -404,7 +404,7 @@ public class DefaultEntitlementTimelineApi implements EntitlementTimelineApi {
}
@Override
public String getExternalKey() {
- return null;
+ return externalKey;
}
};
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java
index 2b7e409..82645a5 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJson.java
@@ -191,14 +191,14 @@ public class AccountJson extends AccountJsonSimple {
}
@JsonCreator
- public AccountJson(@JsonProperty("account_id") String acountId,
+ public AccountJson(@JsonProperty("accountId") String accountId,
@JsonProperty("name") String name,
- @JsonProperty("first_name_length") Integer length,
+ @JsonProperty("firstNameLength") Integer length,
@JsonProperty("external_key") String externalKey,
@JsonProperty("email") String email,
- @JsonProperty("billing_day") Integer billCycleDay,
+ @JsonProperty("billingDay") Integer billCycleDay,
@JsonProperty("currency") String currency,
- @JsonProperty("payment_provider") String paymentProvider,
+ @JsonProperty("paymentProvider") String paymentProvider,
@JsonProperty("timezone") String timeZone,
@JsonProperty("address1") String address1,
@JsonProperty("address2") String address2,
@@ -206,7 +206,7 @@ public class AccountJson extends AccountJsonSimple {
@JsonProperty("state") String state,
@JsonProperty("country") String country,
@JsonProperty("phone") String phone) {
- super(acountId, externalKey);
+ super(accountId, externalKey);
this.name = name;
this.length = length;
this.email = email;
@@ -279,7 +279,7 @@ public class AccountJson extends AccountJsonSimple {
final int prime = 31;
int result = 1;
result = prime * result
- + ((acountId == null) ? 0 : acountId.hashCode());
+ + ((accountId == null) ? 0 : accountId.hashCode());
result = prime * result
+ ((address1 == null) ? 0 : address1.hashCode());
result = prime * result
@@ -392,10 +392,10 @@ public class AccountJson extends AccountJsonSimple {
return false;
} else {
AccountJson other = (AccountJson) obj;
- if (acountId == null) {
- if (other.acountId != null)
+ if (accountId == null) {
+ if (other.accountId != null)
return false;
- } else if (!acountId.equals(other.acountId))
+ } else if (!accountId.equals(other.accountId))
return false;
}
return true;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java
index 548635e..d7e1b2d 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountJsonSimple.java
@@ -22,25 +22,25 @@ import org.codehaus.jackson.map.annotate.JsonView;
public class AccountJsonSimple {
@JsonView(BundleTimelineViews.Base.class)
- protected final String acountId;
+ protected final String accountId;
@JsonView(BundleTimelineViews.Base.class)
protected final String externalKey;
public AccountJsonSimple() {
- this.acountId = null;
+ this.accountId = null;
this.externalKey = null;
}
@JsonCreator
- public AccountJsonSimple(@JsonProperty("account_id") String acountId,
- @JsonProperty("external_key") String externalKey) {
- this.acountId = acountId;
+ public AccountJsonSimple(@JsonProperty("accountId") String accountId,
+ @JsonProperty("externalKey") String externalKey) {
+ this.accountId = accountId;
this.externalKey = externalKey;
}
- public String getAcountId() {
- return acountId;
+ public String getAccountId() {
+ return accountId;
}
public String getExternalKey() {
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java
index 4521257..9f308f9 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/AccountTimelineJson.java
@@ -16,8 +16,10 @@
package com.ning.billing.jaxrs.json;
import java.math.BigDecimal;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.codehaus.jackson.annotate.JsonCreator;
@@ -29,16 +31,17 @@ import com.ning.billing.account.api.Account;
import com.ning.billing.catalog.api.Currency;
import com.ning.billing.entitlement.api.timeline.BundleTimeline;
import com.ning.billing.invoice.api.Invoice;
+import com.ning.billing.invoice.api.InvoiceItem;
import com.ning.billing.payment.api.PaymentAttempt;
import com.ning.billing.payment.api.PaymentInfoEvent;
public class AccountTimelineJson {
@JsonView(BundleTimelineViews.ReadTimeline.class)
- private final List<PaymentJson> payments;
+ private final List<PaymentJsonWithBundleKeys> payments;
@JsonView(BundleTimelineViews.ReadTimeline.class)
- private final List<InvoiceJson> invoices;
+ private final List<InvoiceJsonWithBundleKeys> invoices;
@JsonView(BundleTimelineViews.ReadTimeline.class)
private final AccountJsonSimple account;
@@ -49,31 +52,67 @@ public class AccountTimelineJson {
@JsonCreator
public AccountTimelineJson(@JsonProperty("account") AccountJsonSimple account,
@JsonProperty("bundles") List<BundleJsonWithSubscriptions> bundles,
- @JsonProperty("invoices") List<InvoiceJson> invoices,
- @JsonProperty("payments") List<PaymentJson> payments) {
+ @JsonProperty("invoices") List<InvoiceJsonWithBundleKeys> invoices,
+ @JsonProperty("payments") List<PaymentJsonWithBundleKeys> payments) {
this.account = account;
this.bundles = bundles;
this.invoices = invoices;
this.payments = payments;
}
+ private String getBundleExternalKey(UUID invoiceId, List<Invoice> invoices, List<BundleTimeline> bundles) {
+ for (Invoice cur : invoices) {
+ if (cur.getId().equals(invoiceId)) {
+ return getBundleExternalKey(cur, bundles);
+ }
+ }
+ return null;
+ }
+
+ private String getBundleExternalKey(Invoice invoice, List<BundleTimeline> bundles) {
+ Set<UUID> b = new HashSet<UUID>();
+ for (final InvoiceItem cur : invoice.getInvoiceItems()) {
+ b.add(cur.getBundleId());
+ }
+ boolean first = true;
+ StringBuilder tmp = new StringBuilder();
+ for (final UUID cur : b) {
+ for (final BundleTimeline bt : bundles) {
+ if (bt.getBundleId().equals(cur)) {
+ if (!first) {
+ tmp.append(",");
+ }
+ tmp.append(bt.getExternalKey());
+ first = false;
+ break;
+ }
+ }
+ }
+ return tmp.toString();
+ }
+
public AccountTimelineJson(Account account, List<Invoice> invoices, List<PaymentAttempt> payments, List<BundleTimeline> bundles) {
this.account = new AccountJsonSimple(account.getId().toString(), account.getExternalKey());
this.bundles = new LinkedList<BundleJsonWithSubscriptions>();
for (BundleTimeline cur : bundles) {
this.bundles.add(new BundleJsonWithSubscriptions(account.getId(), cur));
}
- this.invoices = new LinkedList<InvoiceJson>();
+ this.invoices = new LinkedList<InvoiceJsonWithBundleKeys>();
for (Invoice cur : invoices) {
- this.invoices.add(new InvoiceJson(cur.getTotalAmount(), cur.getId().toString(), cur.getInvoiceDate(), Integer.toString(cur.getInvoiceNumber()), cur.getBalance()));
+ this.invoices.add(new InvoiceJsonWithBundleKeys(cur.getTotalAmount(), cur.getId().toString(), cur.getInvoiceDate(), cur.getTargetDate(),
+ Integer.toString(cur.getInvoiceNumber()), cur.getBalance(),
+ getBundleExternalKey(cur, bundles)));
}
- this.payments = new LinkedList<PaymentJson>();
+ this.payments = new LinkedList<PaymentJsonWithBundleKeys>();
for (PaymentAttempt cur : payments) {
+
+
String status = cur.getPaymentId() != null ? "Success" : "Failed";
BigDecimal paidAmount = cur.getPaymentId() != null ? cur.getAmount() : BigDecimal.ZERO;
- this.payments.add(new PaymentJson(cur.getAmount(), paidAmount, cur.getInvoiceId().toString(), cur.getPaymentId(), cur.getCreatedDate(), cur.getUpdatedDate(),
- cur.getRetryCount(), cur.getCurrency().toString(), status));
+ this.payments.add(new PaymentJsonWithBundleKeys(cur.getAmount(), paidAmount, cur.getInvoiceId().toString(), cur.getPaymentId(), cur.getCreatedDate(), cur.getUpdatedDate(),
+ cur.getRetryCount(), cur.getCurrency().toString(), status,
+ getBundleExternalKey(cur.getInvoiceId(), invoices, bundles)));
}
}
@@ -84,11 +123,11 @@ public class AccountTimelineJson {
this.payments = null;
}
- public List<PaymentJson> getPayments() {
+ public List<PaymentJsonWithBundleKeys> getPayments() {
return payments;
}
- public List<InvoiceJson> getInvoices() {
+ public List<InvoiceJsonWithBundleKeys> getInvoices() {
return invoices;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubsciptions.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubsciptions.java
index 9f8f7b6..74a6407 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubsciptions.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonNoSubsciptions.java
@@ -35,9 +35,9 @@ public class BundleJsonNoSubsciptions extends BundleJsonSimple {
@JsonCreator
- public BundleJsonNoSubsciptions(@JsonProperty("bundle_id") String bundleId,
- @JsonProperty("account_id") String accountId,
- @JsonProperty("external_key") String externalKey,
+ public BundleJsonNoSubsciptions(@JsonProperty("bundleId") String bundleId,
+ @JsonProperty("accountId") String accountId,
+ @JsonProperty("externalKey") String externalKey,
@JsonProperty("subscriptions") List<SubscriptionJsonWithEvents> subscriptions) {
super(bundleId, externalKey);
this.accountId = accountId;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java
index 3053f0d..8c2d836 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonSimple.java
@@ -16,6 +16,7 @@
package com.ning.billing.jaxrs.json;
import org.codehaus.jackson.annotate.JsonCreator;
+import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonView;
public class BundleJsonSimple {
@@ -27,7 +28,8 @@ public class BundleJsonSimple {
protected final String externalKey;
@JsonCreator
- public BundleJsonSimple(String bundleId, String externalKey) {
+ public BundleJsonSimple(@JsonProperty("bundleId") String bundleId,
+ @JsonProperty("externalKey") String externalKey) {
super();
this.bundleId = bundleId;
this.externalKey = externalKey;
@@ -38,10 +40,12 @@ public class BundleJsonSimple {
this.externalKey = null;
}
+ @JsonProperty("bundleId")
public String getBundleId() {
return bundleId;
}
+ @JsonProperty("externalKey")
public String getExternalKey() {
return externalKey;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java
index dd2c788..8caa8da 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleJsonWithSubscriptions.java
@@ -33,13 +33,14 @@ public class BundleJsonWithSubscriptions extends BundleJsonSimple {
private final List<SubscriptionJsonWithEvents> subscriptions;
@JsonCreator
- public BundleJsonWithSubscriptions(@JsonProperty("bundle_id") String bundleId,
- @JsonProperty("external_key") String externalKey,
+ public BundleJsonWithSubscriptions(@JsonProperty("bundleId") String bundleId,
+ @JsonProperty("externalKey") String externalKey,
@JsonProperty("subscriptions") List<SubscriptionJsonWithEvents> subscriptions) {
super(bundleId, externalKey);
this.subscriptions = subscriptions;
}
+ @JsonProperty("subscriptions")
public List<SubscriptionJsonWithEvents> getSubscriptions() {
return subscriptions;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java
index 64a416c..099d837 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/BundleTimelineJson.java
@@ -31,20 +31,20 @@ public class BundleTimelineJson {
private final BundleJsonWithSubscriptions bundle;
@JsonView(BundleTimelineViews.ReadTimeline.class)
- private final List<PaymentJson> payments;
+ private final List<PaymentJsonSimple> payments;
@JsonView(BundleTimelineViews.ReadTimeline.class)
- private final List<InvoiceJson> invoices;
+ private final List<InvoiceJsonSimple> invoices;
@JsonView(BundleTimelineViews.WriteTimeline.class)
private final String resonForChange;
@JsonCreator
- public BundleTimelineJson(@JsonProperty("view_id") String viewId,
+ public BundleTimelineJson(@JsonProperty("viewId") String viewId,
@JsonProperty("bundle") BundleJsonWithSubscriptions bundle,
- @JsonProperty("payments") List<PaymentJson> payments,
- @JsonProperty("invoices") List<InvoiceJson> invoices,
- @JsonProperty("reason_for_change") String reason) {
+ @JsonProperty("payments") List<PaymentJsonSimple> payments,
+ @JsonProperty("invoices") List<InvoiceJsonSimple> invoices,
+ @JsonProperty("reasonForChange") String reason) {
this.viewId = viewId;
this.bundle = bundle;
this.payments = payments;
@@ -60,11 +60,11 @@ public class BundleTimelineJson {
return bundle;
}
- public List<PaymentJson> getPayments() {
+ public List<PaymentJsonSimple> getPayments() {
return payments;
}
- public List<InvoiceJson> getInvoices() {
+ public List<InvoiceJsonSimple> getInvoices() {
return invoices;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java
new file mode 100644
index 0000000..cc15072
--- /dev/null
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/InvoiceJsonWithBundleKeys.java
@@ -0,0 +1,57 @@
+package com.ning.billing.jaxrs.json;
+import java.math.BigDecimal;
+
+import org.codehaus.jackson.annotate.JsonCreator;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.joda.time.DateTime;
+
+import com.ning.billing.invoice.api.Invoice;
+
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class InvoiceJsonWithBundleKeys extends InvoiceJsonSimple {
+
+
+ private final String bundleKeys;
+
+
+ public InvoiceJsonWithBundleKeys() {
+ super();
+ this.bundleKeys = null;
+ }
+
+ @JsonCreator
+ public InvoiceJsonWithBundleKeys(@JsonProperty("amount") BigDecimal amount,
+ @JsonProperty("invoiceId") String invoiceId,
+ @JsonProperty("invoiceDate") DateTime invoiceDate,
+ @JsonProperty("targetDate") DateTime targetDate,
+ @JsonProperty("invoiceNumber") String invoiceNumber,
+ @JsonProperty("balance") BigDecimal balance,
+ @JsonProperty("externalBundleKeys") String bundleKeys) {
+ super(amount, invoiceId, invoiceDate, targetDate, invoiceNumber, balance);
+ this.bundleKeys = bundleKeys;
+ }
+
+ public InvoiceJsonWithBundleKeys(Invoice input, String bundleKeys) {
+ super(input);
+ this.bundleKeys = bundleKeys;
+ }
+
+ public String getBundleKeys() {
+ return bundleKeys;
+ }
+}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
new file mode 100644
index 0000000..43e2c87
--- /dev/null
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
@@ -0,0 +1,53 @@
+package com.ning.billing.jaxrs.json;
+import java.math.BigDecimal;
+
+import org.codehaus.jackson.annotate.JsonCreator;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.joda.time.DateTime;
+
+import com.ning.billing.util.clock.DefaultClock;
+
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
+
+ private final String bundleKeys;
+
+ public PaymentJsonWithBundleKeys() {
+ super();
+ this.bundleKeys = null;
+ }
+
+ @JsonCreator
+ public PaymentJsonWithBundleKeys(@JsonProperty("amount") BigDecimal amount,
+ @JsonProperty("paidAmount") BigDecimal paidAmount,
+ @JsonProperty("invoiceId") String invoiceId,
+ @JsonProperty("paymentId") String paymentId,
+ @JsonProperty("requestedDt") DateTime requestedDate,
+ @JsonProperty("effectiveDt") DateTime effectiveDate,
+ @JsonProperty("retryCount") Integer retryCount,
+ @JsonProperty("currency") String currency,
+ @JsonProperty("status") String status,
+ @JsonProperty("externalBundleKeys") String bundleKeys) {
+ super(amount, paidAmount, invoiceId, paymentId, requestedDate, effectiveDate, retryCount, currency, status);
+ this.bundleKeys = bundleKeys;
+ }
+
+ public String getBundleKeys() {
+ return bundleKeys;
+ }
+}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java
index 2ec1c44..95a5e09 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonNoEvents.java
@@ -57,14 +57,14 @@ public class SubscriptionJsonNoEvents extends SubscriptionJsonSimple {
@JsonCreator
- public SubscriptionJsonNoEvents(@JsonProperty("subscription_id") String subscriptionId,
- @JsonProperty("bundle_id") String bundleId,
- @JsonProperty("start_date") DateTime startDate,
- @JsonProperty("product_name") String productName,
- @JsonProperty("product_category") String productCategory,
- @JsonProperty("billing_period") String billingPeriod,
- @JsonProperty("price_list") String priceList,
- @JsonProperty("charged_through_date") DateTime chargedThroughDate) {
+ public SubscriptionJsonNoEvents(@JsonProperty("subscriptionId") String subscriptionId,
+ @JsonProperty("bundleId") String bundleId,
+ @JsonProperty("startDate") DateTime startDate,
+ @JsonProperty("productName") String productName,
+ @JsonProperty("productCategory") String productCategory,
+ @JsonProperty("billingPeriod") String billingPeriod,
+ @JsonProperty("priceList") String priceList,
+ @JsonProperty("chargedThroughDate") DateTime chargedThroughDate) {
super(subscriptionId);
this.bundleId = bundleId;
this.startDate = startDate;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java
index ebb86e4..5fb782e 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonSimple.java
@@ -29,7 +29,7 @@ public class SubscriptionJsonSimple {
}
@JsonCreator
- public SubscriptionJsonSimple(@JsonProperty("subscription_id") String subscriptionId) {
+ public SubscriptionJsonSimple(@JsonProperty("subscriptionId") String subscriptionId) {
this.subscriptionId = subscriptionId;
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java
index 2f798df..d9329dc 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/SubscriptionJsonWithEvents.java
@@ -58,13 +58,13 @@ public class SubscriptionJsonWithEvents extends SubscriptionJsonSimple {
}
@JsonCreator
- public SubscriptionReadEventJson(@JsonProperty("event_id") String eventId,
- @JsonProperty("billing_period") String billingPeriod,
- @JsonProperty("requested_dt") DateTime requestedDate,
- @JsonProperty("effective_dt") DateTime effectiveDate,
+ public SubscriptionReadEventJson(@JsonProperty("eventId") String eventId,
+ @JsonProperty("billingPeriod") String billingPeriod,
+ @JsonProperty("requestedDt") DateTime requestedDate,
+ @JsonProperty("effectiveDt") DateTime effectiveDate,
@JsonProperty("product") String product,
- @JsonProperty("price_list") String priceList,
- @JsonProperty("event_type") String eventType,
+ @JsonProperty("priceList") String priceList,
+ @JsonProperty("eventType") String eventType,
@JsonProperty("phase") String phase) {
super(billingPeriod, requestedDate, product, priceList, eventType, phase);
this.eventId = eventId;
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
index 07502cc..c97f6a7 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/AccountResource.java
@@ -244,6 +244,7 @@ public class AccountResource implements BaseJaxrsResource {
Account account = accountApi.getAccountById(UUID.fromString(accountId));
List<Invoice> invoices = invoiceApi.getInvoicesByAccount(account.getId());
+
List<PaymentAttempt> payments = new LinkedList<PaymentAttempt>();
if (invoices.size() > 0) {
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java
index 5cc35bd..ffdd1e8 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/InvoiceResource.java
@@ -51,8 +51,8 @@ import com.ning.billing.entitlement.api.user.EntitlementUserApi;
import com.ning.billing.invoice.api.Invoice;
import com.ning.billing.invoice.api.InvoiceApiException;
import com.ning.billing.invoice.api.InvoiceUserApi;
-import com.ning.billing.jaxrs.json.AccountJson;
-import com.ning.billing.jaxrs.json.InvoiceJson;
+
+import com.ning.billing.jaxrs.json.InvoiceJsonSimple;
import com.ning.billing.jaxrs.util.Context;
import com.ning.billing.jaxrs.util.JaxrsUriBuilder;
import com.ning.billing.jaxrs.util.TagHelper;
@@ -65,7 +65,7 @@ import com.ning.billing.util.api.TagUserApi;
public class InvoiceResource implements BaseJaxrsResource {
- private static final Logger log = LoggerFactory.getLogger(AccountResource.class);
+ private static final Logger log = LoggerFactory.getLogger(InvoiceResource.class);
private final DateTimeFormatter DATE_TIME_FORMATTER = ISODateTimeFormat.dateTime();
@@ -93,9 +93,9 @@ public class InvoiceResource implements BaseJaxrsResource {
Preconditions.checkNotNull(accountId, "% query parameter must be specified", QUERY_ACCOUNT_ID);
accountApi.getAccountById(UUID.fromString(accountId));
List<Invoice> invoices = invoiceApi.getInvoicesByAccount(UUID.fromString(accountId));
- List<InvoiceJson> result = new LinkedList<InvoiceJson>();
+ List<InvoiceJsonSimple> result = new LinkedList<InvoiceJsonSimple>();
for (Invoice cur : invoices) {
- result.add(new InvoiceJson(cur));
+ result.add(new InvoiceJsonSimple(cur));
}
return Response.status(Status.OK).entity(result).build();
} catch (AccountApiException e) {
@@ -110,14 +110,14 @@ public class InvoiceResource implements BaseJaxrsResource {
@Produces(APPLICATION_JSON)
public Response getInvoice(@PathParam("invoiceId") String invoiceId) {
Invoice invoice = invoiceApi.getInvoice(UUID.fromString(invoiceId));
- InvoiceJson json = new InvoiceJson(invoice);
+ InvoiceJsonSimple json = new InvoiceJsonSimple(invoice);
return Response.status(Status.OK).entity(json).build();
}
@POST
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
- public Response createFutureInvoice(final InvoiceJson invoice,
+ public Response createFutureInvoice(final InvoiceJsonSimple invoice,
@QueryParam(QUERY_ACCOUNT_ID) final String accountId,
@QueryParam(QUERY_TARGET_DATE) final String targetDate,
@QueryParam(QUERY_DRY_RUN) @DefaultValue("false") final Boolean dryRun,
@@ -136,7 +136,7 @@ public class InvoiceResource implements BaseJaxrsResource {
Invoice generatedInvoice = invoiceApi.triggerInvoiceGeneration(UUID.fromString(accountId), inputDate, dryRun.booleanValue(),
context.createContext(createdBy, reason, comment));
if (dryRun) {
- return Response.status(Status.OK).entity(new InvoiceJson(generatedInvoice)).build();
+ return Response.status(Status.OK).entity(new InvoiceJsonSimple(generatedInvoice)).build();
} else {
return uriBuilder.buildResponse(InvoiceResource.class, "getInvoice", generatedInvoice.getId());
}
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java
index c2f5391..2988f5a 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/resources/PaymentResource.java
@@ -28,7 +28,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import com.ning.billing.jaxrs.json.PaymentJson;
+import com.ning.billing.jaxrs.json.PaymentJsonSimple;
@Path("/1.0/payment")
@@ -53,7 +53,7 @@ public class PaymentResource {
@Produces(APPLICATION_JSON)
@Consumes(APPLICATION_JSON)
@Path("/{invoiceId:\\w+-\\w+-\\w+-\\w+-\\w+}")
- public Response createInstantPayment(PaymentJson payment,
+ public Response createInstantPayment(PaymentJsonSimple payment,
@PathParam("invoiceId") String invoiceId,
@QueryParam("last4CC") String last4CC,
@QueryParam("nameOnCC") String nameOnCC) {
diff --git a/server/src/main/java/com/ning/billing/server/listeners/KillbillGuiceListener.java b/server/src/main/java/com/ning/billing/server/listeners/KillbillGuiceListener.java
index 227e94a..1aaef9b 100644
--- a/server/src/main/java/com/ning/billing/server/listeners/KillbillGuiceListener.java
+++ b/server/src/main/java/com/ning/billing/server/listeners/KillbillGuiceListener.java
@@ -72,9 +72,11 @@ public class KillbillGuiceListener extends SetupServer
killbillBusService = theInjector.getInstance(BusService.class);
killbilleventHandler = theInjector.getInstance(KillbillEventHandler.class);
+ /*
ObjectMapper mapper = theInjector.getInstance(ObjectMapper.class);
mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy());
-
+*/
+
//
// Fire all Startup levels up to service start
//
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java b/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java
index 7c19d35..92b6266 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestAccount.java
@@ -72,10 +72,10 @@ public class TestAccount extends TestJaxrsBase {
Assert.assertTrue(objFromJson.equals(input));
// Update Account
- AccountJson newInput = new AccountJson(objFromJson.getAcountId(),
+ AccountJson newInput = new AccountJson(objFromJson.getAccountId(),
"zozo", 4, objFromJson.getExternalKey(), "rr@google.com", 18, "EUR", "none", "UTC", "bl1", "bh2", "", "ca", "usa", "415-255-2991");
baseJson = mapper.writeValueAsString(newInput);
- final String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + objFromJson.getAcountId();
+ final String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + objFromJson.getAccountId();
response = doPut(uri, baseJson, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
baseJson = response.getResponseBody();
@@ -88,7 +88,7 @@ public class TestAccount extends TestJaxrsBase {
public void testUpdateNonExistentAccount() throws Exception {
AccountJson input = getAccountJson("xoxo", "shghaahwe", "xoxo@yahoo.com");
String baseJson = mapper.writeValueAsString(input);
- final String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + input.getAcountId();
+ final String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + input.getAccountId();
Response response = doPut(uri, baseJson, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.NO_CONTENT.getStatusCode());
String body = response.getResponseBody();
@@ -120,7 +120,7 @@ public class TestAccount extends TestJaxrsBase {
AccountJson accountJson = createAccount("poney", "shdddqgfhwe", "poney@yahoo.com");
assertNotNull(accountJson);
- BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAcountId(), "996599");
+ BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAccountId(), "996599");
assertNotNull(bundleJson);
SubscriptionJsonNoEvents subscriptionJson = createSubscription(bundleJson.getBundleId(), "Shotgun", ProductCategory.BASE.toString(), BillingPeriod.MONTHLY.toString(), true);
@@ -133,7 +133,7 @@ public class TestAccount extends TestJaxrsBase {
crappyWaitForLackOfProperSynchonization();
- final String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAcountId() + "/" + BaseJaxrsResource.TIMELINE;
+ final String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAccountId() + "/" + BaseJaxrsResource.TIMELINE;
Response response = doGet(uri, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
@@ -162,7 +162,7 @@ public class TestAccount extends TestJaxrsBase {
Map<String, String> queryParams = new HashMap<String, String>();
queryParams.put(BaseJaxrsResource.QUERY_TAGS, input.getName());
- String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + BaseJaxrsResource.TAGS + "/" + accountJson.getAcountId() ;
+ String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + BaseJaxrsResource.TAGS + "/" + accountJson.getAccountId() ;
response = doPost(uri, null, queryParams, DEFAULT_HTTP_TIMEOUT_SEC);
assertEquals(response.getStatusCode(), Status.CREATED.getStatusCode());
@@ -192,7 +192,7 @@ public class TestAccount extends TestJaxrsBase {
customFields.add(new CustomFieldJson("3", "value3"));
String baseJson = mapper.writeValueAsString(customFields);
- String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + BaseJaxrsResource.CUSTOM_FIELDS + "/" + accountJson.getAcountId() ;
+ String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + BaseJaxrsResource.CUSTOM_FIELDS + "/" + accountJson.getAccountId() ;
Response response = doPost(uri,baseJson, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
assertEquals(response.getStatusCode(), Status.CREATED.getStatusCode());
String location = response.getHeader("Location");
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestBundle.java b/server/src/test/java/com/ning/billing/jaxrs/TestBundle.java
index f0182bd..7795d0c 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestBundle.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestBundle.java
@@ -44,7 +44,7 @@ public class TestBundle extends TestJaxrsBase {
public void testBundleOk() throws Exception {
AccountJson accountJson = createAccount("xlxl", "shdgfhkkl", "xlxl@yahoo.com");
- BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAcountId(), "12345");
+ BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAccountId(), "12345");
// Retrieves by external key
Map<String, String> queryParams = new HashMap<String, String>();
@@ -61,10 +61,10 @@ public class TestBundle extends TestJaxrsBase {
public void testBundleFromAccount() throws Exception {
AccountJson accountJson = createAccount("xaxa", "saagfhkkl", "xaxa@yahoo.com");
- BundleJsonNoSubsciptions bundleJson1 = createBundle(accountJson.getAcountId(), "156567");
- BundleJsonNoSubsciptions bundleJson2 = createBundle(accountJson.getAcountId(), "265658");
+ BundleJsonNoSubsciptions bundleJson1 = createBundle(accountJson.getAccountId(), "156567");
+ BundleJsonNoSubsciptions bundleJson2 = createBundle(accountJson.getAccountId(), "265658");
- String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAcountId().toString() + "/" + BaseJaxrsResource.BUNDLES;
+ String uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAccountId().toString() + "/" + BaseJaxrsResource.BUNDLES;
Response response = doGet(uri, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
String baseJson = response.getResponseBody();
@@ -96,7 +96,7 @@ public class TestBundle extends TestJaxrsBase {
Assert.assertEquals(response.getStatusCode(), Status.NO_CONTENT.getStatusCode());
- uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAcountId().toString() + "/" + BaseJaxrsResource.BUNDLES;
+ uri = BaseJaxrsResource.ACCOUNTS_PATH + "/" + accountJson.getAccountId().toString() + "/" + BaseJaxrsResource.BUNDLES;
response = doGet(uri, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
String baseJson = response.getResponseBody();
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestInvoice.java b/server/src/test/java/com/ning/billing/jaxrs/TestInvoice.java
index 9a039fd..aba67b8 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestInvoice.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestInvoice.java
@@ -38,7 +38,7 @@ import com.ning.billing.catalog.api.BillingPeriod;
import com.ning.billing.catalog.api.ProductCategory;
import com.ning.billing.jaxrs.json.AccountJson;
import com.ning.billing.jaxrs.json.BundleJsonNoSubsciptions;
-import com.ning.billing.jaxrs.json.InvoiceJson;
+import com.ning.billing.jaxrs.json.InvoiceJsonSimple;
import com.ning.billing.jaxrs.json.SubscriptionJsonNoEvents;
import com.ning.billing.jaxrs.resources.BaseJaxrsResource;
import com.ning.http.client.Response;
@@ -60,7 +60,7 @@ public class TestInvoice extends TestJaxrsBase {
AccountJson accountJson = createAccount("poupou", "qhddffrwe", "poupou@yahoo.com");
assertNotNull(accountJson);
- BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAcountId(), "9967599");
+ BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAccountId(), "9967599");
assertNotNull(bundleJson);
SubscriptionJsonNoEvents subscriptionJson = createSubscription(bundleJson.getBundleId(), "Shotgun", ProductCategory.BASE.toString(), BillingPeriod.MONTHLY.toString(), true);
@@ -74,12 +74,12 @@ public class TestInvoice extends TestJaxrsBase {
String uri = BaseJaxrsResource.INVOICES_PATH;
Map<String, String> queryParams = new HashMap<String, String>();
- queryParams.put(BaseJaxrsResource.QUERY_ACCOUNT_ID, accountJson.getAcountId());
+ queryParams.put(BaseJaxrsResource.QUERY_ACCOUNT_ID, accountJson.getAccountId());
Response response = doGet(uri, queryParams, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
String baseJson = response.getResponseBody();
- List<InvoiceJson> objFromJson = mapper.readValue(baseJson, new TypeReference<List<InvoiceJson>>() {});
+ List<InvoiceJsonSimple> objFromJson = mapper.readValue(baseJson, new TypeReference<List<InvoiceJsonSimple>>() {});
assertNotNull(objFromJson);
log.info(baseJson);
assertEquals(objFromJson.size(), 4);
@@ -89,7 +89,7 @@ public class TestInvoice extends TestJaxrsBase {
response = doGet(uri, DEFAULT_EMPTY_QUERY, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
baseJson = response.getResponseBody();
- InvoiceJson firstInvoiceJson = mapper.readValue(baseJson, InvoiceJson.class);
+ InvoiceJsonSimple firstInvoiceJson = mapper.readValue(baseJson, InvoiceJsonSimple.class);
assertNotNull(objFromJson);
assertEquals(firstInvoiceJson, objFromJson.get(0));
@@ -101,7 +101,7 @@ public class TestInvoice extends TestJaxrsBase {
response = doPost(uri, null, queryParams, DEFAULT_HTTP_TIMEOUT_SEC);
Assert.assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
baseJson = response.getResponseBody();
- InvoiceJson futureInvoice = mapper.readValue(baseJson, InvoiceJson.class);
+ InvoiceJsonSimple futureInvoice = mapper.readValue(baseJson, InvoiceJsonSimple.class);
assertNotNull(futureInvoice);
log.info(baseJson);
@@ -118,7 +118,7 @@ public class TestInvoice extends TestJaxrsBase {
response = doGet(uri, queryParams, DEFAULT_HTTP_TIMEOUT_SEC);
assertEquals(response.getStatusCode(), Status.OK.getStatusCode());
baseJson = response.getResponseBody();
- objFromJson = mapper.readValue(baseJson, new TypeReference<List<InvoiceJson>>() {});
+ objFromJson = mapper.readValue(baseJson, new TypeReference<List<InvoiceJsonSimple>>() {});
assertNotNull(objFromJson);
log.info(baseJson);
assertEquals(objFromJson.size(), 5);
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
index ce664b3..0a0d619 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestJaxrsBase.java
@@ -91,7 +91,7 @@ public class TestJaxrsBase {
private final static String PLUGIN_NAME = "noop";
- protected static final int DEFAULT_HTTP_TIMEOUT_SEC = 5;
+ protected static final int DEFAULT_HTTP_TIMEOUT_SEC = 500000; // 5;
protected static final Map<String, String> DEFAULT_EMPTY_QUERY = new HashMap<String, String>();
@@ -235,7 +235,7 @@ public class TestJaxrsBase {
mapper.registerModule(new JodaModule());
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
- mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy());
+ //mapper.setPropertyNamingStrategy(new PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy());
busHandler = new TestApiListener(null);
this.helper = listener.getMysqlTestingHelper();
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestSubscription.java b/server/src/test/java/com/ning/billing/jaxrs/TestSubscription.java
index 4a74dfc..d43c858 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestSubscription.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestSubscription.java
@@ -53,7 +53,7 @@ public class TestSubscription extends TestJaxrsBase {
clock.setDeltaFromReality(initialDate.getMillis() - clock.getUTCNow().getMillis());
AccountJson accountJson = createAccount("xil", "shdxilhkkl", "xil@yahoo.com");
- BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAcountId(), "99999");
+ BundleJsonNoSubsciptions bundleJson = createBundle(accountJson.getAccountId(), "99999");
String productName = "Shotgun";
BillingPeriod term = BillingPeriod.MONTHLY;