com.gocart.model.orders.response.Transaction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gocart-java-sdk Show documentation
Show all versions of gocart-java-sdk Show documentation
A java client library designed to make it easier for merchants to integrate with GoCart API
The newest version!
package com.gocart.model.orders.response;
import com.gocart.model.enums.TransactionStatus;
import com.gocart.model.enums.TransactionType;
import com.gocart.utils.JsonUtil;
import java.util.Objects;
import java.util.Optional;
/**
* Defines the fields for a transation
*/
public class Transaction {
private String gatewayTransactionId;
private int amount;
private TransactionType type;
private TransactionStatus status;
private String orderId;
private String externalId;
public String getGatewayTransactionId() {
return gatewayTransactionId;
}
public void setGatewayTransactionId(String gatewayTransactionId) {
this.gatewayTransactionId = gatewayTransactionId;
}
public int getAmount() {
return amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
public TransactionType getType() {
return type;
}
public void setType(TransactionType type) {
this.type = type;
}
public TransactionStatus getStatus() {
return status;
}
public void setStatus(TransactionStatus status) {
this.status = status;
}
public String getOrderId() {
return orderId;
}
public void setOrderId(String orderId) {
this.orderId = orderId;
}
public String getExternalId() {
return externalId;
}
public void setExternalId(String externalId) {
this.externalId = externalId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Transaction that = (Transaction) o;
return amount == that.amount && Objects.equals(gatewayTransactionId, that.gatewayTransactionId) && type == that.type && status == that.status && Objects.equals(orderId, that.orderId) && Objects.equals(externalId, that.externalId);
}
@Override
public int hashCode() {
return Objects.hash(gatewayTransactionId, amount, type, status, orderId, externalId);
}
@Override
public String toString() {
Optional string = JsonUtil.toString(this);
return string.orElse(null);
}
}