Details
diff --git a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java
index 04c5961..a82472c 100644
--- a/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java
+++ b/jaxrs/src/main/java/com/ning/billing/jaxrs/json/PaymentJsonSimple.java
@@ -37,6 +37,7 @@ public class PaymentJsonSimple extends JsonBase {
private final String accountId;
private final String invoiceId;
private final String paymentId;
+ private final String paymentNumber;
private final DateTime requestedDate;
private final DateTime effectiveDate;
private final Integer retryCount;
@@ -45,8 +46,6 @@ public class PaymentJsonSimple extends JsonBase {
private final String gatewayErrorCode;
private final String gatewayErrorMsg;
private final String paymentMethodId;
- private final String extFirstPaymentIdRef;
- private final String extSecondPaymentIdRef;
@JsonCreator
public PaymentJsonSimple(@JsonProperty("amount") final BigDecimal amount,
@@ -54,6 +53,7 @@ public class PaymentJsonSimple extends JsonBase {
@JsonProperty("accountId") final String accountId,
@JsonProperty("invoiceId") final String invoiceId,
@JsonProperty("paymentId") final String paymentId,
+ @JsonProperty("paymentNumber") final String paymentNumber,
@JsonProperty("paymentMethodId") final String paymentMethodId,
@JsonProperty("requestedDate") final DateTime requestedDate,
@JsonProperty("effectiveDate") final DateTime effectiveDate,
@@ -62,8 +62,6 @@ public class PaymentJsonSimple extends JsonBase {
@JsonProperty("status") final String status,
@JsonProperty("gatewayErrorCode") final String gatewayErrorCode,
@JsonProperty("gatewayErrorMsg") final String gatewayErrorMsg,
- @JsonProperty("extFirstPaymentIdRef") final String extFirstPaymentIdRef,
- @JsonProperty("extSecondPaymentIdRef") final String extSecondPaymentIdRef,
@JsonProperty("auditLogs") @Nullable final List<AuditLogJson> auditLogs) {
super(auditLogs);
this.amount = amount;
@@ -71,6 +69,7 @@ public class PaymentJsonSimple extends JsonBase {
this.invoiceId = invoiceId;
this.accountId = accountId;
this.paymentId = paymentId;
+ this.paymentNumber = paymentNumber;
this.paymentMethodId = paymentMethodId;
this.requestedDate = DefaultClock.toUTCDateTime(requestedDate);
this.effectiveDate = DefaultClock.toUTCDateTime(effectiveDate);
@@ -79,16 +78,14 @@ public class PaymentJsonSimple extends JsonBase {
this.status = status;
this.gatewayErrorCode = gatewayErrorCode;
this.gatewayErrorMsg = gatewayErrorMsg;
- this.extFirstPaymentIdRef = extFirstPaymentIdRef;
- this.extSecondPaymentIdRef = extSecondPaymentIdRef;
}
public PaymentJsonSimple(final Payment src, @Nullable final List<AuditLog> auditLogs) {
this(src.getAmount(), src.getPaidAmount(), src.getAccountId().toString(), src.getInvoiceId().toString(),
- src.getId().toString(), src.getPaymentMethodId().toString(), src.getEffectiveDate(), src.getEffectiveDate(),
+ src.getId().toString(), src.getPaymentNumber().toString(), src.getPaymentMethodId().toString(), src.getEffectiveDate(), src.getEffectiveDate(),
src.getAttempts().size(), src.getCurrency().toString(), src.getPaymentStatus().toString(),
src.getAttempts().get(src.getAttempts().size() - 1).getGatewayErrorCode(), src.getAttempts().get(src.getAttempts().size() - 1).getGatewayErrorMsg(),
- src.getExtFirstPaymentIdRef(), src.getExtSecondPaymentIdRef(), toAuditLogJson(auditLogs));
+ toAuditLogJson(auditLogs));
}
public PaymentJsonSimple(final Payment payment) {
@@ -103,6 +100,10 @@ public class PaymentJsonSimple extends JsonBase {
return invoiceId;
}
+ public String getPaymentNumber() {
+ return paymentNumber;
+ }
+
public String getPaymentId() {
return paymentId;
}
@@ -147,14 +148,6 @@ public class PaymentJsonSimple extends JsonBase {
return gatewayErrorMsg;
}
- public String getExtFirstPaymentIdRef() {
- return extFirstPaymentIdRef;
- }
-
- public String getExtSecondPaymentIdRef() {
- return extSecondPaymentIdRef;
- }
-
@Override
public boolean equals(final Object o) {
if (this == o) {
@@ -190,6 +183,9 @@ public class PaymentJsonSimple extends JsonBase {
if (paymentId != null ? !paymentId.equals(that.paymentId) : that.paymentId != null) {
return false;
}
+ if (paymentNumber != null ? !paymentNumber.equals(that.paymentNumber) : that.paymentNumber != null) {
+ return false;
+ }
if (!((requestedDate == null && that.requestedDate == null) ||
(requestedDate != null && that.requestedDate != null && requestedDate.compareTo(that.requestedDate) == 0))) {
return false;
@@ -208,14 +204,18 @@ public class PaymentJsonSimple extends JsonBase {
public int hashCode() {
int result = paidAmount != null ? paidAmount.hashCode() : 0;
result = 31 * result + (amount != null ? amount.hashCode() : 0);
+ result = 31 * result + (accountId != null ? accountId.hashCode() : 0);
result = 31 * result + (invoiceId != null ? invoiceId.hashCode() : 0);
result = 31 * result + (paymentId != null ? paymentId.hashCode() : 0);
+ result = 31 * result + (paymentNumber != null ? paymentNumber.hashCode() : 0);
result = 31 * result + (requestedDate != null ? requestedDate.hashCode() : 0);
result = 31 * result + (effectiveDate != null ? effectiveDate.hashCode() : 0);
result = 31 * result + (retryCount != null ? retryCount.hashCode() : 0);
result = 31 * result + (currency != null ? currency.hashCode() : 0);
result = 31 * result + (status != null ? status.hashCode() : 0);
- result = 31 * result + (accountId != null ? accountId.hashCode() : 0);
+ result = 31 * result + (gatewayErrorCode != null ? gatewayErrorCode.hashCode() : 0);
+ result = 31 * result + (gatewayErrorMsg != null ? gatewayErrorMsg.hashCode() : 0);
+ result = 31 * result + (paymentMethodId != null ? paymentMethodId.hashCode() : 0);
return result;
}
}
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 6675c43..abf78f3 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
@@ -42,6 +42,7 @@ public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
@JsonProperty("accountId") final String accountId,
@JsonProperty("invoiceId") final String invoiceId,
@JsonProperty("paymentId") final String paymentId,
+ @JsonProperty("paymentNumber") final String paymentNumber,
@JsonProperty("paymentMethodId") final String paymentMethodId,
@JsonProperty("requestedDate") final DateTime requestedDate,
@JsonProperty("effectiveDate") final DateTime effectiveDate,
@@ -50,15 +51,12 @@ public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
@JsonProperty("status") final String status,
@JsonProperty("gatewayErrorCode") final String gatewayErrorCode,
@JsonProperty("gatewayErrorMsg") final String gatewayErrorMsg,
- @JsonProperty("extFirstPaymentIdRef") final String extFirstPaymentIdRef,
- @JsonProperty("extSecondPaymentIdRef") final String extSecondPaymentIdRef,
@JsonProperty("externalBundleKeys") final String bundleKeys,
@JsonProperty("refunds") final List<RefundJson> refunds,
@JsonProperty("chargebacks") final List<ChargebackJson> chargebacks,
@JsonProperty("auditLogs") @Nullable final List<AuditLogJson> auditLogs) {
- super(amount, paidAmount, accountId, invoiceId, paymentId, paymentMethodId, requestedDate, effectiveDate,
- retryCount, currency, status, gatewayErrorCode, gatewayErrorMsg, extFirstPaymentIdRef,
- extSecondPaymentIdRef, auditLogs);
+ super(amount, paidAmount, accountId, invoiceId, paymentId, paymentNumber, paymentMethodId, requestedDate, effectiveDate,
+ retryCount, currency, status, gatewayErrorCode, gatewayErrorMsg, auditLogs);
this.bundleKeys = bundleKeys;
this.refunds = refunds;
this.chargebacks = chargebacks;
@@ -74,12 +72,12 @@ public class PaymentJsonWithBundleKeys extends PaymentJsonSimple {
@Nullable final List<AuditLog> auditLogs) {
this(payment.getAmount(), payment.getPaidAmount(), accountId.toString(),
payment.getInvoiceId().toString(), payment.getId().toString(),
+ payment.getPaymentNumber().toString(),
payment.getPaymentMethodId().toString(),
payment.getEffectiveDate(), payment.getEffectiveDate(),
nbOfPaymentAttempts, payment.getCurrency().toString(), status,
payment.getAttempts().get(nbOfPaymentAttempts - 1).getGatewayErrorCode(),
payment.getAttempts().get(nbOfPaymentAttempts - 1).getGatewayErrorMsg(),
- payment.getExtFirstPaymentIdRef(), payment.getExtSecondPaymentIdRef(),
bundleExternalKey, refunds, chargebacks, toAuditLogJson(auditLogs));
}
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 c17defb..527e5b5 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
@@ -93,6 +93,7 @@ public class TestBundleTimelineJson extends JaxrsTestSuiteNoDB {
private PaymentJsonSimple createPayment(final UUID accountId, final UUID invoiceId) {
final UUID paymentId = UUID.randomUUID();
+ final Integer paymentNumber = 17;
final UUID paymentMethodId = UUID.randomUUID();
final BigDecimal paidAmount = BigDecimal.TEN;
final BigDecimal amount = BigDecimal.ZERO;
@@ -103,11 +104,8 @@ public class TestBundleTimelineJson extends JaxrsTestSuiteNoDB {
final String status = UUID.randomUUID().toString();
final String gatewayErrorCode = "OK";
final String gatewayErrorMsg = "Excellent...";
- final String extFirstPaymentIdRef = UUID.randomUUID().toString();
- final String extSecondPaymentIdRef = UUID.randomUUID().toString();
-
- return new PaymentJsonSimple(amount, paidAmount, accountId.toString(), invoiceId.toString(), paymentId.toString(),
+ return new PaymentJsonSimple(amount, paidAmount, accountId.toString(), invoiceId.toString(), paymentId.toString(), paymentNumber.toString(),
paymentMethodId.toString(), paymentRequestedDate, paymentEffectiveDate, retryCount, currency, status,
- gatewayErrorCode, gatewayErrorMsg, extFirstPaymentIdRef, extSecondPaymentIdRef, null);
+ gatewayErrorCode, gatewayErrorMsg, null);
}
}
diff --git a/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java b/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
index 62646ca..5c69c1c 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/KillbillClient.java
@@ -691,7 +691,7 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
protected void payAllInvoices(final AccountJson accountJson, final Boolean externalPayment) throws IOException {
final PaymentJsonSimple payment = new PaymentJsonSimple(null, null, accountJson.getAccountId(), null, null, null, null,
- null, 0, null, null, null, null, null, null, null);
+ null, null, 0, null, null, null, null, null);
final String postJson = mapper.writeValueAsString(payment);
final String uri = JaxrsResource.INVOICES_PATH + "/" + JaxrsResource.PAYMENTS;
@@ -700,7 +700,7 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
protected List<PaymentJsonSimple> createInstaPayment(final AccountJson accountJson, final InvoiceJsonSimple invoice) throws IOException {
final PaymentJsonSimple payment = new PaymentJsonSimple(invoice.getAmount(), BigDecimal.ZERO, accountJson.getAccountId(),
- invoice.getInvoiceId(), null, null, null, null, 0, null, null, null, null, null, null, null);
+ invoice.getInvoiceId(), null, null, null, null, null, 0, null, null, null, null, null);
final String postJson = mapper.writeValueAsString(payment);
final String uri = JaxrsResource.INVOICES_PATH + "/" + invoice.getInvoiceId() + "/" + JaxrsResource.PAYMENTS;
@@ -711,8 +711,8 @@ public abstract class KillbillClient extends GuicyKillbillTestSuiteWithEmbeddedD
protected List<PaymentJsonSimple> createExternalPayment(final AccountJson accountJson, final String invoiceId, final BigDecimal paidAmount) throws IOException {
final PaymentJsonSimple payment = new PaymentJsonSimple(paidAmount, BigDecimal.ZERO, accountJson.getAccountId(),
- invoiceId, null, null, null, null, 0,
- null, null, null, null, null, null, null);
+ invoiceId, null, null, null, null, null, 0,
+ null, null, null, null, null);
final String postJson = mapper.writeValueAsString(payment);
final String paymentURI = JaxrsResource.INVOICES_PATH + "/" + invoiceId + "/" + JaxrsResource.PAYMENTS;
diff --git a/server/src/test/java/com/ning/billing/jaxrs/TestPayment.java b/server/src/test/java/com/ning/billing/jaxrs/TestPayment.java
index 15247e5..b1a4fb3 100644
--- a/server/src/test/java/com/ning/billing/jaxrs/TestPayment.java
+++ b/server/src/test/java/com/ning/billing/jaxrs/TestPayment.java
@@ -205,8 +205,6 @@ public class TestPayment extends TestJaxrsBase {
Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getGatewayErrorCode(), paymentJsonSimple.getGatewayErrorCode());
Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getGatewayErrorMsg(), paymentJsonSimple.getGatewayErrorMsg());
Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getPaymentMethodId(), paymentJsonSimple.getPaymentMethodId());
- Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getExtFirstPaymentIdRef(), paymentJsonSimple.getExtFirstPaymentIdRef());
- Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getExtSecondPaymentIdRef(), paymentJsonSimple.getExtSecondPaymentIdRef());
Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getChargebacks().size(), 0);
Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getRefunds().size(), 1);
Assert.assertEquals(retrievedPaymentJsonWithBundleKeys.getRefunds().get(0), refundJsonCheck);