Subversion Repositories SmartDukaan

Rev

Rev 29497 | Go to most recent revision | 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.LoanPaymentStatus;

@Entity
@Table(name = "fofo.loan_payment_request", schema = "fofo")
public class LoanPaymentRequest {
        
        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="credit_amount")
        private double creditAmount;
        
        @Column(name="gateway_fee")
        private double gatewayFee;
        
        @Column(name="status")
        @Enumerated(EnumType.STRING)
        private LoanPaymentStatus loanPaymentStatus=LoanPaymentStatus.INIT;
        
        @Column(name="create_timestamp")
        private LocalDateTime createTimestamp;
        
        @Column(name="gateway_identifier")
        @Enumerated(EnumType.STRING)
        private Gateway gateway;
        
        
        @Column(name="payment_method")
        private String paymentMethod;
        
        public double getTotalAmount() {
                return creditAmount + gatewayFee;
        }
        
        public int getId() {
                return id;
        }
        public void setId(int id) {
                this.id = id;
        }
        public LoanPaymentStatus getLoanPaymentStatus() {
                return loanPaymentStatus;
        }
        public void setLoanPaymentStatus(LoanPaymentStatus loanPaymentStatus) {
                this.loanPaymentStatus = loanPaymentStatus;
        }
        public LocalDateTime getCreateTimestamp() {
                return createTimestamp;
        }
        public void setCreateTimestamp(LocalDateTime createTimestamp) {
                this.createTimestamp = createTimestamp;
        }
        public int getFofoId() {
                return fofoId;
        }
        public void setFofoId(int fofoId) {
                this.fofoId = fofoId;
        }

        
        public double getCreditAmount() {
                return creditAmount;
        }

        public void setCreditAmount(double creditAmount) {
                this.creditAmount = creditAmount;
        }

        public double getGatewayFee() {
                return gatewayFee;
        }
        public void setGatewayFee(double gatewayFee) {
                this.gatewayFee = gatewayFee;
        }
        public String getPaymentMethod() {
                return paymentMethod;
        }
        public void setPaymentMethod(String paymentMethod) {
                this.paymentMethod = paymentMethod;
        }
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
                result = prime * result + ((createTimestamp == null) ? 0 : createTimestamp.hashCode());
                long temp;
                temp = Double.doubleToLongBits(creditAmount);
                result = prime * result + (int) (temp ^ (temp >>> 32));
                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 + id;
                result = prime * result + ((loanPaymentStatus == null) ? 0 : loanPaymentStatus.hashCode());
                result = prime * result + ((paymentMethod == null) ? 0 : paymentMethod.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;
                LoanPaymentRequest other = (LoanPaymentRequest) obj;
                if (createTimestamp == null) {
                        if (other.createTimestamp != null)
                                return false;
                } else if (!createTimestamp.equals(other.createTimestamp))
                        return false;
                if (Double.doubleToLongBits(creditAmount) != Double.doubleToLongBits(other.creditAmount))
                        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 (id != other.id)
                        return false;
                if (loanPaymentStatus != other.loanPaymentStatus)
                        return false;
                if (paymentMethod == null) {
                        if (other.paymentMethod != null)
                                return false;
                } else if (!paymentMethod.equals(other.paymentMethod))
                        return false;
                return true;
        }

        public Gateway getGateway() {
                return gateway;
        }

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

        @Override
        public String toString() {
                return "LoanPaymentRequest [id=" + id + ", fofoId=" + fofoId + ", creditAmount=" + creditAmount
                                + ", gatewayFee=" + gatewayFee + ", loanPaymentStatus=" + loanPaymentStatus + ", createTimestamp="
                                + createTimestamp + ", gateway=" + gateway + ", paymentMethod=" + paymentMethod + "]";
        }
        
        
}