killbill-uncached
Changes
payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInternalEvent.java 215(+215 -0)
payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentPluginErrorEvent.java 105(+15 -90)
Details
diff --git a/api/src/main/java/org/killbill/billing/events/PaymentErrorInternalEvent.java b/api/src/main/java/org/killbill/billing/events/PaymentErrorInternalEvent.java
index 9ef4716..c261a13 100644
--- a/api/src/main/java/org/killbill/billing/events/PaymentErrorInternalEvent.java
+++ b/api/src/main/java/org/killbill/billing/events/PaymentErrorInternalEvent.java
@@ -13,24 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
-package org.killbill.billing.events;
-
-import java.util.UUID;
-import org.killbill.billing.payment.api.TransactionStatus;
-import org.killbill.billing.payment.api.TransactionType;
+package org.killbill.billing.events;
public interface PaymentErrorInternalEvent extends PaymentInternalEvent {
-
public String getMessage();
-
- public UUID getAccountId();
-
- public UUID getPaymentId();
-
- public UUID getPaymentTransactionId();
-
- public TransactionStatus getStatus();
-
- public TransactionType getTransactionType();
}
diff --git a/api/src/main/java/org/killbill/billing/events/PaymentInfoInternalEvent.java b/api/src/main/java/org/killbill/billing/events/PaymentInfoInternalEvent.java
index 4669d1d..2e30ab6 100644
--- a/api/src/main/java/org/killbill/billing/events/PaymentInfoInternalEvent.java
+++ b/api/src/main/java/org/killbill/billing/events/PaymentInfoInternalEvent.java
@@ -16,20 +16,5 @@
package org.killbill.billing.events;
-import java.math.BigDecimal;
-import java.util.UUID;
-
-import org.joda.time.DateTime;
-import org.killbill.billing.catalog.api.Currency;
-import org.killbill.billing.payment.api.TransactionStatus;
-import org.killbill.billing.payment.api.TransactionType;
-
public interface PaymentInfoInternalEvent extends PaymentInternalEvent {
-
- public BigDecimal getAmount();
-
- public Currency getCurrency();
-
- public DateTime getEffectiveDate();
-
}
diff --git a/api/src/main/java/org/killbill/billing/events/PaymentInternalEvent.java b/api/src/main/java/org/killbill/billing/events/PaymentInternalEvent.java
index 6a442de..63d38e4 100644
--- a/api/src/main/java/org/killbill/billing/events/PaymentInternalEvent.java
+++ b/api/src/main/java/org/killbill/billing/events/PaymentInternalEvent.java
@@ -17,8 +17,11 @@
package org.killbill.billing.events;
+import java.math.BigDecimal;
import java.util.UUID;
+import org.joda.time.DateTime;
+import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.payment.api.TransactionStatus;
import org.killbill.billing.payment.api.TransactionType;
@@ -30,8 +33,13 @@ public interface PaymentInternalEvent extends BusInternalEvent {
public UUID getPaymentTransactionId();
- public TransactionType getTransactionType();
+ public BigDecimal getAmount();
+
+ public Currency getCurrency();
public TransactionStatus getStatus();
+ public TransactionType getTransactionType();
+
+ public DateTime getEffectiveDate();
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentErrorEvent.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentErrorEvent.java
index 030eb96..4e47dcf 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentErrorEvent.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentErrorEvent.java
@@ -16,41 +16,35 @@
package org.killbill.billing.payment.api;
+import java.math.BigDecimal;
import java.util.UUID;
-import org.killbill.billing.events.BusEventBase;
+import org.joda.time.DateTime;
+import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.events.PaymentErrorInternalEvent;
import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class DefaultPaymentErrorEvent extends BusEventBase implements PaymentErrorInternalEvent {
+public class DefaultPaymentErrorEvent extends DefaultPaymentInternalEvent implements PaymentErrorInternalEvent {
private final String message;
- private final UUID accountId;
- private final UUID paymentId;
- private final UUID paymentTransactionId;
- private final TransactionStatus status;
- private final TransactionType transactionType;
@JsonCreator
public DefaultPaymentErrorEvent(@JsonProperty("accountId") final UUID accountId,
@JsonProperty("paymentId") final UUID paymentId,
@JsonProperty("paymentTransactionId") final UUID paymentTransactionId,
+ @JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("currency") final Currency currency,
@JsonProperty("status") final TransactionStatus status,
- @JsonProperty("transactionType") final TransactionType transactionType,
+ @JsonProperty("transactionType") final TransactionType transactionType,
+ @JsonProperty("effectiveDate") final DateTime effectiveDate,
@JsonProperty("message") final String message,
@JsonProperty("searchKey1") final Long searchKey1,
@JsonProperty("searchKey2") final Long searchKey2,
@JsonProperty("userToken") final UUID userToken) {
- super(searchKey1, searchKey2, userToken);
+ super(accountId, paymentId, paymentTransactionId, amount, currency, status, transactionType, effectiveDate, searchKey1, searchKey2, userToken);
this.message = message;
- this.accountId = accountId;
- this.paymentId = paymentId;
- this.paymentTransactionId = paymentTransactionId;
- this.status = status;
- this.transactionType = transactionType;
}
@Override
@@ -59,89 +53,7 @@ public class DefaultPaymentErrorEvent extends BusEventBase implements PaymentErr
}
@Override
- public UUID getAccountId() {
- return accountId;
- }
-
- @Override
- public UUID getPaymentId() {
- return paymentId;
- }
-
- @Override
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- @Override
- public UUID getPaymentTransactionId() {
- return paymentTransactionId;
- }
-
- @Override
- public TransactionStatus getStatus() {
- return status;
- }
-
- @JsonIgnore
- @Override
- public BusInternalEventType getBusEventType() {
- return BusInternalEventType.PAYMENT_ERROR;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("DefaultPaymentErrorEvent{");
- sb.append("message='").append(message).append('\'');
- sb.append(", accountId=").append(accountId);
- sb.append(", paymentId=").append(paymentId);
- sb.append(", paymentTransactionId=").append(paymentTransactionId);
- sb.append(", status=").append(status);
- sb.append(", transactionType=").append(transactionType);
- sb.append('}');
- return sb.toString();
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof DefaultPaymentErrorEvent)) {
- return false;
- }
-
- final DefaultPaymentErrorEvent that = (DefaultPaymentErrorEvent) o;
-
- if (accountId != null ? !accountId.equals(that.accountId) : that.accountId != null) {
- return false;
- }
- if (transactionType != null ? !transactionType.equals(that.transactionType) : that.transactionType != null) {
- return false;
- }
- if (message != null ? !message.equals(that.message) : that.message != null) {
- return false;
- }
- if (paymentId != null ? !paymentId.equals(that.paymentId) : that.paymentId != null) {
- return false;
- }
- if (paymentTransactionId != null ? !paymentTransactionId.equals(that.paymentTransactionId) : that.paymentTransactionId != null) {
- return false;
- }
- if (status != null ? !status.equals(that.status) : that.status != null) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = message != null ? message.hashCode() : 0;
- result = 31 * result + (accountId != null ? accountId.hashCode() : 0);
- result = 31 * result + (transactionType != null ? transactionType.hashCode() : 0);
- result = 31 * result + (paymentId != null ? paymentId.hashCode() : 0);
- result = 31 * result + (paymentTransactionId != null ? paymentTransactionId.hashCode() : 0);
- result = 31 * result + (status != null ? status.hashCode() : 0);
- return result;
+ protected Class getPaymentInternalEventClass() {
+ return DefaultPaymentErrorEvent.class;
}
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInfoEvent.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInfoEvent.java
index 9dd0eb5..193a692 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInfoEvent.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInfoEvent.java
@@ -21,210 +21,28 @@ import java.util.UUID;
import org.joda.time.DateTime;
import org.killbill.billing.catalog.api.Currency;
-import org.killbill.billing.events.BusEventBase;
import org.killbill.billing.events.PaymentInfoInternalEvent;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
-public class DefaultPaymentInfoEvent extends BusEventBase implements PaymentInfoInternalEvent {
+public class DefaultPaymentInfoEvent extends DefaultPaymentInternalEvent implements PaymentInfoInternalEvent {
- private final UUID accountId;
- private final UUID paymentId;
- private final UUID paymentTransactionId;
- private final BigDecimal amount;
- private final Currency currency;
- private final TransactionStatus status;
- private final TransactionType transactionType;
- private final DateTime effectiveDate;
-
- @JsonCreator
public DefaultPaymentInfoEvent(@JsonProperty("accountId") final UUID accountId,
@JsonProperty("paymentId") final UUID paymentId,
@JsonProperty("paymentTransactionId") final UUID paymentTransactionId,
@JsonProperty("amount") final BigDecimal amount,
@JsonProperty("currency") final Currency currency,
@JsonProperty("status") final TransactionStatus status,
- @JsonProperty("transactionType") final TransactionType transactionType,
- @JsonProperty("extFirstPaymentRefId") final String extFirstPaymentRefId /* TODO for backward compatibility only */,
- @JsonProperty("extSecondPaymentRefId") final String extSecondPaymentRefId /* TODO for backward compatibility only */,
+ @JsonProperty("transactionType") final TransactionType transactionType,
@JsonProperty("effectiveDate") final DateTime effectiveDate,
@JsonProperty("searchKey1") final Long searchKey1,
@JsonProperty("searchKey2") final Long searchKey2,
@JsonProperty("userToken") final UUID userToken) {
- super(searchKey1, searchKey2, userToken);
- this.accountId = accountId;
- this.paymentId = paymentId;
- this.paymentTransactionId = paymentTransactionId;
- this.amount = amount;
- this.currency = currency;
- this.status = status;
- this.transactionType = transactionType;
- this.effectiveDate = effectiveDate;
- }
-
- public DefaultPaymentInfoEvent(final UUID accountId,
- final UUID paymentId,
- final UUID paymentTransactionId,
- final BigDecimal amount,
- final Currency currency,
- final TransactionStatus status,
- final TransactionType transactionType,
- final DateTime effectiveDate,
- final Long searchKey1,
- final Long searchKey2,
- final UUID userToken) {
- this(accountId, paymentId, paymentTransactionId, amount, currency, status, transactionType, null, null,
- effectiveDate, searchKey1, searchKey2, userToken);
- }
-
- @JsonIgnore
- @Override
- public BusInternalEventType getBusEventType() {
- return BusInternalEventType.PAYMENT_INFO;
- }
-
- @Override
- public UUID getAccountId() {
- return accountId;
- }
-
-
- @Override
- public BigDecimal getAmount() {
- return amount;
- }
-
- @Override
- public Currency getCurrency() {
- return currency;
- }
-
- @Override
- public DateTime getEffectiveDate() {
- return effectiveDate;
- }
-
- @Override
- public UUID getPaymentId() {
- return paymentId;
- }
-
- @Override
- public UUID getPaymentTransactionId() {
- return paymentTransactionId;
- }
-
- @Override
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- @Override
- public TransactionStatus getStatus() {
- return status;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder();
- sb.append("DefaultPaymentInfoEvent");
- sb.append("{accountId=").append(accountId);
- sb.append(", paymentId=").append(paymentId);
- sb.append(", paymentTransactionId=").append(paymentTransactionId);
- sb.append(", amount=").append(amount);
- sb.append(", currency=").append(currency);
- sb.append(", status=").append(status);
- sb.append(", transactionType=").append(transactionType);
- sb.append(", effectiveDate=").append(effectiveDate);
- sb.append('}');
- return sb.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((accountId == null) ? 0 : accountId.hashCode());
- result = prime * result + ((amount == null) ? 0 : amount.hashCode());
- result = prime * result
- + ((effectiveDate == null) ? 0 : effectiveDate.hashCode());
- result = prime * result
- + ((paymentId == null) ? 0 : paymentId.hashCode());
- result = prime * result
- + ((paymentTransactionId == null) ? 0 : paymentTransactionId.hashCode());
- result = prime * result
- + ((currency == null) ? 0 : currency.hashCode());
- result = prime * result + ((status == null) ? 0 : status.hashCode());
- return result;
+ super(accountId, paymentId, paymentTransactionId, amount, currency, status, transactionType, effectiveDate, searchKey1, searchKey2, userToken);
}
@Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final DefaultPaymentInfoEvent other = (DefaultPaymentInfoEvent) obj;
- if (accountId == null) {
- if (other.accountId != null) {
- return false;
- }
- } else if (!accountId.equals(other.accountId)) {
- return false;
- }
- if (transactionType == null) {
- if (other.transactionType != null) {
- return false;
- }
- } else if (!transactionType.equals(other.transactionType)) {
- return false;
- }
- if (amount == null) {
- if (other.amount != null) {
- return false;
- }
- } else if (amount.compareTo(other.amount) != 0) {
- return false;
- }
- if (effectiveDate == null) {
- if (other.effectiveDate != null) {
- return false;
- }
- } else if (effectiveDate.compareTo(other.effectiveDate) != 0) {
- return false;
- }
- if (paymentId == null) {
- if (other.paymentId != null) {
- return false;
- }
- } else if (!paymentId.equals(other.paymentId)) {
- return false;
- }
- if (paymentTransactionId == null) {
- if (other.paymentTransactionId != null) {
- return false;
- }
- } else if (!paymentTransactionId.equals(other.paymentTransactionId)) {
- return false;
- }
- if (currency == null) {
- if (other.currency != null) {
- return false;
- }
- } else if (!currency.equals(other.currency)) {
- return false;
- }
- if (status != other.status) {
- return false;
- }
- return true;
+ protected Class getPaymentInternalEventClass() {
+ return DefaultPaymentInfoEvent.class;
}
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInternalEvent.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInternalEvent.java
new file mode 100644
index 0000000..c3d6aa6
--- /dev/null
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentInternalEvent.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2014-2015 Groupon, Inc
+ * Copyright 2014-2015 The Billing Project, LLC
+ *
+ * The Billing Project 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.
+ */
+
+package org.killbill.billing.payment.api;
+
+import java.math.BigDecimal;
+import java.util.UUID;
+
+import org.joda.time.DateTime;
+import org.killbill.billing.catalog.api.Currency;
+import org.killbill.billing.events.BusEventBase;
+import org.killbill.billing.events.PaymentInternalEvent;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public abstract class DefaultPaymentInternalEvent extends BusEventBase implements PaymentInternalEvent {
+
+ private final UUID accountId;
+ private final UUID paymentId;
+ private final UUID paymentTransactionId;
+ private final BigDecimal amount;
+ private final Currency currency;
+ private final TransactionStatus status;
+ private final TransactionType transactionType;
+ private final DateTime effectiveDate;
+
+ @JsonCreator
+ public DefaultPaymentInternalEvent(@JsonProperty("accountId") final UUID accountId,
+ @JsonProperty("paymentId") final UUID paymentId,
+ @JsonProperty("paymentTransactionId") final UUID paymentTransactionId,
+ @JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("currency") final Currency currency,
+ @JsonProperty("status") final TransactionStatus status,
+ @JsonProperty("transactionType") final TransactionType transactionType,
+ @JsonProperty("effectiveDate") final DateTime effectiveDate,
+ @JsonProperty("searchKey1") final Long searchKey1,
+ @JsonProperty("searchKey2") final Long searchKey2,
+ @JsonProperty("userToken") final UUID userToken) {
+ super(searchKey1, searchKey2, userToken);
+ this.accountId = accountId;
+ this.paymentId = paymentId;
+ this.paymentTransactionId = paymentTransactionId;
+ this.amount = amount;
+ this.currency = currency;
+ this.status = status;
+ this.transactionType = transactionType;
+ this.effectiveDate = effectiveDate;
+ }
+
+ @JsonIgnore
+ @Override
+ public BusInternalEventType getBusEventType() {
+ return BusInternalEventType.PAYMENT_INFO;
+ }
+
+ @Override
+ public UUID getAccountId() {
+ return accountId;
+ }
+
+ @Override
+ public BigDecimal getAmount() {
+ return amount;
+ }
+
+ @Override
+ public Currency getCurrency() {
+ return currency;
+ }
+
+ @Override
+ public DateTime getEffectiveDate() {
+ return effectiveDate;
+ }
+
+ @Override
+ public UUID getPaymentId() {
+ return paymentId;
+ }
+
+ @Override
+ public UUID getPaymentTransactionId() {
+ return paymentTransactionId;
+ }
+
+ @Override
+ public TransactionType getTransactionType() {
+ return transactionType;
+ }
+
+ @Override
+ public TransactionStatus getStatus() {
+ return status;
+ }
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append(getPaymentInternalEventClass().toString());
+ sb.append(" {accountId=").append(accountId);
+ sb.append(", paymentId=").append(paymentId);
+ sb.append(", paymentTransactionId=").append(paymentTransactionId);
+ sb.append(", amount=").append(amount);
+ sb.append(", currency=").append(currency);
+ sb.append(", status=").append(status);
+ sb.append(", transactionType=").append(transactionType);
+ sb.append(", effectiveDate=").append(effectiveDate);
+ sb.append('}');
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((accountId == null) ? 0 : accountId.hashCode());
+ result = prime * result + ((amount == null) ? 0 : amount.hashCode());
+ result = prime * result
+ + ((effectiveDate == null) ? 0 : effectiveDate.hashCode());
+ result = prime * result
+ + ((paymentId == null) ? 0 : paymentId.hashCode());
+ result = prime * result
+ + ((paymentTransactionId == null) ? 0 : paymentTransactionId.hashCode());
+ result = prime * result
+ + ((currency == null) ? 0 : currency.hashCode());
+ result = prime * result + ((status == null) ? 0 : status.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DefaultPaymentInternalEvent other = (DefaultPaymentInternalEvent) obj;
+ if (accountId == null) {
+ if (other.accountId != null) {
+ return false;
+ }
+ } else if (!accountId.equals(other.accountId)) {
+ return false;
+ }
+ if (transactionType == null) {
+ if (other.transactionType != null) {
+ return false;
+ }
+ } else if (!transactionType.equals(other.transactionType)) {
+ return false;
+ }
+ if (amount == null) {
+ if (other.amount != null) {
+ return false;
+ }
+ } else if (amount.compareTo(other.amount) != 0) {
+ return false;
+ }
+ if (effectiveDate == null) {
+ if (other.effectiveDate != null) {
+ return false;
+ }
+ } else if (effectiveDate.compareTo(other.effectiveDate) != 0) {
+ return false;
+ }
+ if (paymentId == null) {
+ if (other.paymentId != null) {
+ return false;
+ }
+ } else if (!paymentId.equals(other.paymentId)) {
+ return false;
+ }
+ if (paymentTransactionId == null) {
+ if (other.paymentTransactionId != null) {
+ return false;
+ }
+ } else if (!paymentTransactionId.equals(other.paymentTransactionId)) {
+ return false;
+ }
+ if (currency == null) {
+ if (other.currency != null) {
+ return false;
+ }
+ } else if (!currency.equals(other.currency)) {
+ return false;
+ }
+ if (status != other.status) {
+ return false;
+ }
+ return true;
+ }
+
+ protected abstract Class getPaymentInternalEventClass();
+}
diff --git a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentPluginErrorEvent.java b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentPluginErrorEvent.java
index 10c1fc3..f69d82d 100644
--- a/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentPluginErrorEvent.java
+++ b/payment/src/main/java/org/killbill/billing/payment/api/DefaultPaymentPluginErrorEvent.java
@@ -16,40 +16,35 @@
package org.killbill.billing.payment.api;
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.killbill.billing.events.BusEventBase;
+import java.math.BigDecimal;
+import java.util.UUID;
+
+import org.joda.time.DateTime;
+import org.killbill.billing.catalog.api.Currency;
import org.killbill.billing.events.PaymentPluginErrorInternalEvent;
-import java.util.UUID;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
-public class DefaultPaymentPluginErrorEvent extends BusEventBase implements PaymentPluginErrorInternalEvent {
+public class DefaultPaymentPluginErrorEvent extends DefaultPaymentInternalEvent implements PaymentPluginErrorInternalEvent {
private final String message;
- private final UUID accountId;
- private final UUID paymentId;
- private final UUID paymentTransactionId;
- private final TransactionStatus status;
- private final TransactionType transactionType;
@JsonCreator
public DefaultPaymentPluginErrorEvent(@JsonProperty("accountId") final UUID accountId,
@JsonProperty("paymentId") final UUID paymentId,
@JsonProperty("paymentTransactionId") final UUID paymentTransactionId,
+ @JsonProperty("amount") final BigDecimal amount,
+ @JsonProperty("currency") final Currency currency,
@JsonProperty("status") final TransactionStatus status,
- @JsonProperty("transactionType") final TransactionType transactionType,
+ @JsonProperty("transactionType") final TransactionType transactionType,
+ @JsonProperty("effectiveDate") final DateTime effectiveDate,
@JsonProperty("message") final String message,
@JsonProperty("searchKey1") final Long searchKey1,
@JsonProperty("searchKey2") final Long searchKey2,
@JsonProperty("userToken") final UUID userToken) {
- super(searchKey1, searchKey2, userToken);
+ super(accountId, paymentId, paymentTransactionId, amount, currency, status, transactionType, effectiveDate, searchKey1, searchKey2, userToken);
this.message = message;
- this.accountId = accountId;
- this.paymentId = paymentId;
- this.paymentTransactionId = paymentTransactionId;
- this.status = status;
- this.transactionType = transactionType;
}
@Override
@@ -58,77 +53,7 @@ public class DefaultPaymentPluginErrorEvent extends BusEventBase implements Paym
}
@Override
- public UUID getAccountId() {
- return accountId;
- }
-
- @Override
- public UUID getPaymentId() {
- return paymentId;
- }
-
- @Override
- public TransactionType getTransactionType() {
- return transactionType;
- }
-
- @Override
- public UUID getPaymentTransactionId() {
- return paymentTransactionId;
- }
-
- @Override
- public TransactionStatus getStatus() {
- return status;
- }
-
- @JsonIgnore
- @Override
- public BusInternalEventType getBusEventType() {
- return BusInternalEventType.PAYMENT_PLUGIN_ERROR;
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (!(o instanceof DefaultPaymentPluginErrorEvent)) {
- return false;
- }
-
- final DefaultPaymentPluginErrorEvent that = (DefaultPaymentPluginErrorEvent) o;
-
- if (accountId != null ? !accountId.equals(that.accountId) : that.accountId != null) {
- return false;
- }
- if (transactionType != null ? !transactionType.equals(that.transactionType) : that.transactionType != null) {
- return false;
- }
- if (message != null ? !message.equals(that.message) : that.message != null) {
- return false;
- }
- if (paymentId != null ? !paymentId.equals(that.paymentId) : that.paymentId != null) {
- return false;
- }
- if (paymentTransactionId != null ? !paymentTransactionId.equals(that.paymentTransactionId) : that.paymentTransactionId != null) {
- return false;
- }
- if (status != null ? !status.equals(that.status) : that.status != null) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = message != null ? message.hashCode() : 0;
- result = 31 * result + (accountId != null ? accountId.hashCode() : 0);
- result = 31 * result + (transactionType != null ? transactionType.hashCode() : 0);
- result = 31 * result + (paymentId != null ? paymentId.hashCode() : 0);
- result = 31 * result + (paymentTransactionId != null ? paymentTransactionId.hashCode() : 0);
- result = 31 * result + (status != null ? status.hashCode() : 0);
- return result;
+ protected Class getPaymentInternalEventClass() {
+ return DefaultPaymentPluginErrorEvent.class;
}
}
diff --git a/payment/src/main/java/org/killbill/billing/payment/core/sm/payments/PaymentEnteringStateCallback.java b/payment/src/main/java/org/killbill/billing/payment/core/sm/payments/PaymentEnteringStateCallback.java
index 3dc675a..8cdc6eb 100644
--- a/payment/src/main/java/org/killbill/billing/payment/core/sm/payments/PaymentEnteringStateCallback.java
+++ b/payment/src/main/java/org/killbill/billing/payment/core/sm/payments/PaymentEnteringStateCallback.java
@@ -66,8 +66,11 @@ public abstract class PaymentEnteringStateCallback implements EnteringStateCallb
final BusInternalEvent event = new DefaultPaymentErrorEvent(paymentStateContext.getAccount().getId(),
null,
null,
+ paymentStateContext.getAmount(),
+ paymentStateContext.getCurrency(),
null,
paymentStateContext.getTransactionType(),
+ null,
"Early abortion of payment transaction",
paymentStateContext.getInternalCallContext().getAccountRecordId(),
paymentStateContext.getInternalCallContext().getTenantRecordId(),
diff --git a/payment/src/main/java/org/killbill/billing/payment/dao/DefaultPaymentDao.java b/payment/src/main/java/org/killbill/billing/payment/dao/DefaultPaymentDao.java
index 33ab485..ff64501 100644
--- a/payment/src/main/java/org/killbill/billing/payment/dao/DefaultPaymentDao.java
+++ b/payment/src/main/java/org/killbill/billing/payment/dao/DefaultPaymentDao.java
@@ -590,8 +590,11 @@ public class DefaultPaymentDao implements PaymentDao {
event = new DefaultPaymentErrorEvent(accountId,
paymentId,
transactionId,
+ processedAmount,
+ processedCurrency,
transactionStatus,
transactionType,
+ effectiveDate,
gatewayErrorCode,
context.getAccountRecordId(),
context.getTenantRecordId(),
@@ -603,8 +606,11 @@ public class DefaultPaymentDao implements PaymentDao {
event = new DefaultPaymentPluginErrorEvent(accountId,
paymentId,
transactionId,
+ processedAmount,
+ processedCurrency,
transactionStatus,
transactionType,
+ effectiveDate,
gatewayErrorCode,
context.getAccountRecordId(),
context.getTenantRecordId(),
diff --git a/payment/src/test/java/org/killbill/billing/payment/api/TestEventJson.java b/payment/src/test/java/org/killbill/billing/payment/api/TestEventJson.java
index 8e2338a..257c157 100644
--- a/payment/src/test/java/org/killbill/billing/payment/api/TestEventJson.java
+++ b/payment/src/test/java/org/killbill/billing/payment/api/TestEventJson.java
@@ -34,7 +34,7 @@ public class TestEventJson extends PaymentTestSuiteNoDB {
@Test(groups = "fast")
public void testPaymentErrorEvent() throws Exception {
- final PaymentErrorInternalEvent e = new DefaultPaymentErrorEvent(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), TransactionStatus.SUCCESS, TransactionType.PURCHASE, "no message", 1L, 2L, UUID.randomUUID());
+ final PaymentErrorInternalEvent e = new DefaultPaymentErrorEvent(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID(), BigDecimal.ONE, Currency.USD, TransactionStatus.SUCCESS, TransactionType.PURCHASE, new DateTime(), "no message", 1L, 2L, UUID.randomUUID());
final String json = mapper.writeValueAsString(e);
final Class<?> claz = Class.forName(DefaultPaymentErrorEvent.class.getName());