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
index 255cef2..9451faa 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonWithBundleKeys.java
@@ -44,6 +44,7 @@ public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
@JsonProperty("accountId") final String accountId,
@JsonProperty("invoiceId") final String invoiceId,
@JsonProperty("paymentId") final String paymentId,
+ @JsonProperty("paymentMethodId") final String paymentMethodId,
@JsonProperty("requestedDt") final DateTime requestedDate,
@JsonProperty("effectiveDt") final DateTime effectiveDate,
@JsonProperty("retryCount") final Integer retryCount,
@@ -52,7 +53,7 @@ public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
@JsonProperty("externalBundleKeys") final String bundleKeys,
@JsonProperty("refunds") final List<RefundJson> refunds,
@JsonProperty("chargebacks") final List<ChargebackJson> chargebacks) {
- super(amount, paidAmount, accountId, invoiceId, paymentId, requestedDate, effectiveDate, retryCount, currency, status);
+ super(amount, paidAmount, accountId, invoiceId, paymentId, paymentMethodId, requestedDate, effectiveDate, retryCount, currency, status);
this.bundleKeys = bundleKeys;
this.refunds = refunds;
this.chargebacks = chargebacks;
diff --git a/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestBundleTimelineJson.java b/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestBundleTimelineJson.java
index 96b6adf..9c835af 100644
--- a/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestBundleTimelineJson.java
+++ b/jaxrs/src/test/java/com/ning/billing/jaxrs/json/TestBundleTimelineJson.java
@@ -59,13 +59,13 @@ public class TestBundleTimelineJson extends JaxrsTestSuite {
final BundleJsonWithSubscriptions bundleJsonWithSubscriptions = createBundleWithSubscriptions();
final InvoiceJsonSimple invoiceJsonSimple = createInvoice();
final PaymentJsonSimple paymentJsonSimple = createPayment(UUID.fromString(invoiceJsonSimple.getAccountId()),
- UUID.fromString(invoiceJsonSimple.getInvoiceId()));
+ UUID.fromString(invoiceJsonSimple.getInvoiceId()));
final BundleTimelineJson bundleTimelineJson = new BundleTimelineJson(viewId,
- bundleJsonWithSubscriptions,
- ImmutableList.<PaymentJsonSimple>of(paymentJsonSimple),
- ImmutableList.<InvoiceJsonSimple>of(invoiceJsonSimple),
- reason);
+ bundleJsonWithSubscriptions,
+ ImmutableList.<PaymentJsonSimple>of(paymentJsonSimple),
+ ImmutableList.<InvoiceJsonSimple>of(invoiceJsonSimple),
+ reason);
final String asJson = mapper.writeValueAsString(bundleTimelineJson);
@@ -75,41 +75,42 @@ public class TestBundleTimelineJson extends JaxrsTestSuite {
final InvoiceJsonSimple invoice = bundleTimelineJson.getInvoices().get(0);
Assert.assertEquals(asJson, "{\"viewId\":\"" + bundleTimelineJson.getViewId() + "\"," +
- "\"bundle\":{\"bundleId\":\"" + bundleTimelineJson.getBundle().getBundleId() + "\"," +
- "\"externalKey\":\"" + bundleTimelineJson.getBundle().getExternalKey() + "\"," +
- "\"subscriptions\":" +
- "[{\"events\":[{\"eventId\":\"" + event.getEventId() + "\"," +
- "\"billingPeriod\":\"" + event.getBillingPeriod() + "\"," +
- "\"product\":\"" + event.getProduct() + "\"," +
- "\"priceList\":\"" + event.getPriceList() + "\"," +
- "\"eventType\":\"" + event.getEventType() + "\"," +
- "\"phase\":\"" + event.getPhase() + "\"," +
- "\"requestedDate\":null," +
- "\"effectiveDate\":\"" + event.getEffectiveDate().toDateTimeISO().toString() + "\"}]," +
- "\"subscriptionId\":\"" + subscription.getSubscriptionId() + "\"," +
- "\"deletedEvents\":null," +
- "\"newEvents\":null}]}," +
- "\"payments\":[{\"amount\":" + payment.getAmount() + "," +
- "\"paidAmount\":" + payment.getPaidAmount() + "," +
- "\"accountId\":\"" + payment.getAccountId() + "\"," +
- "\"invoiceId\":\"" + payment.getInvoiceId() + "\"," +
- "\"paymentId\":\"" + payment.getPaymentId() + "\"," +
- "\"requestedDate\":\"" + payment.getRequestedDate().toDateTimeISO().toString() + "\"," +
- "\"effectiveDate\":\"" + payment.getEffectiveDate().toDateTimeISO().toString() + "\"," +
- "\"retryCount\":" + payment.getRetryCount() + "," +
- "\"currency\":\"" + payment.getCurrency() + "\"," +
- "\"status\":\"" + payment.getStatus() + "\"}]," +
- "\"invoices\":[{\"amount\":" + invoice.getAmount() + "," +
- "\"cba\":" + invoice.getCBA() + "," +
- "\"creditAdj\":" + invoice.getCreditAdj() + "," +
- "\"refundAdj\":" + invoice.getRefundAdj() + "," +
- "\"invoiceId\":\"" + invoice.getInvoiceId() + "\"," +
- "\"invoiceDate\":\"" + invoice.getInvoiceDate().toString() + "\"," +
- "\"targetDate\":\"" + invoice.getTargetDate() + "\"," +
- "\"invoiceNumber\":\"" + invoice.getInvoiceNumber() + "\"," +
- "\"balance\":" + invoice.getBalance() + "," +
- "\"accountId\":\"" + invoice.getAccountId() + "\"}]," +
- "\"reasonForChange\":\"" + reason + "\"}");
+ "\"bundle\":{\"bundleId\":\"" + bundleTimelineJson.getBundle().getBundleId() + "\"," +
+ "\"externalKey\":\"" + bundleTimelineJson.getBundle().getExternalKey() + "\"," +
+ "\"subscriptions\":" +
+ "[{\"events\":[{\"eventId\":\"" + event.getEventId() + "\"," +
+ "\"billingPeriod\":\"" + event.getBillingPeriod() + "\"," +
+ "\"product\":\"" + event.getProduct() + "\"," +
+ "\"priceList\":\"" + event.getPriceList() + "\"," +
+ "\"eventType\":\"" + event.getEventType() + "\"," +
+ "\"phase\":\"" + event.getPhase() + "\"," +
+ "\"requestedDate\":null," +
+ "\"effectiveDate\":\"" + event.getEffectiveDate().toDateTimeISO().toString() + "\"}]," +
+ "\"subscriptionId\":\"" + subscription.getSubscriptionId() + "\"," +
+ "\"deletedEvents\":null," +
+ "\"newEvents\":null}]}," +
+ "\"payments\":[{\"amount\":" + payment.getAmount() + "," +
+ "\"paidAmount\":" + payment.getPaidAmount() + "," +
+ "\"accountId\":\"" + payment.getAccountId() + "\"," +
+ "\"invoiceId\":\"" + payment.getInvoiceId() + "\"," +
+ "\"paymentId\":\"" + payment.getPaymentId() + "\"," +
+ "\"paymentMethodId\":\"" + payment.getPaymentMethodId() + "\"," +
+ "\"requestedDate\":\"" + payment.getRequestedDate().toDateTimeISO().toString() + "\"," +
+ "\"effectiveDate\":\"" + payment.getEffectiveDate().toDateTimeISO().toString() + "\"," +
+ "\"retryCount\":" + payment.getRetryCount() + "," +
+ "\"currency\":\"" + payment.getCurrency() + "\"," +
+ "\"status\":\"" + payment.getStatus() + "\"}]," +
+ "\"invoices\":[{\"amount\":" + invoice.getAmount() + "," +
+ "\"cba\":" + invoice.getCBA() + "," +
+ "\"creditAdj\":" + invoice.getCreditAdj() + "," +
+ "\"refundAdj\":" + invoice.getRefundAdj() + "," +
+ "\"invoiceId\":\"" + invoice.getInvoiceId() + "\"," +
+ "\"invoiceDate\":\"" + invoice.getInvoiceDate().toString() + "\"," +
+ "\"targetDate\":\"" + invoice.getTargetDate() + "\"," +
+ "\"invoiceNumber\":\"" + invoice.getInvoiceNumber() + "\"," +
+ "\"balance\":" + invoice.getBalance() + "," +
+ "\"accountId\":\"" + invoice.getAccountId() + "\"}]," +
+ "\"reasonForChange\":\"" + reason + "\"}");
final BundleTimelineJson fromJson = mapper.readValue(asJson, BundleTimelineJson.class);
Assert.assertEquals(fromJson, bundleTimelineJson);
@@ -120,8 +121,8 @@ public class TestBundleTimelineJson extends JaxrsTestSuite {
final DateTime effectiveDate = clock.getUTCNow();
final UUID eventId = UUID.randomUUID();
final PlanPhaseSpecifier planPhaseSpecifier = new PlanPhaseSpecifier(UUID.randomUUID().toString(), ProductCategory.BASE,
- BillingPeriod.NO_BILLING_PERIOD, UUID.randomUUID().toString(),
- PhaseType.EVERGREEN);
+ BillingPeriod.NO_BILLING_PERIOD, UUID.randomUUID().toString(),
+ PhaseType.EVERGREEN);
Mockito.when(event.getEffectiveDate()).thenReturn(effectiveDate);
Mockito.when(event.getEventId()).thenReturn(eventId);
Mockito.when(event.getSubscriptionTransitionType()).thenReturn(SubscriptionTransitionType.CREATE);
@@ -151,11 +152,12 @@ public class TestBundleTimelineJson extends JaxrsTestSuite {
final BigDecimal balance = BigDecimal.ZERO;
return new InvoiceJsonSimple(invoiceAmount, cba, creditAdj, refundAdj, invoiceId.toString(), invoiceDate,
- targetDate, invoiceNumber, balance, accountId.toString());
+ targetDate, invoiceNumber, balance, accountId.toString());
}
private PaymentJsonSimple createPayment(final UUID accountId, final UUID invoiceId) {
final UUID paymentId = UUID.randomUUID();
+ final UUID paymentMethodId = UUID.randomUUID();
final BigDecimal paidAmount = BigDecimal.TEN;
final BigDecimal amount = BigDecimal.ZERO;
final DateTime paymentRequestedDate = clock.getUTCNow();
@@ -165,7 +167,6 @@ public class TestBundleTimelineJson extends JaxrsTestSuite {
final String status = UUID.randomUUID().toString();
return new PaymentJsonSimple(amount, paidAmount, accountId.toString(), invoiceId.toString(), paymentId.toString(),
- paymentRequestedDate, paymentEffectiveDate, retryCount,
- currency, status);
+ paymentMethodId.toString(), paymentRequestedDate, paymentEffectiveDate, retryCount, currency, status);
}
}
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 a4c59bc..e586273 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestInvoice.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestInvoice.java
@@ -205,7 +205,7 @@ public class TestInvoice extends TestJaxrsBase {
}
// CREATE INSTA PAYMENT
- final PaymentJsonSimple payment = new PaymentJsonSimple(cur.getAmount(), BigDecimal.ZERO, accountJson.getAccountId(), cur.getInvoiceId(), null, null, null, 0, null, null);
+ final PaymentJsonSimple payment = new PaymentJsonSimple(cur.getAmount(), BigDecimal.ZERO, accountJson.getAccountId(), cur.getInvoiceId(), null, null, null, null, 0, null, null);
final String postJson = mapper.writeValueAsString(payment);
uri = JaxrsResource.INVOICES_PATH + "/" + cur.getInvoiceId() + "/" + JaxrsResource.PAYMENTS;