Subversion Repositories SmartDukaan

Rev

Rev 29497 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.entity.fofo;

import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
import com.spice.profitmandi.dao.enumuration.fofo.PaymentStatus;

@Entity
@Table(name = "fofo.payment")
public class FofoPayment {
        
        private static final long serialVersionUID = 1L;
        @Id
        @Column(name = "id")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private int id;
        
        @Column(name="fofo_id")
        private int fofoId;
        @Column(name="amount")
        private double amount;
        
        @Column(name="gateway")
        @Enumerated(EnumType.STRING)
        private Gateway gateway;

        @Column(name="payment_method")
        private String paymentMethod;
        
        @Column(name="gateway_fee")
        private double gatewayFee;
        
        @Column(name="gateway_reference")
        private String gatewayReference;
        
        @Column(name="status")
        @Enumerated(EnumType.STRING)
        private PaymentStatus status=PaymentStatus.INIT;
        
        @Column(name="create_timestamp")
        private LocalDateTime createTimestamp;
        
        
        @Column(name="update_timestamp")
        private LocalDateTime updateTimestamp;
        
        
        
        public double getTotalAmount() {
                return amount + gatewayFee;
        }

        @Override
        public String toString() {
                return "FofoPayment [id=" + id + ", fofoId=" + fofoId + ", amount=" + amount + ", gateway=" + gateway
                                + ", gatewayFee=" + gatewayFee + ", gatewayReference=" + gatewayReference + ", status=" + status
                                + ", createTimestamp=" + createTimestamp + ", updateTimestamp=" + updateTimestamp + ", paymentMethod="
                                + paymentMethod + "]";
        }

        public int getId() {
                return id;
        }

        public void setId(int id) {
                this.id = id;
        }

        public int getFofoId() {
                return fofoId;
        }

        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }

        public double getAmount() {
                return amount;
        }

        public void setAmount(double amount) {
                this.amount = amount;
        }

        public Gateway getGateway() {
                return gateway;
        }

        public void setGateway(Gateway gateway) {
                this.gateway = gateway;
        }

        public double getGatewayFee() {
                return gatewayFee;
        }

        public void setGatewayFee(double gatewayFee) {
                this.gatewayFee = gatewayFee;
        }

        public String getGatewayReference() {
                return gatewayReference;
        }

        public void setGatewayReference(String gatewayReference) {
                this.gatewayReference = gatewayReference;
        }

        public PaymentStatus getStatus() {
                return status;
        }

        public void setStatus(PaymentStatus status) {
                this.status = status;
        }

        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }

        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }

        public LocalDateTime getUpdateTimestamp() {
                return updateTimestamp;
        }

        public void setUpdateTimestamp(LocalDateTime updateTimestamp) {
                this.updateTimestamp = updateTimestamp;
        }

        public String getPaymentMethod() {
                return paymentMethod;
        }

        public void setPaymentMethod(String paymentMethod) {
                this.paymentMethod = paymentMethod;
        }

        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                long temp;
                temp = Double.doubleToLongBits(amount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
                result = prime * result + fofoId;
                result = prime * result + ((gateway == null) ? 0 : gateway.hashCode());
                temp = Double.doubleToLongBits(gatewayFee);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                result = prime * result + ((gatewayReference == null) ? 0 : gatewayReference.hashCode());
                result = prime * result + id;
                result = prime * result + ((paymentMethod == null) ? 0 : paymentMethod.hashCode());
                result = prime * result + ((status == null) ? 0 : status.hashCode());
                result = prime * result + ((updateTimestamp == null) ? 0 : updateTimestamp.hashCode());
                return result;
        }

        @Override
        public boolean equals(Object obj) {
                if (this == obj)
                        return true;
                if (obj == null)
                        return false;
                if (getClass() != obj.getClass())
                        return false;
                FofoPayment other = (FofoPayment) obj;
                if (Double.doubleToLongBits(amount) != Double.doubleToLongBits(other.amount))
                        return false;
                if (createTimestamp == null) {
                        if (other.createTimestamp != null)
                                return false;
                } else if (!createTimestamp.equals(other.createTimestamp))
                        return false;
                if (fofoId != other.fofoId)
                        return false;
                if (gateway != other.gateway)
                        return false;
                if (Double.doubleToLongBits(gatewayFee) != Double.doubleToLongBits(other.gatewayFee))
                        return false;
                if (gatewayReference == null) {
                        if (other.gatewayReference != null)
                                return false;
                } else if (!gatewayReference.equals(other.gatewayReference))
                        return false;
                if (id != other.id)
                        return false;
                if (paymentMethod == null) {
                        if (other.paymentMethod != null)
                                return false;
                } else if (!paymentMethod.equals(other.paymentMethod))
                        return false;
                if (status != other.status)
                        return false;
                if (updateTimestamp == null) {
                        if (other.updateTimestamp != null)
                                return false;
                } else if (!updateTimestamp.equals(other.updateTimestamp))
                        return false;
                return true;
        }
        
        
}