org.killbill.billing.client.model.PaymentTransaction Maven / Gradle / Ivy
/*
* Copyright 2014 Groupon, Inc
*
* Groupon 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.client.model;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nullable;
import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
public class PaymentTransaction extends KillBillObject {
private UUID transactionId;
private String transactionExternalKey;
private UUID paymentId;
private String paymentExternalKey;
private String transactionType;
private DateTime effectiveDate;
private String status;
private BigDecimal amount;
private String currency;
private BigDecimal processedAmount;
private String processedCurrency;
private String gatewayErrorCode;
private String gatewayErrorMsg;
// Plugin specific fields
private String firstPaymentReferenceId;
private String secondPaymentReferenceId;
// Avoid null iterable field
private List properties = ImmutableList.of();
public PaymentTransaction() {
}
@JsonCreator
public PaymentTransaction(@JsonProperty("transactionId") final UUID transactionId,
@JsonProperty("transactionExternalKey") final String transactionExternalKey,
@JsonProperty("paymentId") final UUID paymentId,
@JsonProperty("paymentExternalKey") final String paymentExternalKey,
@JsonProperty("transactionType") final String transactionType,
@JsonProperty("amount") final BigDecimal amount,
@JsonProperty("currency") final String currency,
@JsonProperty("effectiveDate") final DateTime effectiveDate,
@JsonProperty("processedAmount") final BigDecimal processedAmount,
@JsonProperty("processedCurrency") final String processedCurrency,
@JsonProperty("status") final String status,
@JsonProperty("gatewayErrorCode") final String gatewayErrorCode,
@JsonProperty("gatewayErrorMsg") final String gatewayErrorMsg,
@JsonProperty("firstPaymentReferenceId") final String firstPaymentReferenceId,
@JsonProperty("secondPaymentReferenceId") final String secondPaymentReferenceId,
@JsonProperty("properties") @Nullable final List properties,
@JsonProperty("auditLogs") @Nullable final List auditLogs) {
super(auditLogs);
this.transactionId = transactionId;
this.transactionExternalKey = transactionExternalKey;
this.paymentId = paymentId;
this.paymentExternalKey = paymentExternalKey;
this.transactionType = transactionType;
this.effectiveDate = effectiveDate;
this.status = status;
this.amount = amount;
this.currency = currency;
this.processedAmount = processedAmount;
this.processedCurrency = processedCurrency;
this.gatewayErrorCode = gatewayErrorCode;
this.gatewayErrorMsg = gatewayErrorMsg;
this.firstPaymentReferenceId = firstPaymentReferenceId;
this.secondPaymentReferenceId = secondPaymentReferenceId;
setProperties(properties);
}
public UUID getTransactionId() {
return transactionId;
}
public void setTransactionId(final UUID transactionId) {
this.transactionId = transactionId;
}
public String getTransactionExternalKey() {
return transactionExternalKey;
}
public void setTransactionExternalKey(final String transactionExternalKey) {
this.transactionExternalKey = transactionExternalKey;
}
public UUID getPaymentId() {
return paymentId;
}
public void setPaymentId(final UUID paymentId) {
this.paymentId = paymentId;
}
public String getPaymentExternalKey() {
return paymentExternalKey;
}
public void setPaymentExternalKey(final String paymentExternalKey) {
this.paymentExternalKey = paymentExternalKey;
}
public String getTransactionType() {
return transactionType;
}
public void setTransactionType(final String transactionType) {
this.transactionType = transactionType;
}
public DateTime getEffectiveDate() {
return effectiveDate;
}
public void setEffectiveDate(final DateTime effectiveDate) {
this.effectiveDate = effectiveDate;
}
public String getStatus() {
return status;
}
public void setStatus(final String status) {
this.status = status;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(final BigDecimal amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(final String currency) {
this.currency = currency;
}
public BigDecimal getProcessedAmount() {
return processedAmount;
}
public void setProcessedAmount(final BigDecimal processedAmount) {
this.processedAmount = processedAmount;
}
public String getProcessedCurrency() {
return processedCurrency;
}
public void setProcessedCurrency(final String processedCurrency) {
this.processedCurrency = processedCurrency;
}
public String getGatewayErrorCode() {
return gatewayErrorCode;
}
public void setGatewayErrorCode(final String gatewayErrorCode) {
this.gatewayErrorCode = gatewayErrorCode;
}
public String getGatewayErrorMsg() {
return gatewayErrorMsg;
}
public void setGatewayErrorMsg(final String gatewayErrorMsg) {
this.gatewayErrorMsg = gatewayErrorMsg;
}
public String getFirstPaymentReferenceId() {
return firstPaymentReferenceId;
}
public void setFirstPaymentReferenceId(final String firstPaymentReferenceId) {
this.firstPaymentReferenceId = firstPaymentReferenceId;
}
public String getSecondPaymentReferenceId() {
return secondPaymentReferenceId;
}
public void setSecondPaymentReferenceId(final String secondPaymentReferenceId) {
this.secondPaymentReferenceId = secondPaymentReferenceId;
}
public List getProperties() {
return properties;
}
public void setProperties(final List properties) {
if (properties != null) {
this.properties = properties;
}
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("PaymentTransaction{");
sb.append("transactionId=").append(transactionId);
sb.append(", transactionExternalKey='").append(transactionExternalKey).append('\'');
sb.append(", paymentId=").append(paymentId);
sb.append(", paymentExternalKey='").append(paymentExternalKey).append('\'');
sb.append(", transactionType='").append(transactionType).append('\'');
sb.append(", effectiveDate=").append(effectiveDate);
sb.append(", status='").append(status).append('\'');
sb.append(", amount=").append(amount);
sb.append(", currency='").append(currency).append('\'');
sb.append(", processedAmount=").append(processedAmount);
sb.append(", processedCurrency='").append(processedCurrency).append('\'');
sb.append(", gatewayErrorCode='").append(gatewayErrorCode).append('\'');
sb.append(", gatewayErrorMsg='").append(gatewayErrorMsg).append('\'');
sb.append(", firstPaymentReferenceId='").append(firstPaymentReferenceId).append('\'');
sb.append(", secondPaymentReferenceId='").append(secondPaymentReferenceId).append('\'');
sb.append(", properties=").append(properties);
sb.append('}');
return sb.toString();
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final PaymentTransaction that = (PaymentTransaction) o;
if (amount != null ? amount.compareTo(that.amount) != 0 : that.amount != null) {
return false;
}
if (processedAmount != null ? processedAmount.compareTo(that.processedAmount) != 0 : that.processedAmount != null) {
return false;
}
if (currency != null ? !currency.equals(that.currency) : that.currency != null) {
return false;
}
if (processedCurrency != null ? !processedCurrency.equals(that.processedCurrency) : that.processedCurrency != null) {
return false;
}
if (paymentExternalKey != null ? !paymentExternalKey.equals(that.paymentExternalKey) : that.paymentExternalKey != null) {
return false;
}
if (paymentId != null ? !paymentId.equals(that.paymentId) : that.paymentId != null) {
return false;
}
if (transactionExternalKey != null ? !transactionExternalKey.equals(that.transactionExternalKey) : that.transactionExternalKey != null) {
return false;
}
if (transactionId != null ? !transactionId.equals(that.transactionId) : that.transactionId != null) {
return false;
}
if (effectiveDate != null ? effectiveDate.compareTo(that.effectiveDate) != 0 : that.effectiveDate != null) {
return false;
}
if (firstPaymentReferenceId != null ? !firstPaymentReferenceId.equals(that.firstPaymentReferenceId) : that.firstPaymentReferenceId != null) {
return false;
}
if (gatewayErrorCode != null ? !gatewayErrorCode.equals(that.gatewayErrorCode) : that.gatewayErrorCode != null) {
return false;
}
if (gatewayErrorMsg != null ? !gatewayErrorMsg.equals(that.gatewayErrorMsg) : that.gatewayErrorMsg != null) {
return false;
}
if (properties != null ? !properties.equals(that.properties) : that.properties != null) {
return false;
}
if (secondPaymentReferenceId != null ? !secondPaymentReferenceId.equals(that.secondPaymentReferenceId) : that.secondPaymentReferenceId != null) {
return false;
}
if (status != null ? !status.equals(that.status) : that.status != null) {
return false;
}
if (transactionType != null ? !transactionType.equals(that.transactionType) : that.transactionType != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = transactionId != null ? transactionId.hashCode() : 0;
result = 31 * result + (transactionExternalKey != null ? transactionExternalKey.hashCode() : 0);
result = 31 * result + (paymentId != null ? paymentId.hashCode() : 0);
result = 31 * result + (paymentExternalKey != null ? paymentExternalKey.hashCode() : 0);
result = 31 * result + (transactionType != null ? transactionType.hashCode() : 0);
result = 31 * result + (effectiveDate != null ? effectiveDate.hashCode() : 0);
result = 31 * result + (status != null ? status.hashCode() : 0);
result = 31 * result + (amount != null ? amount.hashCode() : 0);
result = 31 * result + (currency != null ? currency.hashCode() : 0);
result = 31 * result + (processedAmount != null ? processedAmount.hashCode() : 0);
result = 31 * result + (processedCurrency != null ? processedCurrency.hashCode() : 0);
result = 31 * result + (gatewayErrorCode != null ? gatewayErrorCode.hashCode() : 0);
result = 31 * result + (gatewayErrorMsg != null ? gatewayErrorMsg.hashCode() : 0);
result = 31 * result + (firstPaymentReferenceId != null ? firstPaymentReferenceId.hashCode() : 0);
result = 31 * result + (secondPaymentReferenceId != null ? secondPaymentReferenceId.hashCode() : 0);
result = 31 * result + (properties != null ? properties.hashCode() : 0);
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy